SmartPlaylist Question: Is it possible to first order by lastPlayed and then random?
#1
Hi there, i tried using google, but is there a possibilty to "select items from a smartplaylist of a smartplaylist"? i want to do the following: select 100 tv shows, order them by lastPlayed (desc, longest not watched) - from these 100 tv shows i want to select the first 50 and randomize them, is that possible?

So basicially, what i want to do is: select the 50 tv shows that i did not watch in a while and randomize them Tongue

What i got so far is this, it at least will filter out shows played in the last 7 days:

https://paste.kodi.tv/uyefosukic
Reply
#2
Currently not possible
Reply
#3
(2020-07-23, 05:26)DaVu Wrote: Currently not possible

Thanks for your reply! I guessed so, what i plan is to do a simple python script. You may can hint me to a good tutorial that introduces a simple script/plugin writing to Kodi?
Maybe even an existing script/plugin that accesses the Video.db that i just could adjust an copy/paste Tongue
Reply
#4
I have a music playlist that does something similar.  I have a playlist called Mainstream, and then another called Mainstream - Curated.  The second playlist has the rules PLAYLIST IS MAINSTREAM plus a second rule based on some other metadata.  I think you might get close to what you want by creating a playlist with the 100 TV shows and then a second one that has a rule of PLAYLIST IS LAST100 (or whatever you name it) and then set the second playlist to random order and limited to 50 items.
Reply
#5
(2020-07-23, 18:45)pkscout Wrote: I have a music playlist that does something similar.  I have a playlist called Mainstream, and then another called Mainstream - Curated.  The second playlist has the rules PLAYLIST IS MAINSTREAM plus a second rule based on some other metadata.  I think you might get close to what you want by creating a playlist with the 100 TV shows and then a second one that has a rule of PLAYLIST IS LAST100 (or whatever you name it) and then set the second playlist to random order and limited to 50 items.
Sorry, i dont really understand how you've done it. Can you maybe post your Playlist on https://paste.kodi.tv/ please?
The problem is that what i need is some sort of "nested select" statement. Like "select top 50 from (select * from tv_shows order by lastplayed limit 100)" and a selection of a playlist is currently not possible as far as i understood.
Reply
#6
(2020-07-23, 18:45)pkscout Wrote: I have a music playlist that does something similar.  I have a playlist called Mainstream, and then another called Mainstream - Curated.  The second playlist has the rules PLAYLIST IS MAINSTREAM plus a second rule based on some other metadata.  I think you might get close to what you want by creating a playlist with the 100 TV shows and then a second one that has a rule of PLAYLIST IS LAST100 (or whatever you name it) and then set the second playlist to random order and limited to 50 items.

I'm thinking the problem is getting a tvshow playlist and then getting random episodes from several tv shows, or maybe the first unwatched from random tvshow. 

scott s.
.
maintainer of skin  Aeon MQ5 mods for post-Gotham Kodi releases:
Matrix
Leia see: 304472
Reply
#7
(2020-07-23, 23:05)scott967 Wrote:
(2020-07-23, 18:45)pkscout Wrote: I have a music playlist that does something similar.  I have a playlist called Mainstream, and then another called Mainstream - Curated.  The second playlist has the rules PLAYLIST IS MAINSTREAM plus a second rule based on some other metadata.  I think you might get close to what you want by creating a playlist with the 100 TV shows and then a second one that has a rule of PLAYLIST IS LAST100 (or whatever you name it) and then set the second playlist to random order and limited to 50 items.

I'm thinking the problem is getting a tvshow playlist and then getting random episodes from several tv shows, or maybe the first unwatched from random tvshow. 

scott s.
.
Ah yes.  If the OP is trying to get a list of shows and then a random list of episodes from a subset of those shows, then my way definitely won't work.  I read the post to mean long list of TV shows then shorter list of TV shows.
Reply
#8
(2020-07-23, 19:09)iceman20k Wrote:
(2020-07-23, 18:45)pkscout Wrote: I have a music playlist that does something similar.  I have a playlist called Mainstream, and then another called Mainstream - Curated.  The second playlist has the rules PLAYLIST IS MAINSTREAM plus a second rule based on some other metadata.  I think you might get close to what you want by creating a playlist with the 100 TV shows and then a second one that has a rule of PLAYLIST IS LAST100 (or whatever you name it) and then set the second playlist to random order and limited to 50 items.
Sorry, i dont really understand how you've done it. Can you maybe post your Playlist on https://paste.kodi.tv/ please?
The problem is that what i need is some sort of "nested select" statement. Like "select top 50 from (select * from tv_shows order by lastplayed limit 100)" and a selection of a playlist is currently not possible as far as i understood.
Assuming you just want a list of shows (not a list of episodes from a list of shows), here's what I just did on my dev machine.

