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 - mikebzh44 - 2014-10-02

I'm using Aeon Nox 4.1.9.9 and widgets based on smart playlists are OK :

Image

But on your second screenshot, "12 years a slave" is not related to any movies displayed on widget, right ?

So i think you have to ask for skinner to add same behaviour for smart playlist menu as for default Movies menu.


RE: [RELEASE] Random and last items smartplaylist script for Skins - ferdinand - 2014-10-02

(2014-10-02, 09:33)mikebzh44 Wrote: I'm using Aeon Nox 4.1.9.9 and widgets based on smart playlists are OK :

Image

But on your second screenshot, "12 years a slave" is not related to any movies displayed on widget, right ?

So i think you have to ask for skinner to add same behaviour for smart playlist menu as for default Movies menu.

Yes, what I show in the second pic (I think) is some function of the skin. It shows me the last partially viewed movie that I've seen.

The last movie I play and then stop appears there but in the playlist there is nothing shown, I already have ask in the ACE skin forum, just waiting for response.
Thanks for your great support!


RE: [RELEASE] Random and last items smartplaylist script for Skins - mikebzh44 - 2014-10-29

@skinners : Did you continue to use this script for Helix release of your skins ?

I know that a lot of skinners prefere to use plugin:// to load smart playlist and then populate widget because it's much more lighter in XML code.

The only advantage for this script is to provide stats on smart playlist (number of items, number of items watched, ...) but maybe Helix will provide this too.

Thanks.


RE: [RELEASE] Random and last items smartplaylist script for Skins - phil65 - 2014-10-29

I don´t use it anymore.
I also already wrote some python stuff to get library stats workin again. (BigNoid added that piece of code to service.library.data.provider already)


RE: [RELEASE] Random and last items smartplaylist script for Skins - Hairy Hippy - 2014-11-26

Hi sincere apologies if this is in the wrong place. Getting the following error when switching profiles. How do I resolve? Any other information needed?

Code:
17:28:08 T:9760   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.KeyError'>
                                            Error Contents: ('result',)
                                            Traceback (most recent call last):
                                              File "C:\Users\Username\AppData\Roaming\XBMC\addons\script.randomandlastitems\randoman​dlastitems.py", line 847, in <module>
                                                _getMovies()
                                              File "C:\Users\Username\AppData\Roaming\XBMC\addons\script.randomandlastitems\randoman​dlastitems.py", line 168, in _getMovies
                                                if _json_query['result'].has_key('moviedetails'):
                                            KeyError: ('result',)
                                            -->End of Python script error report<--



RE: [RELEASE] Random and last items smartplaylist script for Skins - Hairy Hippy - 2014-11-28

Is there no fix for this? Please let me know if you require further info.


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

Don't know, I don't use profile.

You mean that when you are on your main profile, there is no script error but when you switch to another profile, then you get this error ?

Does your smart playlists are identical between 2 profiles ?


RE: [RELEASE] Random and last items smartplaylist script for Skins - Martijn - 2014-11-28

i think a simple change on line168 to
PHP Code:
if _json_query.has_key('result') and _json_query['result'].has_key('moviedetails'): 

would do the trick. at least it wouldn't fail the script.
or check for _json_query.has_key('result') way earlier


RE: [RELEASE] Random and last items smartplaylist script for Skins - creeve4 - 2014-12-05

I have modified the Confluence skin for my use and am attempting to integrate this script into my skin.

