[RELEASE] Random and last items smartplaylist script for Skins

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
mikebzh44 Offline
Posting Freak
Posts: 1,810
Joined: Nov 2011
Reputation: 50
Location: Nantes - France
Post: #721
I'm using Aeon Nox 4.1.9.9 and widgets based on smart playlists are OK :

[Image: t39ttPW.jpg]

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.

Sorry for my english, but, you know, I'm French so ...

find quote
ferdinand Offline
Junior Member
Posts: 18
Joined: Sep 2014
Reputation: 0
Post: #722
(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: t39ttPW.jpg]

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!
find quote
mikebzh44 Offline
Posting Freak
Posts: 1,810
Joined: Nov 2011
Reputation: 50
Location: Nantes - France
Post: #723
@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.

Sorry for my english, but, you know, I'm French so ...

find quote
phil65 Offline
Team-Kodi Member
Posts: 5,085
Joined: Mar 2009
Reputation: 73
Location: Cologne, Germany
Post: #724
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)
find quote
Hairy Hippy Offline
Senior Member
Posts: 118
Joined: Dec 2010
Reputation: 0
Post: #725
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<--
find quote
Hairy Hippy Offline
Senior Member
Posts: 118
Joined: Dec 2010
Reputation: 0
Post: #726
Is there no fix for this? Please let me know if you require further info.
find quote
mikebzh44 Offline
Posting Freak
Posts: 1,810
Joined: Nov 2011
Reputation: 50
Location: Nantes - France
Post: #727
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 ?

Sorry for my english, but, you know, I'm French so ...

find quote
Martijn Offline
Team Kodi
Posts: 12,182
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #728
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

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2014-11-28 19:23 by Martijn.)
find quote
creeve4 Offline
Junior Member
Posts: 5
Joined: Dec 2014
Reputation: 0
Post: #729
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=specia​l://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.
(This post was last modified: 2014-12-05 01:24 by creeve4.)
find quote
mikebzh44 Offline
Posting Freak
Posts: 1,810
Joined: Nov 2011
Reputation: 50
Location: Nantes - France
Post: #730
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

Sorry for my english, but, you know, I'm French so ...

find quote
paradix Offline
Skilled Skinner
Posts: 220
Joined: Sep 2011
Reputation: 7
Post: #731
mikebzh44 is there any chance your script will support the
Code:
<content>plugin://...</content>
method of filling lists?
find quote
mikebzh44 Offline
Posting Freak
Posts: 1,810
Joined: Nov 2011
Reputation: 50
Location: Nantes - France
Post: #732
I don't think because a lot of skinners (BigNoid and Aeon Nox 5, Phil65 and Aeon Confused) 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.

Sorry for my english, but, you know, I'm French so ...

find quote
Hairy Hippy Offline
Senior Member
Posts: 118
Joined: Dec 2010
Reputation: 0
Post: #733
My smart playlists are the same between profiles.
find quote
mikebzh44 Offline
Posting Freak
Posts: 1,810
Joined: Nov 2011
Reputation: 50
Location: Nantes - France
Post: #734
I have push release 2.2.2 to repo including patch from Martijn (post #728), you still got the error ?

Sorry for my english, but, you know, I'm French so ...

find quote
Hairy Hippy Offline
Senior Member
Posts: 118
Joined: Dec 2010
Reputation: 0
Post: #735
(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!
find quote
Post Reply