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 - butchabay - 2013-05-13

(2013-05-13, 14:07)mikebzh44 Wrote: Thanks for reminding me Wink

You can try the latest release from GITHUB :

https://github.com/XBMC-Addons/script.randomandlastitems

Property Runtime is returned for Episodes / TV shows.

No bugs on my side but I just put some debug print in my log, tell me if on the skinner side, every thing is OK.

Thanks.

Thanx mate, will test it this evening and report.


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

Sorry mate just hadn't the time to test it yet, will do this evening ...


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

Well, i have tested and it's showing values as seconds,

Example for 44 minutes: 2618 minutes Smile


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

Sorry.

I've just push a commit on GITHUB to convert runtime from seconds to minutes.


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

Thanx!


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

Works perfect, thanx mate !


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

So, we are waiting for a patch from Black and I think that a new version will be release very soon Wink


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

May i ask for another request Smile

Is it possible to add watched status true/false for tvshows/episodes ?


Thanx


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

Before pushing this new properties to GITHUB, can you test this script :

https://www.dropbox.com/s/wqw3mlduy64bjka/randomandlastitems.py

Properties :

16:01:00 T:7864 NOTICE: ('SmartPlaylist4.1.Resumed', 'False')
16:01:00 T:7864 NOTICE: ('SmartPlaylist4.1.Watched', 'False')
16:01:01 T:7436 NOTICE: ('SmartPlaylist5.1.Resumed', 'False')
16:01:01 T:7436 NOTICE: ('SmartPlaylist5.1.Watched', 'False')
16:01:01 T:7864 NOTICE: ('SmartPlaylist4.2.Resumed', 'False')
16:01:01 T:7864 NOTICE: ('SmartPlaylist4.2.Watched', 'True')
16:01:01 T:7864 NOTICE: ('SmartPlaylist4.3.Resumed', 'False')
16:01:01 T:7864 NOTICE: ('SmartPlaylist4.3.Watched', 'False')
16:01:01 T:7436 NOTICE: ('SmartPlaylist5.2.Resumed', 'False')
16:01:01 T:7436 NOTICE: ('SmartPlaylist5.2.Watched', 'True')
16:01:01 T:7864 NOTICE: ('SmartPlaylist4.4.Resumed', 'False')
16:01:01 T:7864 NOTICE: ('SmartPlaylist4.4.Watched', 'True')
16:01:01 T:7436 NOTICE: ('SmartPlaylist5.3.Resumed', 'False')
16:01:01 T:7436 NOTICE: ('SmartPlaylist5.3.Watched', 'False')
16:01:01 T:7864 NOTICE: ('SmartPlaylist4.5.Resumed', 'False')
16:01:01 T:7864 NOTICE: ('SmartPlaylist4.5.Watched', 'False')
16:01:01 T:7436 NOTICE: ('SmartPlaylist5.4.Resumed', 'False')
16:01:01 T:7436 NOTICE: ('SmartPlaylist5.4.Watched', 'True')
16:01:01 T:7864 NOTICE: ('SmartPlaylist4.6.Resumed', 'False')
16:01:01 T:7864 NOTICE: ('SmartPlaylist4.6.Watched', 'False')
16:01:01 T:7436 NOTICE: ('SmartPlaylist5.5.Resumed', 'False')
16:01:01 T:7436 NOTICE: ('SmartPlaylist5.5.Watched', 'False')
16:01:02 T:7864 NOTICE: ('SmartPlaylist4.7.Resumed', 'False')
16:01:02 T:7864 NOTICE: ('SmartPlaylist4.7.Watched', 'False')
16:01:02 T:7436 NOTICE: ('SmartPlaylist5.6.Resumed', 'False')
16:01:02 T:7436 NOTICE: ('SmartPlaylist5.6.Watched', 'False')
16:01:02 T:7436 NOTICE: ('SmartPlaylist5.7.Resumed', 'False')
16:01:02 T:7436 NOTICE: ('SmartPlaylist5.7.Watched', 'False')
16:01:02 T:7864 NOTICE: ('SmartPlaylist4.8.Resumed', 'False')
16:01:02 T:7864 NOTICE: ('SmartPlaylist4.8.Watched', 'False')
16:01:02 T:7864 NOTICE: ('SmartPlaylist4.9.Resumed', 'False')
16:01:02 T:7864 NOTICE: ('SmartPlaylist4.9.Watched', 'False')
16:01:02 T:7436 NOTICE: ('SmartPlaylist5.8.Resumed', 'False')
16:01:02 T:7436 NOTICE: ('SmartPlaylist5.8.Watched', 'False')
16:01:02 T:7436 NOTICE: ('SmartPlaylist5.9.Resumed', 'False')
16:01:02 T:7436 NOTICE: ('SmartPlaylist5.9.Watched', 'False')
16:01:02 T:7864 NOTICE: ('SmartPlaylist4.10.Resumed', 'False')
16:01:02 T:7864 NOTICE: ('SmartPlaylist4.10.Watched', 'False')
16:01:02 T:7436 NOTICE: ('SmartPlaylist5.10.Resumed', 'False')
16:01:02 T:7436 NOTICE: ('SmartPlaylist5.10.Watched', 'False')


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