in Home.xml I have:
Code:
                    <item id="10">
                        <label>31954</label>
                        <onfocus>XBMC.RunScript(script.randomandlastitems,limit=10,method=Last,playlist=special://videoplaylists/video/Movies.xsp,menu=Menu1)</onfocus>
                        <onclick>ActivateWindow(Videos,special://videoplaylists/video/Movies.xsp,return)</onclick>
                        <icon>-</icon>
                        <thumb>-</thumb>
                        <visible>!Skin.HasSetting(HomeMenuNoMovieButton) + Library.HasContent(Movies)</visible>
                    </item>

and in IncludesHomeRecentlyAdded.xml I have:
Code:
                        <item>
                            <label>$INFO[Window.Property(PlaylistLastMovieMenu1.1.Title)]</label>
                            <label2/>
                            <onclick>PlayMedia($ESCINFO[Window.Property(PlaylistLastMovieMenu1.1.Path)])</onclick>
                            <icon>$INFO[Window.Property(LatestMovie.1.Thumb)]</icon>
                            <thumb>-</thumb>
                            <visible>!IsEmpty(Window.Property(PlaylistLastMovieMenu1.1.Title))</visible>
                        </item>

The script seems to execute properly (no errors in the log file), but the recent movies widget on the Movies screen is empty. I'm still new to xbmc and trying to learn, any help is appreciated.


RE: [RELEASE] Random and last items smartplaylist script for Skins - mikebzh44 - 2014-12-05

I don't know if it important but usually, script is call with onload, not <onfocus>

Code:
<onload>RunScript(script.randomandlastitems,limit=10,method=Last,playlist=special://masterprofile/playlists/video/Parents.xsp,menu=Menu1)</onload>

And properties are filled properly :

Code:
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.Name', 'Parents')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.Count', '91')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.Watched', '13')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.Unwatched', '78')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.Type', 'Movie')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.DBID', '411')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.Title', u'Gravity')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.OriginalTitle', u'Gravity')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.Year', '2013')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.Genre', u'Science fiction / Thriller')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.Studio', u'Warner Bros.')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.Country', u'')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.Plot', u"Pour sa premi\xe8re exp\xe9dition \xe0 bord d'une navette spatiale, le docteur Ryan Stone, brillante experte en ing\xe9nierie m\xe9dicale, accompagne l'astronaute chevronn\xe9 Matt Kowalsky. Mais alors qu'il s'agit apparemment d'une banale sortie dans l'espace, une catastrophe se produit. Lorsque la navette est pulv\xe9ris\xe9e, Stone et Kowalsky se retrouvent totalement seuls, livr\xe9s \xe0 eux-m\xeames dans l'univers. Le silence assourdissant autour d'eux leur indique qu'ils ont perdu tout contact avec la Terre - et la moindre chance d'\xeatre sauv\xe9s. Peu \xe0 peu, ils c\xe8dent \xe0 la panique, d'autant plus qu'\xe0 chaque respiration, ils consomment un peu plus les quelques r\xe9serves d'oxyg\xe8ne qu'il leur reste. \r\nMais c'est peut-\xeatre en s'enfon\xe7ant plus loin encore dans l'immensit\xe9 terrifiante de l'espace qu'ils trouveront le moyen de rentrer sur Terre...")
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.PlotOutline', u"Pour sa premi\xe8re exp\xe9dition \xe0 bord d'une navette spatiale, le docteur Ryan Stone, brillante experte en ing\xe9nierie m\xe9dicale, accompagne l'astronaute chevronn\xe9 Matt Kowalsky. Mais alors qu'il s'agit apparemment d'une banale sortie dans l'espace, une catastrophe se produit. Lorsque la navette est pulv\xe9ris\xe9e, Stone et Kowalsky se retrouvent totalement seuls, livr\xe9s \xe0 eux-m\xeames dans l'univers. Le silence assourdissant autour d'eux leur indique qu'ils ont perdu tout contact avec la Terre - et la moindre chance d'\xeatre sauv\xe9s. Peu \xe0 peu, ils c\xe8dent \xe0 la panique, d'autant plus qu'\xe0 chaque respiration, ils consomment un peu plus les quelques r\xe9serves d'oxyg\xe8ne qu'il leur reste. \r\nMais c'est peut-\xeatre en s'enfon\xe7ant plus loin encore dans l'immensit\xe9 terrifiante de l'espace qu'ils trouveront le moyen de rentrer sur Terre...")
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.Tagline', u"Les deux seuls survivants d'un accident survenu sur une station spatiale cherchent \xe0 regagner la Terre.")
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.Runtime', '90')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.Rating', '0.0')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.Trailer', u'http://fr.vid.web.720p.acsta.net/nmedia/33/13/10/14/14/19538825_hd_013.mp4')
14:17:16 T:6420  NOTICE: ('PlaylistLastMovieMenu1.1.MPAA', u'')

You can edit randomandlastitems.py code in addon folder to add some debug information :

Code:
def _setProperty ( _property, _value ):
    global WINDOW
    # Set window Properties
    WINDOW.setProperty ( _property, _value )
    # Print property and value in xbmc.log file
    print(_property, _value)

You can also force property name :

Code:
XBMC.RunScript(script.randomandlastitems,limit=10,method=Last,playlist=specia​l://videoplaylists/video/Movies.xsp,property=Menu1)

And then use Menu1.1.Title


RE: [RELEASE] Random and last items smartplaylist script for Skins - paradix - 2014-12-05

mikebzh44 is there any chance your script will support the
Code:
<content>plugin://...</content>
method of filling lists?


RE: [RELEASE] Random and last items smartplaylist script for Skins - mikebzh44 - 2014-12-05

I don't think because a lot of skinners (BigNoid and Aeon Nox 5, Phil65 and Aeon Huh) use directly <content>plugin://...</content> with XSP file to retrieve information about smart playlists.

I think that this script have made is time and it will be deprecated sooner or later.


RE: [RELEASE] Random and last items smartplaylist script for Skins - Hairy Hippy - 2014-12-06

My smart playlists are the same between profiles.


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

I have push release 2.2.2 to repo including patch from Martijn (post #728), you still got the error ?


RE: [RELEASE] Random and last items smartplaylist script for Skins - Hairy Hippy - 2014-12-06

(2014-12-06, 09:58)mikebzh44 Wrote: I have push release 2.2.2 to repo including patch from Martijn (post #728), you still got the error ?

I think it has Mike. Many thanks!