|
|
@ -776,13 +776,14 @@ 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]) { |
|
|
|
|
|
|
|
case "TiB": |
|
|
|
return (long) (number * 1024L * 1024L * 1024L * 1024L); |
|
|
|
return (long) (number * 1024L * 1024L * 1024L * 1024L); |
|
|
|
} else if (parts[1].equals("GiB")) { |
|
|
|
case "GiB": |
|
|
|
return (long) (number * 1024L * 1024L * 1024L); |
|
|
|
return (long) (number * 1024L * 1024L * 1024L); |
|
|
|
} else if (parts[1].equals("MiB")) { |
|
|
|
case "MiB": |
|
|
|
return (long) (number * 1024L * 1024L); |
|
|
|
return (long) (number * 1024L * 1024L); |
|
|
|
} else if (parts[1].equals("KiB")) { |
|
|
|
case "KiB": |
|
|
|
return (long) (number * 1024L); |
|
|
|
return (long) (number * 1024L); |
|
|
|
} |
|
|
|
} |
|
|
|
return (long) number; |
|
|
|
return (long) number; |
|
|
@ -811,11 +812,12 @@ 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]) { |
|
|
|
|
|
|
|
case "GiB/s": |
|
|
|
return (int) (number * 1024 * 1024 * 1024); |
|
|
|
return (int) (number * 1024 * 1024 * 1024); |
|
|
|
} else if (parts[1].equals("MiB/s")) { |
|
|
|
case "MiB/s": |
|
|
|
return (int) (number * 1024 * 1024); |
|
|
|
return (int) (number * 1024 * 1024); |
|
|
|
} else if (parts[1].equals("KiB/s")) { |
|
|
|
case "KiB/s": |
|
|
|
return (int) (number * 1024); |
|
|
|
return (int) (number * 1024); |
|
|
|
} |
|
|
|
} |
|
|
|
return (int) (Double.parseDouble(normalizeNumber(parts[0]))); |
|
|
|
return (int) (Double.parseDouble(normalizeNumber(parts[0]))); |
|
|
@ -833,27 +835,29 @@ 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) { |
|
|
|
|
|
|
|
case "error": |
|
|
|
return TorrentStatus.Error; |
|
|
|
return TorrentStatus.Error; |
|
|
|
} else if (state.equals("downloading") || state.equals("metaDL")) { |
|
|
|
case "downloading": |
|
|
|
|
|
|
|
case "metaDL": |
|
|
|
return TorrentStatus.Downloading; |
|
|
|
return TorrentStatus.Downloading; |
|
|
|
} else if (state.equals("uploading")) { |
|
|
|
case "uploading": |
|
|
|
return TorrentStatus.Seeding; |
|
|
|
return TorrentStatus.Seeding; |
|
|
|
} else if (state.equals("pausedDL")) { |
|
|
|
case "pausedDL": |
|
|
|
return TorrentStatus.Paused; |
|
|
|
return TorrentStatus.Paused; |
|
|
|
} else if (state.equals("pausedUP")) { |
|
|
|
case "pausedUP": |
|
|
|
return TorrentStatus.Paused; |
|
|
|
return TorrentStatus.Paused; |
|
|
|
} else if (state.equals("stalledUP")) { |
|
|
|
case "stalledUP": |
|
|
|
return TorrentStatus.Seeding; |
|
|
|
return TorrentStatus.Seeding; |
|
|
|
} else if (state.equals("stalledDL")) { |
|
|
|
case "stalledDL": |
|
|
|
return TorrentStatus.Downloading; |
|
|
|
return TorrentStatus.Downloading; |
|
|
|
} else if (state.equals("checkingUP")) { |
|
|
|
case "checkingUP": |
|
|
|
return TorrentStatus.Checking; |
|
|
|
return TorrentStatus.Checking; |
|
|
|
} else if (state.equals("checkingDL")) { |
|
|
|
case "checkingDL": |
|
|
|
return TorrentStatus.Checking; |
|
|
|
return TorrentStatus.Checking; |
|
|
|
} else if (state.equals("queuedDL")) { |
|
|
|
case "queuedDL": |
|
|
|
return TorrentStatus.Queued; |
|
|
|
return TorrentStatus.Queued; |
|
|
|
} else if (state.equals("queuedUP")) { |
|
|
|
case "queuedUP": |
|
|
|
return TorrentStatus.Queued; |
|
|
|
return TorrentStatus.Queued; |
|
|
|
} |
|
|
|
} |
|
|
|
return TorrentStatus.Unknown; |
|
|
|
return TorrentStatus.Unknown; |
|
|
|