Smart playlist for less-watched TV Show episodes
#1
Question 
I'm attempting to create a smart playlist that will give me some random less-watched Star Trek episode from my collection (or possibly other shows, if grouping by TV show was possible), which not necessarily has to be in episode number.

However, I'm having trouble setting up the playlist... I'm starting to think that it's not possible to do such thing in vanilla Kodi (would it be possible through an add-on? is this a bug to fix?).

This is my xsp file:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Less watched episodes</name>
    <match>all</match>
    <rule field="tvshow" operator="contains">
        <value>Star Trek</value>
    </rule>
    <order direction="ascending">playcount</order>
</smartplaylist>

It doesn't work.. I keep getting the episodes ordered by episode number. And not only that, it will also show all Star Trek TOS first, and only after them will it show Star Trek TNG.. no matter if my playcount for TNG series is higher, it will simply show it all in order of tvshow and then episode.

The only thing that seems to be doing well is the filtering rule, only TV Shows with "Star Trek" in the title are shown.

EDIT: This is the debug log output:

Code:
20:41:04 T:1164   DEBUG: CGUIMediaWindow::GetDirectory (special://profile/playlists/video/Less watched episodes.xsp)
20:41:04 T:1164   DEBUG:   ParentPath = [special://videoplaylists/]
20:41:04 T:1164   DEBUG: CVideoDatabase::RunQuery took 8 ms for 255 items query: select * from episodeview  WHERE ((episodeview.strTitle LIKE '%Star Trek%'))
20:41:04 T:7268  NOTICE: Thread BackgroundLoader start, auto delete: false
20:41:04 T:7268   DEBUG: Thread BackgroundLoader 7268 terminating
20:41:04 T:1164   DEBUG: Keyboard: scancode: 0x38, sym: 0x0134, unicode: 0x0000, modifier: 0x100

Not very helpful, though. The query doesn't contain any "SORT BY" ... but I think it's because kodi does the sorting on its own (I see there's a SortUtils.cpp in the sourcecode).. but right now I'm in no condition to wrap my head around it... maybe tomorrow I will try to have a look at it, if somebody can confirm me this is a bug in Kodi.
Reply
#2
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="tvshows">
    <name>test</name>
    <match>all</match>
    <rule field="title" operator="contains">
        <value>Star Trek</value>
    </rule>
    <rule field="unwatched" operator="lessthan">
        <value>3</value>
    </rule>
    <order direction="descending">random</order>
</smartplaylist>

how does that work? I think that should bring up any epsiodes that have been watched less then 3 times, in random order.
Reply
#3
Oh, thanks! that actually works. Even though it's still not possible to order by playcount nor by lastplayed... but random actually works. And yet the wiki states that playcount and lasplayed should work for episodes too.

Is it a bug then? should I maybe attempt to dig into the code and try to help fixing it?
Reply
#4
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="tvshows">
<name>test</name>
<match>all</match>
<rule field="title" operator="contains">
<value>Star Trek</value>
</rule>
<rule field="unwatched" operator="lessthan">
<value>3</value>
</rule>
<order direction="descending">numwatched</order>
</smartplaylist>

How about that?
Reply
#5
Code:
23:04:38 T:1164   ERROR: XFILE::CDirectory::GetDirectory - Error getting special://profile/playlists/video/test.xsp
23:04:38 T:1164   ERROR: CGUIMediaWindow::GetDirectory(special://profile/playlists/video/test.xsp) failed
23:04:38 T:8016  NOTICE: Thread BackgroundLoader start, auto delete: false

I think "unwatched" is not a field.

I tried removing the rules and doing it more general:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="tvshows">
    <name>testing</name>
    <match>all</match>
    <order direction="descending">numwatched</order>
</smartplaylist>

However, the order of the episodes is quite mixed up.. I'm not sure what is the order exactly, but definitely not playcount, in the first few entries there's a mix of watched and unwatched.

EDIT: Oh.. I see now, the episodes are sorted by alphabetic order. Actually, in the previous smart playlist you gave me (the random one) I just realized that the episodes are also in alphabetic order, not random (what was randomly ordered was the TV Shows, not the episodes within each TV Show).

I think I was right in my first post to use type="episodes", what I want to sort is the episodes within the TV Shows, not the TV Shows.


EDIT2: I don't know what did I do.. but now this works:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Reverse last played</name>
    <match>all</match>
    <rule field="tvshow" operator="contains">
        <value>Star Trek</value>
    </rule>
    <order direction="ascending">lastplayed</order>
</smartplaylist>

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Less played</name>
    <match>all</match>
    <rule field="tvshow" operator="contains">
        <value>Star Trek</value>
    </rule>
    <order direction="descending">playcount</order>
</smartplaylist>

I don't understand why it didn't work before... it's basically the same as my first post :S ...I had to change to "descending" because the high number appeared at the top (start) of the list with direction="ascending" (since the lists are generated from top to bottom I would have expected the reverse).

EDIT3: Ok.... and now the "Less played" stopped working.. as magically as it started. No idea what did I do to break it again, the file is exactly the same... I created a new one through the GUI and it works again.,. both basically the same XML and yet one working the other one not...

This seems like a bug but no idea what to attribute it to. Any suggestions on what to do to determine what the issue could be? Can I help in some way to find out the problem? I'm certain I'm not the only one with the issue because I got the idea from a friend that also couldn't create the smart playlist for this.
Reply

Logout Mark Read Team Forum Stats Members Help
Smart playlist for less-watched TV Show episodes0