Skip to content

Commit

Permalink
fix: add offset for resuming to downloadPipedStream
Browse files Browse the repository at this point in the history
  • Loading branch information
lart2150 committed Oct 5, 2024
1 parent 6c097da commit 041b177
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/com/tivo/kmttg/main/http.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public static Boolean downloadPiped(String urlString, String username, String pa
}

public static Boolean downloadPipedStream(String urlString, String username, String password, Boolean cookies,
jobData job) throws IOException, InterruptedException, Exception {
jobData job, String offset) throws IOException, InterruptedException, Exception {

BufferedInputStream in;
CloseableHttpResponse response;
Expand All @@ -292,6 +292,9 @@ public static Boolean downloadPipedStream(String urlString, String username, Str
CloseableHttpClient httpclient = createInsecureHttpClient(url.getHost(), url.getPort(), username, password);

final HttpGet httpget = new HttpGet(urlString);
if (offset != null) {
httpget.setHeader("Range", "bytes=" + offset + "-");
}

response = httpclient.execute(httpget);

Expand Down
2 changes: 1 addition & 1 deletion src/com/tivo/kmttg/task/tdownload_decrypt.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public Thread1(String urlString) {
}
public void run() {
try {
success = http.downloadPipedStream(urlString, "tivo", config.MAK, true, job);
success = http.downloadPipedStream(urlString, "tivo", config.MAK, true, job, job.offset);
thread_running = false;
} catch (Exception e) {
log.error("tdownload_decrypt"); log.error(Arrays.toString(e.getStackTrace()));
Expand Down

0 comments on commit 041b177

Please sign in to comment.