Kodi Community Forum

Full Version: [RELEASE] Random and last items smartplaylist script for Skins
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
@mike

you have a pm
(2014-03-10, 16:56)mikebzh44 Wrote: [ -> ]
(2014-03-05, 21:49)SpaceMonkey Wrote: [ -> ]It seems %s.Albums and %s.Songs are reversed for "songs" type smart playlists and song count is not correct, is that even possible?

My skin label: $INFO[Window(Home).Property(CustomWidget1Recent.Albums),, $LOCALIZE[132]]$INFO[Window(Home).Property(CustomWidget1Recent.Songs), (, $LOCALIZE[134])]

Expected output (i counted the albums and songs in the playlist): 14 Albums (111 Songs)
Current output: 111 Albums (0 Songs)

Labels seem ok for "albums" type playlists and return correct counts.

I'm don't know if the album count is exposed from songs type playlists, maybe the expected behaviour would be that album count is always empty for them.

Hi.

Could you try this release : https://www.dropbox.com/s/quc7a6gxyt8qqi...-2.2.2.zip

I have fix statistics for Songs, Albums and Artists smart playlists.

Songs and albums playlists return correct counts, but artists does not seem to return anything.

Playlist that i tested with:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="artists">
    <name>Artists</name>
    <match>all</match>
    <rule field="artist" operator="is">
        <value>Immortal</value>
        <value>Impaled Nazarene</value>
        <value>In Flames</value>
        <value>Iron Maiden</value>
    </rule>
</smartplaylist>

Thanks
For me everything is OK :

Playlist :

Image

Image

Widget and stats :

Image
@eisi : Thanks for your 2.1.6 version but I didn't find anything that could explain your issue.

As XBMC is looking for Filme.xsp, can you rename your file from filme.xsp to Filme.xsp and see if it's fix the problem.

Thanks.
@skinners : do you think that a "Recommended" method for TV SHows smart playlists could be usefull ?

I have already made a release (not on GITHUB) for a french user who was running Aeon MQ5 with 2 smart playlists custom menus (TV Shows and Animated TV Shows) and who want to have a widget displaying the first unwatched episode for each TV Shows.

You can try with this python code : https://www.dropbox.com/s/wqw3mlduy64bjk...stitems.py

One difference is skin.widgets recommended properties are filled with "in progress" TV Shows as my properties are filled with the first unwatched episode. So for a fresh new TV shows, you will have S01E01 episode listed.

