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

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



- Martijn - 2012-02-13 19:47

If you do this script will benefit from a speeds increase on processing.
PHP Code:
# Use json instead of simplejson when python v2.7 or greater
if sys.version_info < (27):
    
import json as simplejson
else:
    
import simplejson 

I also noticed that when you have several buttons with playlists next to each other it takes some time to update them. So if you switch to the next one you will get the list for a couple of seconds of the previous playlist.
Don't know if this is something you can solve?


- BigNoid - 2012-02-13 21:52

Can you make the Count property count all the movies in the playlist regardless of unwatched option, just like in random movies script and recent added script?
Right now it counts the number of items returned by the script, instead of the playlist items.


- mikebzh44 - 2012-02-14 00:33

Martijn Wrote:If you do this script will benefit from a speeds increase on processing.
PHP Code:
# Use json instead of simplejson when python v2.7 or greater
if sys.version_info < (27):
    
import json as simplejson
else:
    
import simplejson 

I also noticed that when you have several buttons with playlists next to each other it takes some time to update them. So if you switch to the next one you will get the list for a couple of seconds of the previous playlist.
Don't know if this is something you can solve?
Thanks for the tip.

For the second problem, I don't know if I could do something Frown


- mikebzh44 - 2012-02-14 00:35

Big_Noid Wrote:Can you make the Count property count all the movies in the playlist regardless of unwatched option, just like in random movies script and recent added script?
Right now it counts the number of items returned by the script, instead of the playlist items.
I will ask to fmronan, Glass skinner, because the script has been made with him and for him.

Maybe, I could return a new propertie like TotalCount.


- mikebzh44 - 2012-02-14 15:16

buges Wrote:Im having problems with the script loading my playlist. The playlist is there in xbmc & working perfectly.

Im using a hidden button to run:
"<onfocus>XBMC.RunScript(script.RandomAndLastItems,limit=10,method='Last',playlist='spe​cial://profile/playlists/video/1234.xsp','menu=Menu1')</onfocus>"

But I just get an error

Debug gives me:
"WARNING: CUtil::GetMatchingSource... no matching source found for ['special://profile/playlists/video/1234.xsp']"
"WARNING: XFILE::CFactoryDirectory::Create - Unsupported protocol('special) in 'special://profile/playlists/video/1234.xsp'"

Am i doing something stupidly wrong?

I have the same warning as you but script is OK and properties are displayed.

But I think you have made a mistake in your code :
<onfocus>XBMC.RunScript(script.RandomAndLastItems,limit=10,method='Last',playlist='spe​cial://profile/playlists/video/1234.xsp','menu=Menu1')</onfocus>

Right code should be :
<onfocus>XBMC.RunScript(script.RandomAndLastItems,limit=10,method='Last',playlist='spe​cial://profile/playlists/video/1234.xsp',menu='Menu1')</onfocus>


- mikebzh44 - 2012-02-14 15:28

For the warning, it's normal : http://forum.xbmc.org/showpost.php?p=1017827&postcount=1703


- mikebzh44 - 2012-02-14 16:26

New version 1.0.4 : http://passion-xbmc.org/addons/Download.php/script.randomandlastitems/script.randomandlastitems-1.0.4.zip

Fix a bug and now, propertie Count contains the number of movies in the playlist.

I have to think about Watched and Unwatched because I have to scan every movies of the playlist to see if playcount =0 or not.


- Shinu - 2012-02-14 17:07

once u get things sorted out for movies, will u be looking into tv shows too?

PS: u should update ur first post with the link to the latest version. i could have sworn that u were still on version 1.0.1.


- mikebzh44 - 2012-02-14 17:11

First post has been updated Wink

Newt step is TV Shows


- BigNoid - 2012-02-14 20:05

mikebzh44 Wrote:Fix a bug and now, propertie Count contains the number of movies in the playlist.

Great, thx!


- Eisi2005 - 2012-02-14 20:59

@mikebzh44

sorry found my mistake.

Greets
Eisi


- Eisi2005 - 2012-02-14 21:28

@mikebzh44

could you make a counter for the playlist. For movie library there is a counter how many movies are in library howmay are watched and how many are unwatched ?

Is there a chance to make this for a playlist ?

Greets
Eisi


- mikebzh44 - 2012-02-14 21:32

For the first one, "How many movies in the library/playlist" is stored in propertie :

Playlist<method>Movie<menu>.Count

(See first post or README.txt in ZIP file for details).

For the 2 others counter, I can do that but script will be slower to return results because I will have to scan every movie of the library/playlist and test if it's watched or not.


- Eisi2005 - 2012-02-14 21:40

Hi,

if you have time for this, give it a try Smile

I hope you know the widget that i mean for movie library.

Greets
Eisi


- BigNoid - 2012-02-14 21:42

mikebzh44 Wrote:For the 2 others counter, I can do that but script will be slower to return results because I will have to scan every movie of the library/playlist and test if it's watched or not.

Don't you already fetch playcount to filter watched/unwatched and resumed items? The script wouldn't run slower then if the option unwatched=true is set?