Jump to content

RSS Filter Flags and Adding Filters via the Web API


jmf00

Recommended Posts

I recently began using the uTorrent Server for Linux and the Web API to manage my torrents and RSS Filters. Prior to using the API, I used a Windows box and the Windows gui interface.

When I read the list of rssfilters from the ?list=1 command, all the filters I made with with the Windows interface have a FLAGS value of 1. Any new filters or modified filters using the Web API have a FLAGS value of 9 and don't really seem to work. All the other fields in these new/modified rssfilters seem legit. My guess is that I am sending a bad value somewhere in my ?action=filter-update command.

I cannot find the FLAGS definition in the uTorrent Server documentation. Does anyone know what they are? Alternatively, does any one know what I am doing wrong?

As an example, lets say I wanted to add a filter with the following parameters:

Name: myNewFilter

Filter: *myNewFilter*

Not Filter:

Directory: ./

Quality: 1

Smart Episode Filter: enabled

Feeds: -1 (all)

I send the following URL:

http://127.0.0.1:8080/gui/?action=filter-update&filter-id=-1&name=myNewFilter
&save-in=./&filter=*myNewFilter*&not-filter=&quality=1&smart-ep-filter=1&feed-id=-1

This results in the addition of the following entry in the ?list=1 command output:

[20,9,"myNewFilter","*myNewFilter*","","./",-1,1,"",0,0,0,0,"",false,false]]

*note that I have token authentication turned off at the moment.

Link to comment
Share on other sites

lol all of that bitching you saw must've been from me :P

@jmf00: I'm implementing RSS in WebUI right now so that hopefully fewer users have to deal with the monstrosity that is WebUI+RSS. Let me warn you that this API is quite frustrating to deal with, weak documentation being among the list of complaints I've had with it in my endeavors thus far. That said, these are the RSS constants I currently keep for use with WebUI:

var CONST = {

...

//----------------------------------------
// RSS FEED CONSTANTS
//----------------------------------------

, "RSSFEED_ID": 0
, "RSSFEED_ENABLED": 1
, "RSSFEED_USE_FEED_TITLE": 2
, "RSSFEED_USER_SELECTED": 3
, "RSSFEED_PROGRAMMED": 4
, "RSSFEED_DOWNLOAD_STATE": 5
, "RSSFEED_URL": 6
, "RSSFEED_NEXT_UPDATE": 7
, "RSSFEED_ITEMS": 8

//----------------------------------------
// RSS ITEM CONSTANTS
//----------------------------------------

, "RSSITEM_NAME": 0
, "RSSITEM_NAME_FULL": 1
, "RSSITEM_URL": 2
, "RSSITEM_QUALITY": 3
, "RSSITEM_CODEC": 4
, "RSSITEM_TIMESTAMP": 5
, "RSSITEM_SEASON": 6
, "RSSITEM_EPISODE": 7
, "RSSITEM_EPISODE_TO": 8
, "RSSITEM_FEED_ID": 9
, "RSSITEM_REPACK": 10
, "RSSITEM_IN_HISTORY": 11

//----------------------------------------
// RSS ITEM QUALITY CONSTANTS
//----------------------------------------

, "RSSITEMQUALITY_ALL": -1
, "RSSITEMQUALITY_NONE": 0
, "RSSITEMQUALITY_HDTV": 1
, "RSSITEMQUALITY_TVRIP": 2
, "RSSITEMQUALITY_DVDRIP": 4
, "RSSITEMQUALITY_SVCD": 8
, "RSSITEMQUALITY_DSRIP": 16
, "RSSITEMQUALITY_DVBRIP": 32
, "RSSITEMQUALITY_PDTV": 64
, "RSSITEMQUALITY_HRHDTV": 128
, "RSSITEMQUALITY_HRPDTV": 256
, "RSSITEMQUALITY_DVDR": 512
, "RSSITEMQUALITY_DVDSCR": 1024
, "RSSITEMQUALITY_720P": 2048
, "RSSITEMQUALITY_1080I": 4096
, "RSSITEMQUALITY_1080P": 8192
, "RSSITEMQUALITY_WEBRIP": 16384
, "RSSITEMQUALITY_SATRIP": 32768

//----------------------------------------
// RSS FILTER CONSTANTS
//----------------------------------------

, "RSSFILTER_ID": 0
, "RSSFILTER_FLAGS": 1
, "RSSFILTER_NAME": 2
, "RSSFILTER_FILTER": 3
, "RSSFILTER_NOT_FILTER": 4
, "RSSFILTER_DIRECTORY": 5
, "RSSFILTER_FEED": 6
, "RSSFILTER_QUALITY": 7
, "RSSFILTER_LABEL": 8
, "RSSFILTER_POSTPONE_MODE": 9
, "RSSFILTER_LAST_MATCH": 10
, "RSSFILTER_SMART_EP_FILTER": 11
, "RSSFILTER_REPACK_EP_FILTER": 12
, "RSSFILTER_EPISODE_FILTER_STR": 13
, "RSSFILTER_EPISODE_FILTER": 14
, "RSSFILTER_RESOLVING_CANDIDATE": 15

//----------------------------------------
// RSS FILTER FLAG CONSTANTS
//----------------------------------------

, "RSSFILTERFLAG_ENABLE": 1
, "RSSFILTERFLAG_ORIG_NAME": 2
, "RSSFILTERFLAG_HIGH_PRIORITY": 4
, "RSSFILTERFLAG_SMART_EP_FILTER": 8
, "RSSFILTERFLAG_ADD_STOPPED": 16

...

};

