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.
(2013-01-10, 17:51)mikebzh44 Wrote: [ -> ]Fixed for TVShows playlist.

ΟΚ, it works. Thanks Big Grin
@mikebzh44 Thanks hey!!, Off to work now but will test tomorrow. I'll make a plan to limit the skin widget to Albums not Music.
I'm getting the same error from the _getEpisodes() method.
mikebzh44, I think the fix from your post the #357 also applies here.

The _item variable doesn't have the "id" set, and later json query in the _setEpisodeProperties() method throws an exception.
New commit pushed on GITHUB :

https://github.com/XBMC-Addons/script.ra...dlastitems

Martijn, did you make to request to push it to official repo or did I ?
Hi Mikebzh44, first I would like to thank you and congratulate for the script.

I would like to know if is possible to include Concerts and Music Videos Playlists on the Script features.

Thank you so much.
Yes, I have to work on it for a long time Wink
(2013-01-23, 09:42)mikebzh44 Wrote: [ -> ]Yes, I have to work on it for a long time Wink

Are them on your plans?


Yes. I have to include some concerts in my library and look how it could be manage by the script.
Get the crystal balls ready, why is this not returning anything?

PHP Code:
XBMC.RunScript(script.randomandlastitems,limit=10,method=Last,playl​ist=$INFO[Skin.String(CustomMenu.1.Path)],unwatched=True,property=CustomWidget1Recent

PHP Code:
20:42:42 T:140735131361664   DEBUGExecuteXBMCAction Translating XBMC.RunScript(script.randomandlastitems,limit=10,method=Last,playl​ist=$INFO[Skin.String(CustomMenu.1.Path)],unwatched=True,property=CustomWidget1Recent)
20:42:42 T:140735131361664   DEBUGExecuteXBMCAction To XBMC.RunScript(script.randomandlastitems,limit=10,method=Last,playl​ist=special://profile/playlists/video/Animation.xsp,unwatched=True,property=CustomWidget1Recent) 

PHP Code:
<setting type="string" name="skin.confluence.modified.CustomMenu.1.Path">special://profile/playlists/video/Animation.xsp</setting> 

PHP Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
    <name>Animation</name>
    <match>all</match>
    <rule field="genre" operator="is">
        <value>Animation</value>
    </rule>
    <order direction="ascending">year</order>
</smartplaylist> 

I'm trying to use it in a list container like this

PHP Code:
<label>$INFO[Window(home).Property(CustomWidget1Recent.1.Title)]</label>
<
label2></label2>
<
onclick>PlayMedia($ESCINFO[Window(home).Property(CustomWidget1Recent.1.File)])</onclick>
<
icon>$INFO[Window(home).Property(CustomWidget1Recent.1.Art(poster))]</icon>
<
thumb>-</thumb>
<
visible>!IsEmpty(Window(home).Property(CustomWidget1Recent.1.Title))</visible
And your smart playlist is OK, you can browse movies in library ?

As I'm not a skinner, I will have to look in other skin how other skinners use the script.
Yes it's ok, i've tried other smart playlists too.

I also tried

Code:
XBMC.RunScript(script.randomandlastitems,type=Movie,limit=10,method=Last,playl​ist=$INFO[Skin.String(CustomMenu.1.Path)],unwatched=True,menu=Menu1)

but this seems to list all my movies in my library starting from the newest unwatched. It seems that specifying "type" overrides the playlist and it uses database directly?

If i remove menu=Menu1 and run the script like this

Code:
XBMC.RunScript(script.randomandlastitems,limit=10,method=Last,playl​ist=$INFO[Skin.String(CustomMenu.1.Path)],unwatched=True,menu=Menu1)

I get nothing at all.. I think i need a good nights sleep.
This is how the script is called in Aeon Nox 4.0.9 :

Code:
RunScript(script.randomandlastitems, type=Movie, playlist=special://profile/playlists/video/Parents.xsp, method=Last, limit=10, unwatched=False, resume=False, property=SmartPlaylist1)

And how properties are used in skin :

Code:
<label>$INFO[Window(Home).Property(SmartPlaylist1.1.Title)]</label>

So everything look good compare to your first example : http://forum.xbmc.org/showthread.php?tid...pid1325042

You can easily add some debug log by editing XBMC\addons\script.randomandlastitems\randomandlastitems.py file and add this line :

Code:
print ("##### Property ", _property, _value )

to _setProperty function :

before :

Code:
def _setProperty ( _property, _value ):
    global WINDOW
    # Set window Properties
    WINDOW.setProperty ( _property, _value )

Code:
def _setProperty ( _property, _value ):
    global WINDOW
    # Set window Properties
    WINDOW.setProperty ( _property, _value )
    print ("##### Property ", _property, _value )

So you will see in xbmc.log which properties are set :

09:07:53 T:556 NOTICE: ('##### Property ', 'SmartPlaylist1.1.Title', u'The Hit Girls')

Hope it will be helpful Confused
I'm at work right now, different OS (Windows), different library (sqlite instead mysql), same problem.

Unfortunately pastebin is blocked, i will take a look at debugging later today at home but this is the only reference i'm seeing

Code:
10:30:16 T:3984   DEBUG: CApplication::ExecuteXBMCAction : Translating XBMC.RunScript(script.randomandlastitems,limit=10,method=Last,playl​ist=$INFO[Skin.String(CustomMenu.1.Path)],unwatched=True,property=CustomWidget1Recent)
10:30:16 T:3984   DEBUG: CApplication::ExecuteXBMCAction : To XBMC.RunScript(script.randomandlastitems,limit=10,method=Last,playl​ist=special://profile/playlists/video/testi.xsp,unwatched=True,property=CustomWidget1Recent)

10:32:52 T:6408   DEBUG: Random and Last items script: Loading PlaylistLast started at 2013-02-06 10:32:52 and take 0.003s

Now it gets weird, i copied the runscript action from Nox, changed the infolabel and the property and it worked. I copied the original script line back and now it works too. Huh
It seems to work fine for movies and tv shows (both tv show and episode type playlists).

Working on music right now and couple of questions:

- I can ran the script with unwatched=True,resume=False even though the music does not support these and i won't run into any problems? It seems to populate the properties just fine and i haven't seen any problems.

- What kind of music playlists are supported? Artist type playlists are not returning anything, this i believe is by design, correct? Album type smart playlists work, no problems there with the properties except that..

- It is not returning the type for an album type smart playlist. I use the type as a visibility condition for a group. When i remove the visibility condition it shows up just fine.

debug log

Contents of the playlist

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="albums">
    <name>Metallica Albums</name>
    <match>all</match>
    <rule field="albumartist" operator="is">
        <value>Metallica</value>
    </rule>
</smartplaylist>