Browse Source

Several FTP url-related fixed, notable fiel paths for RTorrent and correct FTP download link generation.

pull/406/head
Eric Kok 7 years ago
parent
commit
9813b96f29
  1. 2
      app/src/main/java/org/transdroid/core/gui/DetailsFragment.java
  2. 2
      app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettings.java
  3. 14
      app/src/main/java/org/transdroid/daemon/Rtorrent/RtorrentAdapter.java

2
app/src/main/java/org/transdroid/core/gui/DetailsFragment.java

@ -588,7 +588,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
} }
// Try using a VIEW intent given an ftp:// scheme URI // Try using a VIEW intent given an ftp:// scheme URI
String url = urlBase + checked.get(0).getFullPath(); String url = urlBase + checked.get(0).getRelativePath();
Intent simpleStart = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Intent simpleStart = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (simpleStart.resolveActivity(getActivity().getPackageManager()) != null) { if (simpleStart.resolveActivity(getActivity().getPackageManager()) != null) {
startActivity(simpleStart); startActivity(simpleStart);

2
app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettings.java

@ -64,7 +64,7 @@ public class XirvikDediSettings extends SeedboxSettingsImpl implements SeedboxSe
type == Daemon.Deluge? "deluge": null, type == Daemon.Deluge? "deluge": null,
OS.Linux, OS.Linux,
type == Daemon.uTorrent? "/downloads": null, type == Daemon.uTorrent? "/downloads": null,
"ftp://" + user + "@" + server + "/downloads", "ftp://" + user + "@" + server + "/",
pass, pass,
6, 6,
prefs.getBoolean("seedbox_xirvikdedi_alarmfinished_" + order, true), prefs.getBoolean("seedbox_xirvikdedi_alarmfinished_" + order, true),

14
app/src/main/java/org/transdroid/daemon/Rtorrent/RtorrentAdapter.java

@ -128,7 +128,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
"d.complete=", "d.complete=",
"d.is_active=", "d.is_active=",
"d.is_hash_checking=", "d.is_hash_checking=",
"d.base_path=", "d.is_multi_file=",
"d.base_filename=", "d.base_filename=",
"d.message=", "d.message=",
"d.custom=addtime", "d.custom=addtime",
@ -443,11 +443,12 @@ public class RtorrentAdapter implements IDaemonAdapter {
// Can't decode label name; ignore it // Can't decode label name; ignore it
} }
String baseFilename = info[17] + "/";
if (info[3] instanceof Long) { if (info[3] instanceof Long) {
// rTorrent uses the i8 dialect which returns 64-bit integers // rTorrent uses the i8 dialect which returns 64-bit integers
long rateDownload = (Long) info[3]; long rateDownload = (Long) info[3];
String basePath = (String) info[16];
// @formatter:off // @formatter:off
torrents.add(new Torrent( torrents.add(new Torrent(
@ -455,7 +456,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
(String)info[0], // hash (String)info[0], // hash
(String)info[1], // name (String)info[1], // name
convertTorrentStatus((Long)info[2], (Long)info[13], (Long)info[14], (Long)info[15]), // status convertTorrentStatus((Long)info[2], (Long)info[13], (Long)info[14], (Long)info[15]), // status
basePath.substring(0, basePath.indexOf((String)info[17])), // locationDir (((Long)info[16]) == 1)? baseFilename: "" , // multi file? base_filename else ""
((Long)info[3]).intValue(), // rateDownload ((Long)info[3]).intValue(), // rateDownload
((Long)info[4]).intValue(), // rateUpload ((Long)info[4]).intValue(), // rateUpload
((Long)info[22]).intValue(), // seedersConnected ((Long)info[22]).intValue(), // seedersConnected
@ -479,7 +480,6 @@ public class RtorrentAdapter implements IDaemonAdapter {
// rTorrent uses the default dialect with 32-bit integers // rTorrent uses the default dialect with 32-bit integers
int rateDownload = (Integer) info[3]; int rateDownload = (Integer) info[3];
String basePath = (String) info[16];
// @formatter:off // @formatter:off
torrents.add(new Torrent( torrents.add(new Torrent(
@ -487,7 +487,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
(String)info[0], // hash (String)info[0], // hash
(String)info[1], // name (String)info[1], // name
convertTorrentStatus(((Integer)info[2]).longValue(), ((Integer)info[13]).longValue(), ((Integer)info[14]).longValue(), ((Integer)info[15]).longValue()), // status convertTorrentStatus(((Integer)info[2]).longValue(), ((Integer)info[13]).longValue(), ((Integer)info[14]).longValue(), ((Integer)info[15]).longValue()), // status
basePath.substring(0, basePath.indexOf((String)info[17])), // locationDir (((Integer)info[16]) == 1)? baseFilename: "" , // multi file? base_filename else ""
rateDownload, // rateDownload rateDownload, // rateDownload
(Integer)info[4], // rateUpload (Integer)info[4], // rateUpload
(Integer)info[22], // seedersConnected (Integer)info[22], // seedersConnected
@ -549,7 +549,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
files.add(new TorrentFile( files.add(new TorrentFile(
"" + i, "" + i,
(String)info[0], // name (String)info[0], // name
((String)info[6]).substring(torrent.getLocationDir().length()), // relativePath (= fullPath - torrent locationDir) torrent.getLocationDir() + info[0], // torrent locationDir + file name
(String)info[6], // fullPath (String)info[6], // fullPath
size, // size size, // size
(long) (size * ((float)chunksDone / (float)chunksTotal)), // done (long) (size * ((float)chunksDone / (float)chunksTotal)), // done
@ -568,7 +568,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
files.add(new TorrentFile( files.add(new TorrentFile(
"" + i, "" + i,
(String)info[0], // name (String)info[0], // name
((String)info[6]).substring(torrent.getLocationDir().length()), // relativePath (= fullPath - torrent locationDir) torrent.getLocationDir() + "/" + info[0], // torrent locationDir + file name
(String)info[0], // fullPath (String)info[0], // fullPath
size, // size size, // size
(int) (size * ((float)chunksDone / (float)chunksTotal)), // done (int) (size * ((float)chunksDone / (float)chunksTotal)), // done

Loading…
Cancel
Save