The RSS filters' FLAGS field is a bitwise combination of the filter flag constants. As far as I can tell, RSSFILTERFLAG_ENABLE can't currently be changed through the WebUI API itself.

Let me leave you with a note on a horrendous problem I've discovered with /gui/?action=filter-update, and which is probably what's causing you grief right now:

[21:33:00] <&Ultima> lol wow. remember I was telling you about that bitfield thing and how you have to unpack when you send the results back to the backend?

[21:33:08] <&Ultima> apparently you can't send a single value back

[21:33:23] <&Ultima> you have to send all values back, otherwise uT assumes all the other values were 0

[21:34:02] <&Ultima> leaves me wondering why bother forcing the values to be unpacked to begin with

[21:37:33] <&Ultima> a single FLAGS bitfield (which currently uses 5 of the bits) is sent to webui, and when performing filter-update, you have to send back "/gui/?action=filter-update&filter-id=...&origname=...&smart-ep-filter=...&add-stopped=...&prio=..." if, say, you just wanted to update prio

[21:38:47] <&Ultima> Firon: ^ that's retarded. get someone to freaking apply bitwise operators correctly on individual values

[21:44:12] <&Ultima> I really hope at least some of this is getting noted down lol. I know for a fact that I'm overreacting here to a lot of the shit I've run into because I'm so frustrated, but some of this is truly braindead.

[21:45:46] <&Ultima> I've lost track of everything that's been wrong with rss+webui already

[21:51:09] <&Ultima> "apply bitwise operators correctly" would mean to perform bitwise operators for bits that *are* sent with the GET parameters. those that aren't should indicate that you leave the respective bit alone. if the sent bit *is* enabled, perform |, otherwise &~

Anywho, I've been meaning to update the API thread, but am holding off until the API deficiencies are fixed (AKA the API stabilizes).

Link to comment
Share on other sites

I figured out my problem. I thought my old filters had the smart-ep-filter enabled, but they didn't. Once I disabled this on the new filter I was trying to add, everything appears to be working fine.

On a side note, I did not need to add all the settings into my filter-update command. I had most of them already, but I didn't included things like origname, label, prio, postpone-mode, and so on. I guess you only need to include things that are deviations from the default value. A good rule of thumb might be to include all the fields in your command URL when adding or updating rss filters.

Link to comment
Share on other sites

I guess you only need to include things that are deviations from the default value.

Indeed. Still, that shouldn't ever be the case -- otherwise, they should stop designating these parameters as "optional", and performing /gui/?action=filter-update&filter-id=1&name=HELLO should (by the same logic) blank everything else out.

If they really don't want them to be set independently of one another, then they shouldn't even accept these flags separately and should just accept a single flag parameter instead. That would at least remove the confusion and make the API slightly less insane (and more symmetrical -- they currently send a single flag that we have to unpack ourselves anyway when they send the RSS filters).

Current value -- not default value -- should be the value used unless otherwise specified. And of course, if it's a new filter, current value is default value anyway.

Link to comment
Share on other sites

  • 3 months later...

The RSS filters' FLAGS field is a bitwise combination of the filter flag constants. As far as I can tell, RSSFILTERFLAG_ENABLE can't currently be changed through the WebUI API itself.

Sorry to dig up an old post but has the above changed at all? I really want to enable or disable my RSS Filters, in a UI I'm building, I guess you can delete the filter but thats no fun, you'd have to recreate it to use it again later.

Thanks for any info.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...