@ -69,6 +69,12 @@ public final class Label implements Parcelable, Comparable<Label> {
@@ -69,6 +69,12 @@ public final class Label implements Parcelable, Comparable<Label> {
@ -94,6 +94,8 @@ public class QBittorrentAdapter implements IDaemonAdapter {
@@ -94,6 +94,8 @@ public class QBittorrentAdapter implements IDaemonAdapter {
privateintqbLowPriority=1;
privateintqbNormalPriority=2;
privateintqbHighPriority=7;
// a cache of all labels on the server
privateList<Label>labelList;
publicQBittorrentAdapter(DaemonSettingssettings){
this.settings=settings;
@ -245,7 +247,7 @@ public class QBittorrentAdapter implements IDaemonAdapter {
@@ -245,7 +247,7 @@ public class QBittorrentAdapter implements IDaemonAdapter {
@ -446,6 +448,20 @@ public class QBittorrentAdapter implements IDaemonAdapter {
@@ -446,6 +448,20 @@ public class QBittorrentAdapter implements IDaemonAdapter {
caseSetLabel:
SetLabelTasklabelTask=(SetLabelTask)task;
StringnewLabel=labelTask.getNewLabel();
if(version>=30200){
if(!labelList.contains(newLabel(newLabel,0))){
// create new label on server side
if(version>=40100){
path="/api/v2/torrents/createCategory";
}else{
path="/command/addCategory";
}
makeRequest(log,path,
newBasicNameValuePair("category",newLabel));
}
}
if(version>=40100){
path="/api/v2/torrents/setCategory";
}else{
@ -453,7 +469,7 @@ public class QBittorrentAdapter implements IDaemonAdapter {
@@ -453,7 +469,7 @@ public class QBittorrentAdapter implements IDaemonAdapter {