Watched True / False is working ! Resumed not tested as i don't use it ...

Thanx !


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

(2013-05-22, 22:28)butchabay Wrote: Watched True / False is working ! Resumed not tested as i don't use it ...

Thanx !

So I will push this new properties on github today.


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

GITHUB is updated :

- new property Watched is set for episodes
- property Resume (true or false string value) already exist

I don't think renaming Resume property to Resumed is a good idea as skinners are may be already using Resume property. And I don't want to duplicate properties.


RE: [RELEASE] Random and last items smartplaylist script for Skins - mika91 - 2013-05-27

Hi,

I'm skinning a Confluence Mod, and I' d like to make a widget for 5 random movies, episodes and albums.
I want the skin to be light and work on Raspberry Pi.

1) Running script only for random items shouldn't be long because of a few database queries, isn't it?
2) And for random items in a smartplaylist ?

Thanks for your work.


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

Don't know if Raspberry Pi is powerfull enough to run my script.

For Random movies, episodes and albums, I think that you should use service.skin.widgets script.

For playlist, you try my script on your Raspberry and look at the log, there is a debug message for showing request time.


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

Hi Mike, where can i get the previous version of this script?

The latest version causing the script to crash

Code:
15:34:53 T:3484   ERROR: EXCEPTION: argument "value" for method "setProperty" must be unicode or str
15:34:54 T:3484   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.TypeError'>
                                            Error Contents: argument "value" for method "setProperty" must be unicode or str
                                            Traceback (most recent call last):
                                              File "C:\Documents and Settings\user\Application Data\XBMC\addons\script.randomandlastitems\randomandlastitems.py", line 643, in <module>
                                                _getMovies()
                                              File "C:\Documents and Settings\user\Application Data\XBMC\addons\script.randomandlastitems\randomandlastitems.py", line 191, in _getMovies
                                                _setProperty( "%s.%d.RunningTime" % ( PROPERTIE, _count ), runtime)
                                              File "C:\Documents and Settings\user\Application Data\XBMC\addons\script.randomandlastitems\randomandlastitems.py", line 600, in _setProperty
                                                WINDOW.setProperty ( _property, _value )
                                            TypeError: argument "value" for method "setProperty" must be unicode or str
                                            -->End of Python script error report<--