To call the script, just use recommended=True parameter instead of resume=True or unwatched=True (work only for TV show smart playlists, don't use unwatched and recommended together).
(2014-03-20, 14:44)mikebzh44 Wrote: [ -> ]@skinners : do you think that a "Recommended" method for TV SHows smart playlists could be usefull ?

I have already made a release (not on GITHUB) for a french user who was running Aeon MQ5 with 2 smart playlists custom menus (TV Shows and Animated TV Shows) and who want to have a widget displaying the first unwatched episode for each TV Shows.

You can try with this python code : https://www.dropbox.com/s/wqw3mlduy64bjk...stitems.py

One difference is skin.widgets recommended properties are filled with "in progress" TV Shows as my properties are filled with the first unwatched episode. So for a fresh new TV shows, you will have S01E01 episode listed.

To call the script, just use recommended=True parameter instead of resume=True or unwatched=True (work only for TV show smart playlists, don't use unwatched and recommended together).

Salut Mike,

You make my day Smile
I wait this function from a long time

I hope skinner will adopt it

Question : how S01E01 for fresh TV show are sorted ?
=> 2 new fresh tv-shows : by rate ? added date ?
=> compared to "classic recommended" : at the end of the list ?

Anyway, a big thx for improving user experience
How does the script work for TV Show smart playlists :

- make a JSON query for getting all TV Shows in smart playlist
- for each TV Show, get all episodes
- if recommended parameter = True then look for the first unwatched episode (so S01E01 for TV show with any watched episode) and add it to a result list
- when all the TV shows are scanned, sort the result list by dateadded is method parameter = Last or random
- fill properties for widget
Hi Mike, thanx for all your work mate.

Any chances we could also get:

type=MusicSongs or type=Songs

I want to show a widget with last played songs.

Have a nice weekend Smile
Hi.

I don't understand your need.

Recommended method for TV show smart playlist will list the first unseen episode for each TV show so you can for the main menu and the widget start to play the episode.

Example : I have watched Breaking Bad Season 3 Episode 8 so the widget will display only Breaking Bad S03E09 episode.

But what about MusicSong or Songs ?? You mean Recommended = Last played in this case ?

I think it's already possible by creating a new smartplaylist and sorting it by "Last played".

Or I can add a new sort method "LastPlayed", like "Last" and "Random", to get items from playlist sorted by last played time.

Just make a little test but I have an issue when trying to retrieve lastplayed value from a smart playlist :

http://forum.xbmc.org/showthread.php?tid...pid1661917
@butchabay : No error in JSON query (was my fault) so you can test this code :

https://www.dropbox.com/s/0cxa6aeqt09gah...stitems.py

Just use method=LastPlayed with Movies, MusicVideos, Albums, Songs smart playlists to fill widgets with last played items.

I have test this code with Movies smart playlists, don't have time to do more tests with other smart playlists types so let me know if you get somes issues.
Thanx mike, i'm going to give it a try this evening.
Hi Mike,


Just tested your new version, but still returns empty:

Here my Playlist: As a note: The playlist works when opening from Music>Library>Playlists

PHP Code:
<smartplaylist type="songs">
    <
name>Last Played Songs</name>
    <
match>all</match>
    <
rule field="lastplayed" operator="inthelast">
        <
value>3 weeks</value>
    </
rule>
    <
order direction="ascending">lastplayed</order>
</
smartplaylist


And these 2 lines from the log file:

PHP Code:
Random and Last items scriptLoading PlaylistLastPlayedMusicMenu2 started at 2014-03-25 21:13:43 and take 0.038s 

PHP Code:
DEBUGCApplication::ExecuteXBMCAction Tried translatingbut failed to understand $INFO[Window(Home).Property(PlaylistLastPlayedMusicMenu2.1.Play)] 


Calling Playlist:

PHP Code:
XBMC.RunScript(script.randomandlastitems,type=Music,limit=10,resume=False,method=LastPlayed,playlist=special://skin/playlists/Last Played Songs.xsp,menu=Menu2) 

And to show the widget:

PHP Code:
<icon>$INFO[Window(Home).Property(PlaylistLastPlayedMusicMenu2.1.Art(thumb))]</icon

Hope that helps. Thanx.
But, as your smart playlist already filter latest played songs from 3 weeks, you can use the default script with this smart playlist.

For me, using method=LastPlayed is usefull with a smart playlist with no filters.

For example, having a smart playlist "Rock" and building a widget for displaying last albums played from this playlist.

BTW, could you try this code :

https://www.dropbox.com/s/0cxa6aeqt09gah...stitems.py

Now, Songs smart playlists are handled.
I have make some tests with your smart playlist and it's OK (no need to use method=LastPlayed, use method=Last as your smart playlist already display last played songs ffrom 3 weeks).
But widget will be filled with albums, not songs.
(2014-03-26, 09:56)mikebzh44 Wrote: [ -> ]But, as your smart playlist already filter latest played songs from 3 weeks, you can use the default script with this smart playlist.

For me, using method=LastPlayed is usefull with a smart playlist with no filters.

For example, having a smart playlist "Rock" and building a widget for displaying last albums played from this playlist.

BTW, could you try this code :

https://www.dropbox.com/s/0cxa6aeqt09gah...stitems.py

Now, Songs smart playlists are handled.
I have make some tests with your smart playlist and it's OK (no need to use method=LastPlayed, use method=Last as your smart playlist already display last played songs ffrom 3 weeks).
But widget will be filled with albums, not songs.

Yeah i know about the filter, it's just ... i had to change it to see if it shows up.
Wonderful, i'll test later and report.

Thanx mate
Hi Butchabay.

No time to make some tests ?