Kodi Community Forum
[RELEASE] Random and last items smartplaylist script for Skins - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+---- Forum: Skin helper addons (https://forum.kodi.tv/forumdisplay.php?fid=300)
+---- Thread: [RELEASE] Random and last items smartplaylist script for Skins (/showthread.php?tid=122448)



RE: [RELEASE] Random and last items smartplaylist script for Skins - Martijn - 2013-09-22

Incorporated the json vs. simplejson speed tests.
please try the updated github version to see if there are any regressions
https://github.com/XBMC-Addons/script.randomandlastitems


RE: [RELEASE] Random and last items smartplaylist script for Skins - butchabay - 2013-09-22

Hi Martijn, thanx for the update ! Don't know if the updated version was intended to solve the problem i've posted with the path special://skin/playlists ...
Tested with latest nightly 22.09.2013 but my problem still persists.

Just something else: if i click on that playlist it opens as it should, so the path special://skin/playlists ...is working, but the widgets are not appearing on home.

Cheers


RE: [RELEASE] Random and last items smartplaylist script for Skins - mikebzh44 - 2013-09-23

Martijn.

I've just try this new release with database and guisettings from this topic :

http://forum.xbmc.org/showthread.php?tid=173878

Comparing with this results :

http://forum.xbmc.org/showthread.php?tid=173878&pid=1510864#pid1510864

This release is a little bit faster (with 2 smart playlists, this release a 1 second faster) :

1 - With 5 smart playlists for movies :

Code:
10:04:29 T:4284   DEBUG: Random and Last items script: ##### SmartPlaylist1 Entering _getMovies function took 0.720s
10:04:47 T:4284   DEBUG: Random and Last items script: ##### SmartPlaylist1 Executing JSON query took 19.714s
10:04:47 T:4284   DEBUG: Random and Last items script: ##### SmartPlaylist1 Populating properties took 20.146s

10:04:32 T:604   DEBUG: Random and Last items script: ##### SmartPlaylist2 Entering _getMovies function took 3.280s
10:04:54 T:604   DEBUG: Random and Last items script: ##### SmartPlaylist2 Executing JSON query took 26.525s
10:04:55 T:604   DEBUG: Random and Last items script: ##### SmartPlaylist2 Populating properties took 27.329s

10:04:31 T:3964   DEBUG: Random and Last items script: ##### SmartPlaylist3 Entering _getMovies function took 3.361s
10:04:36 T:3964   DEBUG: Random and Last items script: ##### SmartPlaylist3 Executing JSON query took 8.335s
10:04:38 T:3964   DEBUG: Random and Last items script: ##### SmartPlaylist3 Populating properties took 10.515s

10:04:35 T:3804   DEBUG: Random and Last items script: ##### SmartPlaylist4 Entering _getMovies function took 6.570s
10:04:41 T:3804   DEBUG: Random and Last items script: ##### SmartPlaylist4 Executing JSON query took 13.280s
10:04:43 T:3804   DEBUG: Random and Last items script: ##### SmartPlaylist4 Populating properties took 14.768s

10:04:35 T:6596   DEBUG: Random and Last items script: ##### SmartPlaylist5 Entering _getMovies function took 6.514s
10:04:42 T:6596   DEBUG: Random and Last items script: ##### SmartPlaylist5 Executing JSON query took 14.321s
10:04:43 T:6596   DEBUG: Random and Last items script: ##### SmartPlaylist5 Populating properties took 15.513s

2 - With only smart playlist #1 for movies :

Code:
10:09:34 T:6960   DEBUG: Random and Last items script: ##### SmartPlaylist1 Entering _getMovies function took 2.734s
10:09:36 T:6960   DEBUG: Random and Last items script: ##### SmartPlaylist1 Executing JSON query took 5.404s
10:09:37 T:6960   DEBUG: Random and Last items script: ##### SmartPlaylist1 Populating properties took 5.712s

3 - With smart playlists #1 and #2 for movies :

Code:
10:12:27 T:5320   DEBUG: Random and Last items script: ##### SmartPlaylist1 Entering _getMovies function took 2.536s
10:12:31 T:5320   DEBUG: Random and Last items script: ##### SmartPlaylist1 Executing JSON query took 6.588s
10:12:32 T:5320   DEBUG: Random and Last items script: ##### SmartPlaylist1 Populating properties took 7.002s

10:12:28 T:4936   DEBUG: Random and Last items script: ##### SmartPlaylist2 Entering _getMovies function took 3.702s
10:12:32 T:4936   DEBUG: Random and Last items script: ##### SmartPlaylist2 Executing JSON query took 7.346s
10:12:32 T:4936   DEBUG: Random and Last items script: ##### SmartPlaylist2 Populating properties took 7.716s

PS : I'm running XBMC 12.2 / Windows 7 on my professionnal PC, it's not a HTPC dedicated to XBMC running OpenELEC with an SSD.


RE: [RELEASE] Random and last items smartplaylist script for Skins - Martijn - 2013-09-23

nothing i can help with. JSON-queries are internal XBMC.
i only used the selection to find the best method available.
if you could test with a nightly version if there's any progress done there. I know there will be some more improvement


RE: [RELEASE] Random and last items smartplaylist script for Skins - mikebzh44 - 2013-09-23

OK, I will test this with a Gotham nightly.


RE: [RELEASE] Random and last items smartplaylist script for Skins - Martijn - 2013-09-23

i do plan to bump to python 2.7.5 which will increase the JSON decoding by 15x or so but that has no effect on the query time


RE: [RELEASE] Random and last items smartplaylist script for Skins - User 34959 - 2013-09-23

Any chance of "premiered" property for episodes?


RE: [RELEASE] Random and last items smartplaylist script for Skins - mikebzh44 - 2013-09-24

I have try with Gotham (13.0-ALPHA7 Git:20130831-2da9c97) and the big library from Legion455 but it's not faster than Fordo (12.2) :

Code:
10:56:29 T:5728   DEBUG: Random and Last items script: Loading SmartPlaylist1 started at 2013-09-24 10:56:17 and take 12.448s
10:56:34 T:2356   DEBUG: Random and Last items script: Loading SmartPlaylist2 started at 2013-09-24 10:56:17 and take 17.582s
10:56:23 T:5060   DEBUG: Random and Last items script: Loading SmartPlaylist3 started at 2013-09-24 10:56:17 and take 6.139s
10:56:25 T:7068   DEBUG: Random and Last items script: Loading SmartPlaylist4 started at 2013-09-24 10:56:17 and take 8.069s
10:56:26 T:5688   DEBUG: Random and Last items script: Loading SmartPlaylist5 started at 2013-09-24 10:56:17 and take 8.562s
10:56:50 T:492    DEBUG: Random and Last items script: Loading SmartPlaylist6 started at 2013-09-24 10:56:17 and take 32.688s

@Martijn, did you think running the last nightly could speed up script ?

@SpaceMonkey : Try the latest release from GITHUB, %s.%d.Premiered property for episodes just added Wink


RE: [RELEASE] Random and last items smartplaylist script for Skins - Martijn - 2013-09-24

There could have been some database query improvements since Frodo.


RE: [RELEASE] Random and last items smartplaylist script for Skins - mikebzh44 - 2013-09-24

Results with latest available nightly (13.0-ALPHA8 Git:20130922-5aef1c5) :

Code:
11:58:16 T:2972   DEBUG: Random and Last items script: Loading SmartPlaylist1 started at 2013-09-24 11:57:54 and take 21.950s
11:58:24 T:7228   DEBUG: Random and Last items script: Loading SmartPlaylist2 started at 2013-09-24 11:57:54 and take 30.305s
11:58:07 T:5708   DEBUG: Random and Last items script: Loading SmartPlaylist3 started at 2013-09-24 11:57:54 and take 13.311s
11:58:10 T:3388   DEBUG: Random and Last items script: Loading SmartPlaylist4 started at 2013-09-24 11:57:54 and take 16.195s
11:58:11 T:3880   DEBUG: Random and Last items script: Loading SmartPlaylist5 started at 2013-09-24 11:57:54 and take 17.357s
11:58:39 T:1488   DEBUG: Random and Last items script: Loading SmartPlaylist6 started at 2013-09-24 11:57:54 and take 45.299s

Times are worse but I'm testing on my professional laptop,


RE: [RELEASE] Random and last items smartplaylist script for Skins - User 34959 - 2013-10-24

It seems that the current XBMC repo version does not like spaces in the playlist name?

For example:

Playlist file name: Horror Movies.xsp
Smart playlist name: <name>Horror Movies</name>
Result: http://pastebin.com/Qf7RD9Hz

If i rename the playlist to <name>Horror</name> it works without errors, and what's weird, i can rename it back to <name>Horror Movies</name> and it still works.

This is how i run the script:

PHP Code:
<onload condition="System.HasAddon(script.randomandlastitems) + Skin.HasSetting(EnableWidgets) + Skin.HasSetting(CustomWidget1) + !IsEmpty(Skin.String(CustomMenu.1.Path)) + [Stringcompare(Skin.String(CustomMenu.1.Type),Video Playlist) | Stringcompare(Skin.String(CustomMenu.1.Type),Music Playlist)]">RunScript(script.randomandlastitems,playlist=$INFO[Skin.String(CustomMenu.1.Path)],method=Last,limit=10,unwatched=True,resume=False,property=CustomWidget1Recent)</onload>
    <
onload condition="System.HasAddon(script.randomandlastitems) + Skin.HasSetting(EnableWidgets) + Skin.HasSetting(CustomWidget1) + !IsEmpty(Skin.String(CustomMenu.1.Path)) + Stringcompare(Skin.String(CustomMenu.1.Type),Video Playlist)">RunScript(script.randomandlastitems,playlist=$INFO[Skin.String(CustomMenu.1.Path)],method=Lastlimit=10,unwatched=False,resume=True,property=CustomWidget1Recommended)</onload



RE: [RELEASE] Random and last items smartplaylist script for Skins - Rantanplan-1 - 2013-11-06

Script Seems not to work with Gotham!

Hello

I try jesterday evening to get this Script to work with Gotham. Sadly no Sucsess!
Does i do someting wrong, or do i have to do someting diffrent for Gotham? (it works with Frodo the way i try it for Gotham.)
i Try it with the old V.2.0.5 and a newer V.2.1.5 in the addon.xml

In "Home.xml":
PHP Code:
<?xml version="1.0" encoding="UTF-8"?>
<window>
    <defaultcontrol always="true">9000</defaultcontrol>
    <allowoverlay>no</allowoverlay>
    <onunload condition="Container(9000).Hasfocus(10) | Container(9000).Hasfocus(11) | ControlGroup(9010).HasFocus | ControlGroup(9016).HasFocus | ControlGroup(9017).HasFocus">SetProperty(VideosDirectLink,True)</onunload>
    <onunload condition="Control.HasFocus(9000) + Container(9000).Hasfocus(2)">ClearProperty(VideosDirectLink)</onunload>
    
    <onload condition="!Skin.HasSetting(HomeMenuNoHDMoviesButton)">XBMC.RunScript(script.RandomAndLastItems,limit=10,method=Last,playlist=special://skin/playlists/Video/Movies.xsp,menu=Menu2)</onload>
    <onload condition="!Skin.HasSetting(HomeMenuNo3DMoviesButton)">XBMC.RunScript(script.randomandlastitems,limit=10,method=Last,playlist=special://skin/playlists/3DMovies.xsp,menu=Menu3)</onload>
    <onload condition="!Skin.HasSetting(HomeMenuNoDocuButton)">XBMC.RunScript(script.randomandlastitems,limit=10,method=Last,playlist=special://skin/playlists/Video/Doku.xsp,menu=Menu1)</onload>
    <onload condition="!Skin.HasSetting(HomeMenuNoMusicvideosButton)">XBMC.RunScript(script.randomandlastitems,limit=10,method=Last,playlist=special://skin/playlists/Musicvideos.xsp,menu=Menu4)</onload>
    <onload condition="!Skin.HasSetting(HomeMenuNoConcertsButton)">XBMC.RunScript(script.randomandlastitems,limit=10,method=Last,playlist=special://skin/playlists/Concerts.xsp,menu=Menu5)</onload>
    
    <controls> 

In the "IncludeReaconlyAdded.xml"
PHP Code:
<content>
                        <
item
                            <
label>$INFO[Window(Home).Property(PlaylistLastMovieMenu2.1.Title)]</label>
                            <
label2>$INFO[Window(Home).Property(PlaylistLastMovieMenu2.1.Plot)]</label2>
                            <
onclick>PlayMedia("$INFO[Window.Property(PlaylistLastMovieMenu2.1.File)]")</onclick>
                            <
icon>-</icon>
                            <
thumb>$INFO[Window(Home).Property(PlaylistLastMovieMenu2.1.Art(poster))]</thumb>
                            <
property name="Fanart">$INFO[Window(Home).Property(PlaylistLastMovieMenu2.1.Art(fanart))]</property>
                            <
property name="Year">$INFO[Window(Home).Property(PlaylistLastMovieMenu2.1.Year)]</property>
                            <
property name="Runtime">$INFO[Window(Home).Property(PlaylistLastMovieMenu2.1.Runtime)]</property>
                            <
property name="Rating">$INFO[Window(Home).Property(PlaylistLastMovieMenu2.1.Rating)]</property>
                            <
visible>!IsEmpty(Window(Home).Property(PlaylistLastMovieMenu2.1.Title))</visible>
                        </
item>
                        <
item>
                            <
label>$INFO[Window(Home).Property(PlaylistLastMovieMenu2.2.Title)]</label>
                            <
label2>$INFO[Window.Property(PlaylistLastMovieMenu2.2.Plot)]</label2>
                            <
onclick>PlayMedia("$INFO[Window.Property(PlaylistLastMovieMenu2.2.File)]")</onclick>
                            <
icon>-</icon>
                            <
thumb>$INFO[Window(Home).Property(PlaylistLastMovieMenu2.2.Art(poster))]</thumb>
                            <
property name="Fanart">$INFO[Window(Home).Property(PlaylistLastMovieMenu2.2.Art(fanart))]</property>
                            <
property name="Year">$INFO[Window(Home).Property(PlaylistLastMovieMenu2.2.Year)]</property>
                            <
property name="Runtime">$INFO[Window(Home).Property(PlaylistLastMovieMenu2.2.Runtime)]</property>
                            <
property name="Rating">$INFO[Window(Home).Property(PlaylistLastMovieMenu2.2.Rating)]</property>
                            <
visible>!IsEmpty(Window(Home).Property(PlaylistLastMovieMenu2.2.Title))</visible>
                        </
item

The Playlists are located in the Skinfolder in a selfgenerated Folder "Playlists"
Image

If i thake a Look in the Log it shows me:

Seems as the Skript couldn't finde the Smartplaylist, but no Idea Why!!?
Try diffrent Folder Names, a Subfolder called "Video" in the "Playlists" folder and so on, no Sucsess.

So no Idea whats wrong, in Frodo it works.

Couldnt figuere it out.


(Help is much appreciated!!)


RE: [RELEASE] Random and last items smartplaylist script for Skins - mikebzh44 - 2013-11-06

Please, don't post log snippet and user xbmclogs.com to share all your log file.

As you rare running Gotham in portable mode, your xsp files must be stored in :

D:\Zwischenspeichern\XBMC Gotham _Portable_ installation\XBMC\portable_data\userdata\playlists\video

I've just make a quick test with :
XBMC 13.0-ALPHA9
Aeon Nox 4.1.9 (which is not 100% compliant with Gotham)
4 playlists

And everything is OK :

Code:
13:29:05 T:7308   DEBUG: CApplication::ExecuteXBMCAction : To RunScript(script.randomandlastitems, playlist=special://profile/playlists/video/Parents.xsp, method=Last, limit=10, unwatched=True, resume=False, property=SmartPlaylist1)
13:29:05 T:7308   DEBUG: CApplication::ExecuteXBMCAction : To RunScript(script.randomandlastitems, playlist=special://profile/playlists/video/Enfants.xsp, method=Last, limit=10, unwatched=False, resume=False, property=SmartPlaylist2)
13:29:05 T:7308   DEBUG: CApplication::ExecuteXBMCAction : To RunScript(script.randomandlastitems, playlist=special://profile/playlists/video/Cartoons.xsp, method=Last, limit=10, unwatched=False, resume=False, property=SmartPlaylist3)
13:29:05 T:7308   DEBUG: CApplication::ExecuteXBMCAction : To RunScript(script.randomandlastitems, type=Episode, playlist="special://profile/playlists/video/SeriesUS.xsp", method=Latest, limit=10, unwatched=True, resume=True, property=SmartPlaylist4)


13:29:14 T:780    DEBUG: Random and Last items script: Loading SmartPlaylist3 started at 2013-11-06 13:29:09 and take 4.672s
13:29:14 T:7936   DEBUG: Random and Last items script: Loading SmartPlaylist2 started at 2013-11-06 13:29:09 and take 4.659s
13:29:14 T:7276   DEBUG: Random and Last items script: Loading SmartPlaylist1 started at 2013-11-06 13:29:09 and take 4.896s
13:29:14 T:7296   DEBUG: Random and Last items script: Loading SmartPlaylist4 started at 2013-11-06 13:29:09 and take 5.031s



RE: [RELEASE] Random and last items smartplaylist script for Skins - Rantanplan-1 - 2013-11-06

(2013-11-06, 14:32)mikebzh44 Wrote: As you rare running Gotham in portable mode, your xsp files must be stored in :

D:\Zwischenspeichern\XBMC Gotham _Portable_ installation\XBMC\portable_data\userdata\playlists\video

Sadly isn't a Option cause the Smartplylists have to be included in the Skin.


EDIT:(14:19LT): Do You need the whole Log? (Can't finde any Errors in there! (just:
PHP Code:
01:26:37 T:4032   DEBUGCUtil::GetMatchingSourceno matching source found for [special://skin/playlists/3DMovies.xsp] 
))
/EDITEND




EDIT2:(18:21LT): A Answer would be much appreciated /EDIT2END


RE: [RELEASE] Random and last items smartplaylist script for Skins - butchabay - 2013-11-06

Already mentioned about pre defined skin smartplaylists, no solution so far ...read my posts a few pages back.

(2013-09-16, 21:09)butchabay Wrote: OK had to investigate and noticed something has changed from frodo to gotham.

Example for calling the script with custom playlist works as exepted, in frodo as in gotham:

PHP Code:
XBMC.RunScript(script.randomandlastitems,type=Movie,unwatched=True,limit=10,resume=False,method=Last,playlist=$INFO[Skin.String(Menu_Custom4_Path)],menu=Menu1



Example for calling the script with predefined playlist, works in frodo but not in gotham:

PHP Code:
XBMC.RunScript(script.randomandlastitems,type=Movie,unwatched=True,limit=10,resume=False,method=Last,playlist=special://skin/playlists/HDMovies.xsp,menu=Menu7) 


Any ideas ? Does gotham handles different special://skin stuff ?


Thanx

(2013-11-06, 14:40)Rantanplan-1 Wrote:
(2013-11-06, 14:32)mikebzh44 Wrote: As you rare running Gotham in portable mode, your xsp files must be stored in :

D:\Zwischenspeichern\XBMC Gotham _Portable_ installation\XBMC\portable_data\userdata\playlists\video

Sadly isn't a Option cause the Smartplylists have to be included in the Skin.


EDIT: Do You need the whole Log? (Can't finde any Errors in there! (just:
PHP Code:
01:26:37 T:4032   DEBUGCUtil::GetMatchingSourceno matching source found for [special://skin/playlists/3DMovies.xsp] 
))
/EDITEND