• 1
  • 146
  • 147
  • 148(current)
  • 149
  • 150
  • 226
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC
I get:
Code:
"error": {
        "code": -32602,
        "data": {
            "method": "VideoLibrary.GetTVShows",
            "stack": {
                "message": "Received value does not match any of the union type definitions",
                "name": "filter",
                "type": null
            }
        },
        "message": "Invalid params."
    },
Image
AWXi - Ajax web interface. Wiki
Reply
Wow that was one ugly bug (or rather bad logic in my brain). Thanks for finding and reporting this before the functionality was merged. Should be fixed now (and rebased onto latest master) in my branch and therefore in the PR.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
I can't fault you for any bad logic mistakes. I can't even think of a viable way to implement the filter Smile
Image
AWXi - Ajax web interface. Wiki
Reply
Just wondering if you will provide direct links like Input.Home to Videos, Movies, TV Shows, Music, Weather, Pictures and Programs.

Would come in quite handy when jumping from one medium to another.
Reply
Okay, I don't get an error any more with this filter but I also get zero results. I've gone over it quite a few times in my head and I think it's right.
Code:
{ "filter": {
    "and":
        [
            { "or":
                [
                    { "and":
                        [
                            {"field": "title", "operator": "startswith", "value": "v"},
                            {"field": "title", "operator": "endswith", "value": "d"}
                        ]
                    }
                ]
            },
            {"field": "genre", "operator": "is", "value": "drama"},
            {"field": "genre", "operator": "is", "value": "comedy"}
        ]
    }
}
What I believe I am asking for is:
Title starts with "v" and ends with "d"
or
Genre is "drama" or "comedy"

I'm targeting tv show called "Vexed" with "drama" and "comedy" as genres.

