|
|
@ -776,14 +776,15 @@ public class QBittorrentAdapter implements IDaemonAdapter { |
|
|
|
return (long) number; |
|
|
|
return (long) number; |
|
|
|
} |
|
|
|
} |
|
|
|
// Returns size in B-based long
|
|
|
|
// Returns size in B-based long
|
|
|
|
if (parts[1].equals("TiB")) { |
|
|
|
switch (parts[1]) { |
|
|
|
return (long) (number * 1024L * 1024L * 1024L * 1024L); |
|
|
|
case "TiB": |
|
|
|
} else if (parts[1].equals("GiB")) { |
|
|
|
return (long) (number * 1024L * 1024L * 1024L * 1024L); |
|
|
|
return (long) (number * 1024L * 1024L * 1024L); |
|
|
|
case "GiB": |
|
|
|
} else if (parts[1].equals("MiB")) { |
|
|
|
return (long) (number * 1024L * 1024L * 1024L); |
|
|
|
return (long) (number * 1024L * 1024L); |
|
|
|
case "MiB": |
|
|
|
} else if (parts[1].equals("KiB")) { |
|
|
|
return (long) (number * 1024L * 1024L); |
|
|
|
return (long) (number * 1024L); |
|
|
|
case "KiB": |
|
|
|
|
|
|
|
return (long) (number * 1024L); |
|
|
|
} |
|
|
|
} |
|
|
|
return (long) number; |
|
|
|
return (long) number; |
|
|
|
} |
|
|
|
} |
|
|
@ -811,12 +812,13 @@ public class QBittorrentAdapter implements IDaemonAdapter { |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
// Returns size in B-based int
|
|
|
|
// Returns size in B-based int
|
|
|
|
if (parts[1].equals("GiB/s")) { |
|
|
|
switch (parts[1]) { |
|
|
|
return (int) (number * 1024 * 1024 * 1024); |
|
|
|
case "GiB/s": |
|
|
|
} else if (parts[1].equals("MiB/s")) { |
|
|
|
return (int) (number * 1024 * 1024 * 1024); |
|
|
|
return (int) (number * 1024 * 1024); |
|
|
|
case "MiB/s": |
|
|
|
} else if (parts[1].equals("KiB/s")) { |
|
|
|
return (int) (number * 1024 * 1024); |
|
|
|
return (int) (number * 1024); |
|
|
|
case "KiB/s": |
|
|
|
|
|
|
|
return (int) (number * 1024); |
|
|
|
} |
|
|
|
} |
|
|
|
return (int) (Double.parseDouble(normalizeNumber(parts[0]))); |
|
|
|
return (int) (Double.parseDouble(normalizeNumber(parts[0]))); |
|
|
|
} |
|
|
|
} |
|
|
@ -833,28 +835,30 @@ public class QBittorrentAdapter implements IDaemonAdapter { |
|
|
|
|
|
|
|
|
|
|
|
private TorrentStatus parseStatus(String state) { |
|
|
|
private TorrentStatus parseStatus(String state) { |
|
|
|
// Status is given as a descriptive string
|
|
|
|
// Status is given as a descriptive string
|
|
|
|
if (state.equals("error")) { |
|
|
|
switch (state) { |
|
|
|
return TorrentStatus.Error; |
|
|
|
case "error": |
|
|
|
} else if (state.equals("downloading") || state.equals("metaDL")) { |
|
|
|
return TorrentStatus.Error; |
|
|
|
return TorrentStatus.Downloading; |
|
|
|
case "downloading": |
|
|
|
} else if (state.equals("uploading")) { |
|
|
|
case "metaDL": |
|
|
|
return TorrentStatus.Seeding; |
|
|
|
return TorrentStatus.Downloading; |
|
|
|
} else if (state.equals("pausedDL")) { |
|
|
|
case "uploading": |
|
|
|
return TorrentStatus.Paused; |
|
|
|
return TorrentStatus.Seeding; |
|
|
|
} else if (state.equals("pausedUP")) { |
|
|
|
case "pausedDL": |
|
|
|
return TorrentStatus.Paused; |
|
|
|
return TorrentStatus.Paused; |
|
|
|
} else if (state.equals("stalledUP")) { |
|
|
|
case "pausedUP": |
|
|
|
return TorrentStatus.Seeding; |
|
|
|
return TorrentStatus.Paused; |
|
|
|
} else if (state.equals("stalledDL")) { |
|
|
|
case "stalledUP": |
|
|
|
return TorrentStatus.Downloading; |
|
|
|
return TorrentStatus.Seeding; |
|
|
|
} else if (state.equals("checkingUP")) { |
|
|
|
case "stalledDL": |
|
|
|
return TorrentStatus.Checking; |
|
|
|
return TorrentStatus.Downloading; |
|
|
|
} else if (state.equals("checkingDL")) { |
|
|
|
case "checkingUP": |
|
|
|
return TorrentStatus.Checking; |
|
|
|
return TorrentStatus.Checking; |
|
|
|
} else if (state.equals("queuedDL")) { |
|
|
|
case "checkingDL": |
|
|
|
return TorrentStatus.Queued; |
|
|
|
return TorrentStatus.Checking; |
|
|
|
} else if (state.equals("queuedUP")) { |
|
|
|
case "queuedDL": |
|
|
|
return TorrentStatus.Queued; |
|
|
|
return TorrentStatus.Queued; |
|
|
|
|
|
|
|
case "queuedUP": |
|
|
|
|
|
|
|
return TorrentStatus.Queued; |
|
|
|
} |
|
|
|
} |
|
|
|
return TorrentStatus.Unknown; |
|
|
|
return TorrentStatus.Unknown; |
|
|
|
} |
|
|
|
} |
|
|
|