-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed issue #87 so that now SRT subtitles are read live and made local and remote file access consistent and easily extendable. #156
Merged
Merged
Changes from 32 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
e79ad93
Added TRUNC and FORCE commands so RemoteFileChannel has a full set of…
enternoescape d5d0398
Created new interfaces and classes for more seamless integration of l…
enternoescape a0b3486
Updated subtitle handlers to use the new remote file access methods t…
enternoescape 5ee9d52
Merge pull request #2 from google/master
enternoescape b7d62c8
Fixed read only exceptions to throw a standard NonWritableChannelExce…
enternoescape 573e82c
Fixed a logical problem with limit not being set correctly.
enternoescape 89df89a
Fixed a typo in the test file name.
enternoescape 8cc5abb
Simplified tests and added actual random read and write patterns to t…
enternoescape 9c5b6fa
Fixed some wording the code.
enternoescape bbc0966
Incremented micro version.
enternoescape 0234aac
Removed executeCommand from interface.
enternoescape 895f15b
Removed isActiveFile() from interfaces.
enternoescape 3aedae8
Lowered visibility of the RandomAccessFile behind LocalSageFile.
enternoescape 30f190c
Removed wild cards from imports.
enternoescape 1d11048
Removed executeCommand and isActiveFile.
enternoescape 9d81f0f
Removed wild cards from imports.
enternoescape 99689c9
synchronized encryptWrite.
enternoescape e14893d
Fixed read(byte[],int,int) method to read the most possible and corre…
enternoescape d3afef1
Changed fileChannel when in write mode to open up in read/write mode …
enternoescape aac89e5
Improved file length/size logic to be less aggressive by default.
enternoescape 1759c6f
Added parameter for a remote file to be read as if it's an active fil…
enternoescape 20894b4
Removed a debugging line accidentally left in and changed check for E…
enternoescape 973a472
Incremented version.
enternoescape 242d2ed
Incremented versions for MiniLauncher and SageLauncher.
enternoescape c50b743
Fixed upload ID missing, flushing after writes and a lack of optimal …
enternoescape 251ebf5
Fixed some scatter, gather logic.
enternoescape 06b7e5d
Fixed regression after verifying that the original code was working a…
enternoescape 5683b94
Fixed write flush behavior when seeking backwards in the write buffer…
enternoescape ac52a36
Fixed variable being used to get currPlaylist. Fixed skip method so w…
enternoescape ac73615
Changed transferFrom(ReadableByteChannel, long) to more accurately ha…
enternoescape ddc3a3c
Added ensureProperFile(false) to the start of all read methods that d…
enternoescape e961fd3
Fixed the length not returning correctly when not at the end of the f…
enternoescape 87432c4
Fixed skip on BlurayFile so it returns the number of bytes skipped in…
enternoescape aec8b6e
Moved flush in read(byte[], int, int) to just before the actual read …
enternoescape 78be558
Wrapped LocalSageFile classes in BufferedSageFile classes.
enternoescape 9fa860c
Fixed version and copyright.
enternoescape 2f46a77
Added constant for determining if the next subtitle wasn't returned a…
enternoescape e0fde56
Remove remote file from access list before returning.
enternoescape 028ec72
Remove raw file from access list when we close this subtitle handler.
enternoescape 39fa023
Removed encryption from ModuleGroup.
enternoescape bf6db93
Fixed a few comments and JavaDocs to be more descriptive/accurate.
enternoescape 9f2dec9
Moved test folder and reverted erroneous change in VobSubSubtitleHand…
enternoescape File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ | |
*/ | ||
package sage; | ||
|
||
import sage.io.LocalSageFile; | ||
|
||
public class FileDownloader extends SystemTask | ||
{ | ||
private static final int MP4_RESEEK_PREROLL_TIME = 1000; | ||
|
@@ -239,7 +241,7 @@ public synchronized Object downloadFile(String serverName, String srcFile, java. | |
} | ||
break; | ||
} | ||
fileOut = new FastRandomFile(myDestFile, "rw", Sage.I18N_CHARSET); | ||
fileOut = new LocalSageFile(myDestFile, false); | ||
if (captureMode) | ||
fileOut.seek(fileOut.length()); | ||
else | ||
|
@@ -318,7 +320,7 @@ else if (remoteUIXfer) | |
outStream.flush(); | ||
str = Sage.readLineBytes(inStream); | ||
remoteSize = Long.parseLong(str.substring(0, str.indexOf(' '))); | ||
fileOut = new FastRandomFile(myDestFile, "rw", Sage.I18N_CHARSET); | ||
fileOut = new LocalSageFile(myDestFile, false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FastRandomFile does buffered writes, so you should probably wrap this in the buffering class for equivalence. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
if (captureMode) | ||
fileOut.seek(fileOut.length()); | ||
else | ||
|
@@ -616,11 +618,11 @@ else if (isMP4Stream && lastNotifyReadOffset > downloadedBytes + 256*1024) | |
waitForCircWrite(numRead); | ||
synchronized (notifyRead) | ||
{ | ||
if (fileOut.getFilePointer() + numRead < circSize) | ||
if (fileOut.position() + numRead < circSize) | ||
fileOut.write(decryptBuf, 0, numRead); | ||
else | ||
{ | ||
int firstWrite = (int)(circSize - fileOut.getFilePointer()); | ||
int firstWrite = (int)(circSize - fileOut.position()); | ||
fileOut.write(decryptBuf, 0, firstWrite); | ||
fileOut.seek(0); | ||
fileOut.write(decryptBuf, firstWrite, numRead - firstWrite); | ||
|
@@ -648,11 +650,11 @@ else if (isMP4Stream && lastNotifyReadOffset > downloadedBytes + 256*1024) | |
waitForCircWrite(numRead); | ||
synchronized (notifyRead) | ||
{ | ||
if (fileOut.getFilePointer() + numRead < circSize) | ||
if (fileOut.position() + numRead < circSize) | ||
fileOut.write(xferBuf, 0, numRead); | ||
else | ||
{ | ||
int firstWrite = (int)(circSize - fileOut.getFilePointer()); | ||
int firstWrite = (int)(circSize - fileOut.position()); | ||
fileOut.write(xferBuf, 0, firstWrite); | ||
fileOut.seek(0); | ||
fileOut.write(xferBuf, firstWrite, numRead - firstWrite); | ||
|
@@ -1458,11 +1460,11 @@ private void stvTaskRun() | |
if (circSize > 0) | ||
{ | ||
waitForCircWrite(currRead); | ||
if (fileOut.getFilePointer() + currRead < circSize) | ||
if (fileOut.position() + currRead < circSize) | ||
fileOut.write(xferBuf, 0, currRead); | ||
else | ||
{ | ||
int firstWrite = (int)(circSize - fileOut.getFilePointer()); | ||
int firstWrite = (int)(circSize - fileOut.position()); | ||
fileOut.write(xferBuf, 0, firstWrite); | ||
fileOut.seek(0); | ||
fileOut.write(xferBuf, firstWrite, currRead - firstWrite); | ||
|
@@ -1755,7 +1757,7 @@ public DecryptInfo(String algorithm, byte[] key, byte[] iv) | |
protected java.net.Socket sock = null; | ||
protected java.io.DataOutputStream outStream = null; | ||
protected java.io.DataInputStream inStream = null; | ||
protected FastRandomFile fileOut = null; | ||
protected sage.io.SageFileSource fileOut = null; | ||
protected long remoteSize; | ||
protected boolean isMP4Stream; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FastRandomFile does buffered writes, so you should probably wrap this in the buffering class for equivalence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.