Playlist 1 (this is a list of the 100 TV shows I've watched most recently, you said in the OP that you had this one figured out already):


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="tvshows">
    <name>100 TV Shows</name>
    <match>all</match>
    <limit>100</limit>
    <order direction="ascending">lastplayed</order>
</smartplaylist>

Playlist 2 (this is 10 random shows from the list of shows generated by playlist 1 - you can obviously do 50 instead):


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="tvshows">
    <name>Random from Top 100</name>
    <match>all</match>
    <rule field="playlist" operator="is">
        <value>100 TV Shows</value>
    </rule>
    <limit>10</limit>
    <order direction="ascending">random</order>
</smartplaylist>

It's worth noting that in my test for some reason the second playlist didn't always generate 10 shows.  I don't know why.  But maybe it'll get you down the right path.
Reply
#9
(2020-07-24, 01:49)pkscout Wrote:
(2020-07-23, 19:09)iceman20k Wrote:
(2020-07-23, 18:45)pkscout Wrote: I have a music playlist that does something similar.  I have a playlist called Mainstream, and then another called Mainstream - Curated.  The second playlist has the rules PLAYLIST IS MAINSTREAM plus a second rule based on some other metadata.  I think you might get close to what you want by creating a playlist with the 100 TV shows and then a second one that has a rule of PLAYLIST IS LAST100 (or whatever you name it) and then set the second playlist to random order and limited to 50 items.
Sorry, i dont really understand how you've done it. Can you maybe post your Playlist on https://paste.kodi.tv/ please?
The problem is that what i need is some sort of "nested select" statement. Like "select top 50 from (select * from tv_shows order by lastplayed limit 100)" and a selection of a playlist is currently not possible as far as i understood.
Assuming you just want a list of shows (not a list of episodes from a list of shows), here's what I just did on my dev machine.

Playlist 1 (this is a list of the 100 TV shows I've watched most recently, you said in the OP that you had this one figured out already):


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="tvshows">
    <name>100 TV Shows</name>
    <match>all</match>
    <limit>100</limit>
    <order direction="ascending">lastplayed</order>
</smartplaylist>

Playlist 2 (this is 10 random shows from the list of shows generated by playlist 1 - you can obviously do 50 instead):


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="tvshows">
    <name>Random from Top 100</name>
    <match>all</match>
    <rule field="playlist" operator="is">
        <value>100 TV Shows</value>
    </rule>
    <limit>10</limit>
    <order direction="ascending">random</order>
</smartplaylist>

It's worth noting that in my test for some reason the second playlist didn't always generate 10 shows.  I don't know why.  But maybe it'll get you down the right path.

Wow, this is exactly what i was looking for! Thanks a lot for your help!
Here is my final solution: https://paste.kodi.tv/wajiwomagu

I kept the 14 days rule since i cant select the first 50 elements (the really longest not played or unplayed ones) like you can with the SQL TOP command - but hey, its really pretty close to what i was looking for a pretty powerful for a frontend Tongue
And in my case (i select "episodes" instead of "tvshows" like in your example) i always get my 50 final results - and the "helper" list also always gets 100 shows ordered by lastplayed, just like you would expect.
Reply
#10
Uhw, just read in the Kodi Wiki:
Quote:The playlist field can be used to combine several playlists together. When playlists are combined, the <limit> and <order> tags of the included playlists are ignored; only the <order> and <limit> of the final playlist are used.
Limit and Order of Playlist1 are ignored, what makes the solution not work. Still a lot thx for your help. I think i have to write a simple Python Script with an SQL Statement to achieve it.
Anyone has a simple introduction/tutorial to wiriting Kodi Plugins handy?
Reply
#11
Dunno why Limit and Order in included playlists are ignored though. But i guess it has some techincal reason to not get into a recusrion or something...
Reply
#12
Thanks for all your help, i found a simple solution:

I create a playlist with my Tv Shows, let them order by "lastplayed" (Playlist 1). But the second part, the randomizing, is not done by a playlist, but instead by this plugin: https://kodi.wiki/view/Add-on:Random_Movie

It randomizes the Playlist 1 that only contains episodes not played for a long time Wink I use it in my Favourites like:

<favourite name="Random Series (Longest unwatched)">RunScript(script.playrandomvideos, "special://profile/playlists/video/series_longestnotwatched.xsp")</favourite>

Just in case anyone else is interested in the solution. It truly plays randomly the episodes i did not watch for the longest time.

Again thanks to all!
Reply



Logout Mark Read Team Forum Stats Members Help
SmartPlaylist Question: Is it possible to first order by lastPlayed and then random?0
This forum uses Lukasz Tkacz MyBB addons.