15:34:54 T:1936  NOTICE: [RandomAndLastItems] ## PLAYLIST special://profile/playlists/video/Film_Asia.xsp COULD NOT BE LOADED ##
15:34:54 T:1936  NOTICE: ('[RandomAndLastItems] JSON RESULT ', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'files': None, u'limits': {u'start': 0, u'total': 0, u'end': 0}}})
15:34:54 T:1936  NOTICE: Loading PlaylistLastMovieMenu32 started at 2013-06-03 15:34:53 and take 0.125s
15:34:54 T:1800  NOTICE: [RandomAndLastItems] ## PLAYLIST special://profile/playlists/video/Anime.xsp COULD NOT BE LOADED ##
15:34:54 T:1800  NOTICE: ('[RandomAndLastItems] JSON RESULT ', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'files': None, u'limits': {u'start': 0, u'total': 0, u'end': 0}}})
15:34:54 T:1800  NOTICE: Loading PlaylistLastMovieMenu33 started at 2013-06-03 15:34:53 and take 0.297s
15:34:54 T:2716  NOTICE: [RandomAndLastItems] # 01 # PLAYLIST special://profile/playlists/video/Serial_Anime.xsp COULD NOT BE LOADED ##
15:34:54 T:2716  NOTICE: ('[RandomAndLastItems] JSON RESULT ', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'files': None, u'limits': {u'start': 0, u'total': 0, u'end': 0}}})
15:34:54 T:2716  NOTICE: Loading PlaylistLastMovieMenu36 started at 2013-06-03 15:34:54 and take 0.281s
15:34:54 T:3900  NOTICE: [RandomAndLastItems] # 01 # PLAYLIST special://profile/playlists/video/Serial_Asia.xsp COULD NOT BE LOADED ##
15:34:54 T:3900  NOTICE: ('[RandomAndLastItems] JSON RESULT ', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'files': None, u'limits': {u'start': 0, u'total': 0, u'end': 0}}})
15:34:54 T:3900  NOTICE: Loading PlaylistLastMovieMenu35 started at 2013-06-03 15:34:54 and take 0.266s
15:34:55 T:2744   ERROR: EXCEPTION: argument "value" for method "setProperty" must be unicode or str
15:34:55 T:2744   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.TypeError'>
                                            Error Contents: argument "value" for method "setProperty" must be unicode or str
                                            Traceback (most recent call last):
                                              File "C:\Documents and Settings\user\Application Data\XBMC\addons\script.randomandlastitems\randomandlastitems.py", line 648, in <module>
                                                _getEpisodesFromPlaylist()
                                              File "C:\Documents and Settings\user\Application Data\XBMC\addons\script.randomandlastitems\randomandlastitems.py", line 288, in _getEpisodesFromPlaylist
                                                _setEpisodeProperties ( _episode, _count )
                                              File "C:\Documents and Settings\user\Application Data\XBMC\addons\script.randomandlastitems\randomandlastitems.py", line 554, in _setEpisodeProperties
                                                _setProperty( "%s.%d.RunningTime"   % ( PROPERTIE, _count ), runtime)
                                              File "C:\Documents and Settings\user\Application Data\XBMC\addons\script.randomandlastitems\randomandlastitems.py", line 600, in _setProperty
                                                WINDOW.setProperty ( _property, _value )
                                            TypeError: argument "value" for method "setProperty" must be unicode or str
                                            -->End of Python script error report<--
15:34:55 T:820   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: ('artistid',)
                                            Traceback (most recent call last):
                                              File "C:\Documents and Settings\user\Application Data\XBMC\addons\script.randomandlastitems\randomandlastitems.py", line 650, in <module>
                                                _getAlbumsFromPlaylist()
                                              File "C:\Documents and Settings\user\Application Data\XBMC\addons\script.randomandlastitems\randomandlastitems.py", line 412, in _getAlbumsFromPlaylist
                                                _artistid = _file['artistid']
                                            KeyError: ('artistid',)
                                            -->End of Python script error report<--

Nevermind, i found it by re-downloading ace on another PC
the version that works is 1.2.5
I got a little problem though,
I have 2 music playlists (Barat & Asia), each has "path starts with" rule
But the script won't show the recent / random in ace skin.

Normal recently added list works fine, so the problem has something to do with the script.

I tried it again on another PC, and yes i can confirm this
This script won't work on Ace + Music smart playlist

Normal
Image

With script

Image

Any way to fix it?

The Log does not show any error related to the script strangely,
updating the script to the latest version (2.1.5), crashed the script with the error log above