You may tell me to "go away" and it may be it was the only way to do it within the JSON schema but couldn't the logic operators go between? I'm thinking more maths like (not that I'm great at that either). This may not work either logically but something like:
Code:
{ "filter": { [ {"field": "title", "operator": "startswith": "v"}, "and": {"field": "title", "operator": "endswith": "d"} ] "or": [ {"field": "genre", "operator": "is", "value": "drama"}, "or": {"field": "genre", "operator": "is", "value": "comedy"} ] }

I believe that is the same as the example above. I realise it's quite the PITA already and may not even be possible but I think it's easier to read and easier to generate.

I'll go hide now Smile
Image
AWXi - Ajax web interface. Wiki
Reply
(2012-08-26, 16:46)Mizaki Wrote:
Code:
{ "filter": {
    "and":
        [
            { "or":
                [
                    { "and":
                        [
                            {"field": "title", "operator": "startswith", "value": "v"},
                            {"field": "title", "operator": "endswith", "value": "d"}
                        ]
                    }
                ]
            },
            {"field": "genre", "operator": "is", "value": "drama"},
            {"field": "genre", "operator": "is", "value": "comedy"}
        ]
    }
}

From a logical point of view this means :

I want :
- Genre is drama
And
- Genre is comedy
And
(Here you put an or with only one choice so is an and)
And
- Title start with v
And
- Title end with d

This :
Quote:Title starts with "v" and ends with "d"
or
Genre is "drama" or "comedy"

Should be written
Code:
{ "filter": {
    "or":
        [
            { "and":
                [
                    {"field": "title", "operator": "startswith", "value": "v"},
                    {"field": "title", "operator": "endswith", "value": "d"}
                ]
            },
            { "or":
                [
                    {"field": "genre", "operator": "is", "value": "drama"},
                    {"field": "genre", "operator": "is", "value": "comedy"}
                ]
            },
        ]
    }
}
Reply
Thanks for that. I think I was concentrating on the PR example and tying myself up. Now I just need to figure a way out to present and build Undecided
Image
AWXi - Ajax web interface. Wiki
Reply
It would be awsome if File.GetDirectory could return the watched status for video entries. Is this something that will be added?
Image

Please add to my reputation if you find my posts usefull (+/- button below posts)
Ubuntu 12.10 minimal XBMC auto-install script :: XBMControl :: Xbmc XBOX Skins :: XBMControl for Android :: Owner of Sudo Systems
Reply
This is actually already possible. Make sure you set media = video and not media = file

Code:
curl  -H "Content-Type: application/json"  -d "{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"Files.GetDirectory\",\"params\":{\"directory\":\"/media/Media/Movies/2 days in Paris\",\"media\":\"video\",\"properties\":[\"title\",\"thumbnail\", \"playcount\"],\"sort\":{\"method\":\"label\",\"order\":\"ascending\"}}}" http://10.0.0.236:8080/jsonrpc | python -mjson.tool
Reply
Excellent! Thanks!
Image

Please add to my reputation if you find my posts usefull (+/- button below posts)
Ubuntu 12.10 minimal XBMC auto-install script :: XBMControl :: Xbmc XBOX Skins :: XBMControl for Android :: Owner of Sudo Systems
Reply
I'm using the same Files.GetDirectory call for music, video and pictures. I would like to sort on multiple fields. If the 'track' field is available I want to sort on that, if the 'episode' field is available I would like to sort on that and in all other cases I want to sort on 'label'. I tried adding a Array in the sort method ("method":["track", "episode", "label"]). But that's not a valid request. Is there any other way to do this?

I could create specific parameters for each media type. But I can only distinguish between movies and episodes after the call. So I don't see any other solution then to re-sort the result client side after analyzing it, at the moment, which I'd rather not do since that's quite expensive on a phone. Is there a way to do this in the call that I'm not seeing?
Image

Please add to my reputation if you find my posts usefull (+/- button below posts)
Ubuntu 12.10 minimal XBMC auto-install script :: XBMControl :: Xbmc XBOX Skins :: XBMControl for Android :: Owner of Sudo Systems
Reply
(2012-08-27, 20:46)Millencolin007 Wrote: This is actually already possible. Make sure you set media = video and not media = file

Code:
curl  -H "Content-Type: application/json"  -d "{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"Files.GetDirectory\",\"params\":{\"directory\":\"/media/Media/Movies/2 days in Paris\",\"media\":\"video\",\"properties\":[\"title\",\"thumbnail\", \"playcount\"],\"sort\":{\"method\":\"label\",\"order\":\"ascending\"}}}" http://10.0.0.236:8080/jsonrpc | python -mjson.tool

Is it possible to do the same on directory level (with Files.GetDirectory)?
Image

Please add to my reputation if you find my posts usefull (+/- button below posts)
Ubuntu 12.10 minimal XBMC auto-install script :: XBMControl :: Xbmc XBOX Skins :: XBMControl for Android :: Owner of Sudo Systems
Reply
(2012-08-28, 01:16)Bram77 Wrote: I'm using the same Files.GetDirectory call for music, video and pictures. I would like to sort on multiple fields. If the 'track' field is available I want to sort on that, if the 'episode' field is available I would like to sort on that and in all other cases I want to sort on 'label'. I tried adding a Array in the sort method ("method":["track", "episode", "label"]). But that's not a valid request. Is there any other way to do this?

I could create specific parameters for each media type. But I can only distinguish between movies and episodes after the call. So I don't see any other solution then to re-sort the result client side after analyzing it, at the moment, which I'd rather not do since that's quite expensive on a phone. Is there a way to do this in the call that I'm not seeing?

Looking at the json schema I think only one sort method is allowed. And sorting on client side is probably faster than fetching the directory a second time with the proper sort order

Code:
"List.Sort" : {
        "id" : "List.Sort",
        "properties" : {
          "ignorearticle" : {
            "default" : false,
            "type" : "boolean"
          },
          "method" : {
            "default" : "none",
            "enums" : [ "none", "label", "date", "size", "file", "drivetype", "track", "duration", "title", "artist", "album", "genre", "year", "videorating", "programcount", "playlist", "episode", "videotitle", "sorttitle", "productioncode", "songrating", "mpaarating", "videoruntime", "studio", "fullpath", "lastplayed", "unsorted" ],
            "type" : "string"
          },
          "order" : {
            "default" : "ascending",
            "enums" : [ "ascending", "descending" ],
            "type" : "string"
          }
        },
        "type" : "object"
      },


(2012-08-28, 01:52)Bram77 Wrote:
(2012-08-27, 20:46)Millencolin007 Wrote: This is actually already possible. Make sure you set media = video and not media = file

Code:
curl  -H "Content-Type: application/json"  -d "{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"Files.GetDirectory\",\"params\":{\"directory\":\"/media/Media/Movies/2 days in Paris\",\"media\":\"video\",\"properties\":[\"title\",\"thumbnail\", \"playcount\"],\"sort\":{\"method\":\"label\",\"order\":\"ascending\"}}}" http://10.0.0.236:8080/jsonrpc | python -mjson.tool

Is it possible to do the same on directory level (with Files.GetDirectory)?

"/media/Media/Movies/2 days in Paris" is a directory, therefore it works on directory level
Reply
(2012-08-26, 07:48)Jasp Wrote: Just wondering if you will provide direct links like Input.Home to Videos, Movies, TV Shows, Music, Weather, Pictures and Programs.

Would come in quite handy when jumping from one medium to another.

I think this got lost in the large posts regarding filtering and sorting....

I'm hoping.... (with fingers crossed) that something similar to the current ActivateWindow() could be implemented.

Perhaps an Input.Movies.Titles - Input.Movies.Genres - Input.Music.Songs - Input.Music.Artists - Input.Music.Albums - Input.Weather etc
Reply
@Millencolin007 Thanks again Smile. Of course I'd already looked at the official documentation. I thought that maybe there was a workaround that doesn't show in the docs. I guess I'll have to get creative to distinguish between movies and tv shows.

Quote:"/media/Media/Movies/2 days in Paris" is a directory, therefore it works on directory level

This does work for movies, but TV show root and season directories don't have a playcount param. So to determine if a show has no unwatched episodes I'd have to do at least two more request.
Let's say the TVshow root is "Dexter". To figure out if "Dexter" has unwatched episode I'd have to request it's directory content which would result in "Season 1, Season 2, etc.". Every seasons directory content would have to be fetched and analysed too, to conclude if the "Dexter" directory contains unwatched items.
I realize now that I haven't checked if the "Dexter" directory also contains a tvshow ID which I could use to request all TV show data including the number of unwachted episodes. I'm going to check that first Smile.

To clarify... I'm developing a new Android remote. I don't want to implement library mode, relying on Files.GetDirectory only) because I think it's to confusing for a lot of users to have both file and library mode. Files.GetDirectory offers a very nice middle ground by returning library data where available and file/directory data if an item has not been imported to the database. Unfortunately not all data I need is available (yet :-)). I will use the library options to fetch media meta-data (on request).
Image

Please add to my reputation if you find my posts usefull (+/- button below posts)
Ubuntu 12.10 minimal XBMC auto-install script :: XBMControl :: Xbmc XBOX Skins :: XBMControl for Android :: Owner of Sudo Systems
Reply
  • 1
  • 146
  • 147
  • 148(current)
  • 149
  • 150
  • 226

Logout Mark Read Team Forum Stats Members Help
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC8