@ -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;
@ -243,7 +245,7 @@ public class QBittorrentAdapter implements IDaemonAdapter {
@@ -243,7 +245,7 @@ public class QBittorrentAdapter implements IDaemonAdapter {
@ -444,6 +446,20 @@ public class QBittorrentAdapter implements IDaemonAdapter {
@@ -444,6 +446,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{
@ -451,7 +467,7 @@ public class QBittorrentAdapter implements IDaemonAdapter {
@@ -451,7 +467,7 @@ public class QBittorrentAdapter implements IDaemonAdapter {