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 of video smartplaylist script for Skins / Skinners - mikebzh44 - 2013-02-09

Yes, you can run script with unneeded parameters like unwtached or resume for music, there are ignored.

For your other questions, I need to look at the code.


RE: [RELEASE] Random and last items of video smartplaylist script - User 34959 - 2013-02-13

Have you had the time to take a look? There seems to be a chunk of code related to music section commented out in the script but i'm not pretending to understand what it does.


RE: [RELEASE] Random and last items of video smartplaylist script for Skins/Skinners - mikebzh44 - 2013-02-13

No spare time for that Sad

Will have to find some.


RE: [RELEASE] Random and last items of video smartplaylist script - User 34959 - 2013-03-13

(2013-02-09, 11:43)toiva Wrote: - It is not returning the type for an album type smart playlist. I use the type as a visibility condition for a group. When i remove the visibility condition it shows up just fine.

Contents of the playlist

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="albums">
    <name>Metallica Albums</name>
    <match>all</match>
    <rule field="albumartist" operator="is">
        <value>Metallica</value>
    </rule>
</smartplaylist>

If mikebzh44 has no time can somebody else step up and take a look? Wouldn't mind having support for music videos aswell, would be on a par with skin widgets then.


re - phil65 - 2013-03-13

does type return "Music"? or nothing at all?


RE: [RELEASE] Random and last items of video smartplaylist script - User 34959 - 2013-03-13

Based only on checking the log it does not return anything for album playlists.

For movies it returns these, and starts going through the playlist contents and returning the properties:

Code:
18:29:09 T:4567076864  NOTICE: ('##### Property ', 'CustomWidget1Recent.Count', '66')
18:29:09 T:4567076864  NOTICE: ('##### Property ', 'CustomWidget1Recent.Watched', '61')
18:29:09 T:4567076864  NOTICE: ('##### Property ', 'CustomWidget1Recent.Unwatched', '5')
18:29:09 T:4567076864  NOTICE: ('##### Property ', 'CustomWidget1Recent.Type', 'Movie')

with albums it starts spewing the actual contents right away

I believe this is the request

Code:
18:35:50 T:4497358848   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://profile/playlists/music/Metallica2.xsp", "media": "music", "properties": ["title", "description", "albumlabel", "artist", "genre", "year", "thumbnail", "fanart", "rating", "playcount", "dateadded"], "sort": {"order": "descending", "method": "dateadded"}}, "id": 1}
18:35:50 T:4497358848   DEBUG: JSONRPC: Calling files.getdirectory
18:35:50 T:4497358848   DEBUG: CUtil::GetMatchingSource: no matching source found for [special://profile/playlists/music/Metallica2.xsp]

New debug log


[RELEASE] RandomAndLastItems of video smartplaylist script for Skins / Skinners - mikebzh44 - 2013-03-14

Quick fix :

Edit randomandlastitems.py script
Go to line 390
Uncomment (remove #) the line
Change it to :
Code:
_setMusicProperties ( 0, 0, 0 )

Statistics will be set to 0 but Type property will be set to Music

I'm looking for have statistics to work but I have to deal with JSON query and I didn't have use it for a long time :S


[RELEASE] Random and last items of video smartplaylist script for Skins - mikebzh44 - 2013-03-15

You can download latest release 2.0.5 from GITHUB :

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

Statistics for Albums smart playlist (and only Albums smart playlist, script is broken for Songs or Artists smart playlists) are now OK.


[RELEASE] Random and last items of video smartplaylist script for Skins - User 34959 - 2013-03-15

Thanks, will test as soon as i redo the widget i was planning to use. Seems that i've deleted it.


RE: [RELEASE] Random and last items of video smartplaylist script for Skins - mikebzh44 - 2013-03-18

v2.0.6 released on GITHUB :

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

New property added for movies : OriginalTitle

@Martijn : I saw that you have pushed v2.0.5 on official repo but don't know when. How long do we have to wait before the next pushed ? Will you do it when you will push service.skin.widgets ?

Thanks.


RE: [RELEASE] Random and last items of video smartplaylist script for Skins - mikebzh44 - 2013-03-19

v2.0.7 and v2.0.8 released on GITHUB :

- Add MPAA and Studio properties for TV Shows
- Add MPAA and Director properties for movies


RE: [RELEASE] Random and last items of video smartplaylist script for Skins - mikebzh44 - 2013-03-25

v2.0.9 released on github :

- Fix quoted or not quoted path for smart playlist
- Add Theme, Mood, Style and Type properties for Music
- Remove Thumb and Fanart properties for Music (depricated and replaced by Art(thumb) and Art(fanart) properties)


RE: [RELEASE] Random and last items of video smartplaylist script for Skins - MarcosQui - 2013-03-26

mikebzh44 I got an error when adding a playlist of albums. See the error:

Code:
Error Type: <type 'exceptions.TypeError'>
Error Contents: object of type 'NoneType' has no len()
Traceback (most recent call last):
File "C:\Users\Marcos\AppData\Roaming\XBMC\addons\script.randomandlastitems\randomandlastitems.py", line 693, in <module>
getAlbumsFromPlaylist()
File "C:\Users\Marcos\AppData\Roaming\XBMC\addons\script.randomandlastitems\randomandlastitems.py", line 368, in _getAlbumsFromPlaylist
_songs += len(_result)
TypeError: object of type 'NoneType' has no len()
-->End of Python script error report<--

Is there anything to do?


RE: [RELEASE] Random and last items of video smartplaylist script for Skins - mikebzh44 - 2013-03-26

I don't have any issue on my test PC Sad

Could you edit randomandlastitems.py script and :
- search for lines :
Code:
_json_query = xbmc.executeJSONRPC('{"id":1, "jsonrpc":"2.0", "method":"AudioLibrary.GetSongs", "params":{"filter":{"albumid": %s}, "properties":["artistid"]}}' %_albumid)
_json_query = unicode(_json_query, 'utf-8', errors='ignore')
_json_pl_response = simplejson.loads(_json_query)

- add this line :
Code:
print("##### SONGS=", _json_pl_response)

- code look like this way now :
Code:
_json_query = xbmc.executeJSONRPC('{"id":1, "jsonrpc":"2.0", "method":"AudioLibrary.GetSongs", "params":{"filter":{"albumid": %s}, "properties":["artistid"]}}' %_albumid)
_json_query = unicode(_json_query, 'utf-8', errors='ignore')
_json_pl_response = simplejson.loads(_json_query)
print("##### SONGS=", _json_pl_response)

Take care of indentation !!

- run the skin in your skin and give me the log snippet with #####

When everything is OK :
Code:
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 11, u'end': 11}, u'songs': [{u'artistid': [31], u'songid': 923, u'label': u'No Line On The Horizon'}, {u'artistid': [31], u'songid': 924, u'label': u'Magnificent'}, {u'artistid': [31], u'songid': 925, u'label': u'Moment Of Surrender'}, {u'artistid': [31], u'songid': 926, u'label': u'Unknown Caller'}, {u'artistid': [31], u'songid': 927, u'label': u"I'll Go Crazy If I Don't Go Crazy Tonight"}, {u'artistid': [31], u'songid': 928, u'label': u'Get On Your Boots'}, {u'artistid': [31], u'songid': 929, u'label': u'Stand Up Comedy'}, {u'artistid': [31], u'songid': 930, u'label': u'Fez - Being Born'}, {u'artistid': [31], u'songid': 931, u'label': u'White As Snow'}, {u'artistid': [31], u'songid': 932, u'label': u'Breathe'}, {u'artistid': [31], u'songid': 933, u'label': u'Cedars Of Lebanon'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 11, u'end': 11}, u'songs': [{u'artistid': [31], u'songid': 912, u'label': u'Vertigo'}, {u'artistid': [31], u'songid': 913, u'label': u'Miracle Drug'}, {u'artistid': [31], u'songid': 914, u'label': u"Sometimes You Can't Make It on Your Own"}, {u'artistid': [31], u'songid': 915, u'label': u'Love and Peace or Else'}, {u'artistid': [31], u'songid': 916, u'label': u'City of Blinding Lights'}, {u'artistid': [31], u'songid': 917, u'label': u'All Because of You'}, {u'artistid': [31], u'songid': 918, u'label': u'A Man and a Woman'}, {u'artistid': [31], u'songid': 919, u'label': u'Crumbs from Your Table'}, {u'artistid': [31], u'songid': 920, u'label': u'One Step Closer'}, {u'artistid': [31], u'songid': 921, u'label': u'Original of the Species'}, {u'artistid': [31], u'songid': 922, u'label': u'Yahweh'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 14, u'end': 14}, u'songs': [{u'artistid': [31], u'songid': 898, u'label': u'Lady With the Spinning Head [Extended Dance Mix]'}, {u'artistid': [31], u'songid': 899, u'label': u'Dirty Day [Junk Day Mix]'}, {u'artistid': [31], u'songid': 900, u'label': u'Summer Rain'}, {u'artistid': [31], u'songid': 901, u'label': u'Electrical Storm'}, {u'artistid': [31], u'songid': 902, u'label': u'North and South of the River'}, {u'artistid': [31], u'songid': 903, u'label': u'Your Blue Room'}, {u'artistid': [31], u'songid': 904, u'label': u'Happiness Is a Warm Gun [The Gun Mix]'}, {u'artistid': [31], u'songid': 905, u'label': u'Salome [Zooromancer Remix]'}, {u'artistid': [31], u'songid': 906, u'label': u'Even Better Than the Real Thing [The Perfecto Remix]'}, {u'artistid': [31], u'songid': 907, u'label': u'Numb [Gimme Some More Dignity Mix]'}, {u'artistid': [31], u'songid': 908, u'label': u'Mysterious Ways [Solar Plexus Club Mix]'}, {u'artistid': [31], u'songid': 909, u'label': u'If God Will Send His Angels [Big Yam Mix]'}, {u'artistid': [31], u'songid': 910, u'label': u'Lemon [Jeep Mix]'}, {u'artistid': [31], u'songid': 911, u'label': u'Discoth\xe8que [Hexidecimal Mix]'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 16, u'end': 16}, u'songs': [{u'artistid': [31], u'songid': 882, u'label': u'Even Better Than the Real Thing'}, {u'artistid': [31], u'songid': 883, u'label': u'Mysterious Ways'}, {u'artistid': [31], u'songid': 884, u'label': u'Beautiful Day'}, {u'artistid': [31], u'songid': 885, u'label': u'Electrical Storm [William Orbit Mix][#]'}, {u'artistid': [31], u'songid': 886, u'label': u'One'}, {u'artistid': [31], u'songid': 887, u'label': u'Miss Sarajevo'}, {u'artistid': [31], u'songid': 888, u'label': u'Stay (Faraway, So Close!)'}, {u'artistid': [31], u'songid': 889, u'label': u"Stuck in a Moment You Can't Get Out Of"}, {u'artistid': [31], u'songid': 890, u'label': u'Gone [New Mix]'}, {u'artistid': [31], u'songid': 891, u'label': u'Until the End of the World'}, {u'artistid': [31], u'songid': 892, u'label': u'The Hands That Built America [From Gangs of New York][#]'}, {u'artistid': [31], u'songid': 893, u'label': u'Discoth\xe8que [New Mix]'}, {u'artistid': [31], u'songid': 894, u'label': u'Hold Me, Thrill Me, Kiss Me, Kill Me'}, {u'artistid': [31], u'songid': 895, u'label': u'Staring at the Sun [New Mix]'}, {u'artistid': [31], u'songid': 896, u'label': u'Numb [New Mix]'}, {u'artistid': [31], u'songid': 897, u'label': u'The First Time'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 11, u'end': 11}, u'songs': [{u'artistid': [31], u'songid': 871, u'label': u'Beautiful Day'}, {u'artistid': [31], u'songid': 872, u'label': u"Stuck in a Moment You Can't Get Out Of"}, {u'artistid': [31], u'songid': 873, u'label': u'Elevation'}, {u'artistid': [31], u'songid': 874, u'label': u'Walk On'}, {u'artistid': [31], u'songid': 875, u'label': u'Kite'}, {u'artistid': [31], u'songid': 876, u'label': u'In a Little While'}, {u'artistid': [31], u'songid': 877, u'label': u'Wild Honey'}, {u'artistid': [31], u'songid': 878, u'label': u'Peace on Earth'}, {u'artistid': [31], u'songid': 879, u'label': u'When I Look at the World'}, {u'artistid': [31], u'songid': 880, u'label': u'New York'}, {u'artistid': [31], u'songid': 881, u'label': u'Grace'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 15, u'end': 15}, u'songs': [{u'artistid': [31], u'songid': 856, u'label': u'The Three Sunrises'}, {u'artistid': [31], u'songid': 857, u'label': u'Spanish Eyes'}, {u'artistid': [31], u'songid': 858, u'label': u'Sweetest Thing'}, {u'artistid': [31], u'songid': 859, u'label': u'Love Comes Tumbling'}, {u'artistid': [31], u'songid': 860, u'label': u'Bass Trap'}, {u'artistid': [31], u'songid': 861, u'label': u'Dancing Barefoot'}, {u'artistid': [31], u'songid': 862, u'label': u'Everlasting Love'}, {u'artistid': [31], u'songid': 863, u'label': u'Unchained Melody'}, {u'artistid': [31], u'songid': 864, u'label': u'Walk to the Water'}, {u'artistid': [31], u'songid': 865, u'label': u'Luminous Times (Hold on to Love)'}, {u'artistid': [31], u'songid': 866, u'label': u'Hallelujah Here She Comes'}, {u'artistid': [31], u'songid': 867, u'label': u'Silver and Gold'}, {u'artistid': [31], u'songid': 868, u'label': u'Endless Deep'}, {u'artistid': [31], u'songid': 869, u'label': u'A Room at the Heartbreak Hotel'}, {u'artistid': [31], u'songid': 870, u'label': u'Trash, Trampoline and the Party Girl'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 14, u'end': 14}, u'songs': [{u'artistid': [31], u'songid': 842, u'label': u'Pride (In the Name of Love)'}, {u'artistid': [31], u'songid': 843, u'label': u"New Year's Day"}, {u'artistid': [31], u'songid': 844, u'label': u'With or Without You'}, {u'artistid': [31], u'songid': 845, u'label': u"I Still Haven't Found What I'm Looking For"}, {u'artistid': [31], u'songid': 846, u'label': u'Sunday Bloody Sunday'}, {u'artistid': [31], u'songid': 847, u'label': u'Bad'}, {u'artistid': [31], u'songid': 848, u'label': u'Where the Streets Have No Name'}, {u'artistid': [31], u'songid': 849, u'label': u'I Will Follow'}, {u'artistid': [31], u'songid': 850, u'label': u'The Unforgettable Fire'}, {u'artistid': [31], u'songid': 851, u'label': u'Sweetest Thing [The Single Mix]'}, {u'artistid': [31], u'songid': 852, u'label': u'Desire'}, {u'artistid': [31], u'songid': 853, u'label': u'When Love Comes to Town'}, {u'artistid': [31], u'songid': 854, u'label': u'Angel of Harlem'}, {u'artistid': [31], u'songid': 855, u'label': u'All I Want Is You'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 12, u'end': 12}, u'songs': [{u'artistid': [31], u'songid': 830, u'label': u'Discoth\xe8que'}, {u'artistid': [31], u'songid': 831, u'label': u'Do You Feel Loved'}, {u'artistid': [31], u'songid': 832, u'label': u'Mofo'}, {u'artistid': [31], u'songid': 833, u'label': u'If God Will Send His Angels'}, {u'artistid': [31], u'songid': 834, u'label': u'Staring at the Sun'}, {u'artistid': [31], u'songid': 835, u'label': u'Last Night on Earth'}, {u'artistid': [31], u'songid': 836, u'label': u'Gone'}, {u'artistid': [31], u'songid': 837, u'label': u'Miami'}, {u'artistid': [31], u'songid': 838, u'label': u'The Playboy Mansion'}, {u'artistid': [31], u'songid': 839, u'label': u'If You Wear That Velvet Dress'}, {u'artistid': [31], u'songid': 840, u'label': u'Please'}, {u'artistid': [31], u'songid': 841, u'label': u'Wake up Dead Man'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 10, u'end': 10}, u'songs': [{u'artistid': [31], u'songid': 820, u'label': u'Zooropa'}, {u'artistid': [31], u'songid': 821, u'label': u'Babyface'}, {u'artistid': [31], u'songid': 822, u'label': u'Numb'}, {u'artistid': [31], u'songid': 823, u'label': u'Lemon'}, {u'artistid': [31], u'songid': 824, u'label': u'Stay (Faraway, So Close!)'}, {u'artistid': [31], u'songid': 825, u'label': u"Daddy's Gonna Pay for Your Crashed Car"}, {u'artistid': [31], u'songid': 826, u'label': u'Some Days Are Better Than Others'}, {u'artistid': [31], u'songid': 827, u'label': u'The First Time'}, {u'artistid': [31], u'songid': 828, u'label': u'Dirty Day'}, {u'artistid': [31], u'songid': 829, u'label': u'The Wanderer'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 12, u'end': 12}, u'songs': [{u'artistid': [31], u'songid': 808, u'label': u'Zoo Station'}, {u'artistid': [31], u'songid': 809, u'label': u'Even Better Than the Real Thing'}, {u'artistid': [31], u'songid': 810, u'label': u'One'}, {u'artistid': [31], u'songid': 811, u'label': u'Until the End of the World'}, {u'artistid': [31], u'songid': 812, u'label': u"Who's Gonna Ride Your Wild Horses"}, {u'artistid': [31], u'songid': 813, u'label': u'So Cruel'}, {u'artistid': [31], u'songid': 814, u'label': u'The Fly'}, {u'artistid': [31], u'songid': 815, u'label': u'Mysterious Ways'}, {u'artistid': [31], u'songid': 816, u'label': u"Tryin' to Throw Your Arms Around the World"}, {u'artistid': [31], u'songid': 817, u'label': u'Ultra Violet (Light My Way)'}, {u'artistid': [31], u'songid': 818, u'label': u'Acrobat'}, {u'artistid': [31], u'songid': 819, u'label': u'Love Is Blindness'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 17, u'end': 17}, u'songs': [{u'artistid': [31], u'songid': 791, u'label': u'Helter Skelter [Live]'}, {u'artistid': [31], u'songid': 792, u'label': u"Van Diemen's Land"}, {u'artistid': [31], u'songid': 793, u'label': u'Desire'}, {u'artistid': [31], u'songid': 794, u'label': u'Hawkmoon 269'}, {u'artistid': [31], u'songid': 795, u'label': u'All Along the Watchtower [Live]'}, {u'artistid': [31], u'songid': 796, u'label': u"I Still Haven't Found What I'm Looking For [Live]"}, {u'artistid': [31], u'songid': 797, u'label': u'Freedom for My People'}, {u'artistid': [31], u'songid': 798, u'label': u'Silver and Gold [Live]'}, {u'artistid': [31], u'songid': 799, u'label': u'Pride (In the Name of Love) [Live]'}, {u'artistid': [31], u'songid': 800, u'label': u'Angel of Harlem'}, {u'artistid': [31], u'songid': 801, u'label': u'Love Rescue Me'}, {u'artistid': [31], u'songid': 802, u'label': u'When Love Comes to Town'}, {u'artistid': [31], u'songid': 803, u'label': u'Heartland'}, {u'artistid': [31], u'songid': 804, u'label': u'God, Pt. 2'}, {u'artistid': [31], u'songid': 805, u'label': u'The Star Spangled Banner'}, {u'artistid': [31], u'songid': 806, u'label': u'Bullet the Blue Sky [Live]'}, {u'artistid': [31], u'songid': 807, u'label': u'All I Want Is You'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 11, u'end': 11}, u'songs': [{u'artistid': [31], u'songid': 1300, u'label': u'Where the Streets Have No Name'}, {u'artistid': [31], u'songid': 1301, u'label': u"I Still Haven't Found What I'm Looking For"}, {u'artistid': [31], u'songid': 1302, u'label': u'With or Without You'}, {u'artistid': [31], u'songid': 1303, u'label': u'Bullet the Blue Sky'}, {u'artistid': [31], u'songid': 1304, u'label': u'Running to Stand Still'}, {u'artistid': [31], u'songid': 1305, u'label': u'Red Hill Mining Town'}, {u'artistid': [31], u'songid': 1306, u'label': u"In God's Country"}, {u'artistid': [31], u'songid': 1307, u'label': u'Trip Through Your Wires'}, {u'artistid': [31], u'songid': 1308, u'label': u'One Tree Hill'}, {u'artistid': [31], u'songid': 1309, u'label': u'Exit'}, {u'artistid': [31], u'songid': 1310, u'label': u'Mothers of the Disappeared'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 10, u'end': 10}, u'songs': [{u'artistid': [31], u'songid': 770, u'label': u'A Sort of Homecoming'}, {u'artistid': [31], u'songid': 771, u'label': u'Pride (In the Name of Love)'}, {u'artistid': [31], u'songid': 772, u'label': u'Wire'}, {u'artistid': [31], u'songid': 773, u'label': u'The Unforgettable Fire'}, {u'artistid': [31], u'songid': 774, u'label': u'Promenade'}, {u'artistid': [31], u'songid': 775, u'label': u'4th of July'}, {u'artistid': [31], u'songid': 776, u'label': u'Bad'}, {u'artistid': [31], u'songid': 777, u'label': u'Indian Summer Sky'}, {u'artistid': [31], u'songid': 778, u'label': u'Elvis Presley and America'}, {u'artistid': [31], u'songid': 779, u'label': u'MLK'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 10, u'end': 10}, u'songs': [{u'artistid': [31], u'songid': 760, u'label': u'Sunday Bloody Sunday'}, {u'artistid': [31], u'songid': 761, u'label': u'Seconds'}, {u'artistid': [31], u'songid': 762, u'label': u"New Year's Day"}, {u'artistid': [31], u'songid': 763, u'label': u'Like a Song...'}, {u'artistid': [31], u'songid': 764, u'label': u'Drowning Man'}, {u'artistid': [31], u'songid': 765, u'label': u'The Refugee'}, {u'artistid': [31], u'songid': 766, u'label': u'Two Hearts Beat as One'}, {u'artistid': [31], u'songid': 767, u'label': u'Red Light'}, {u'artistid': [31], u'songid': 768, u'label': u'Surrender'}, {u'artistid': [31], u'songid': 769, u'label': u'"40"'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 8, u'end': 8}, u'songs': [{u'artistid': [31], u'songid': 752, u'label': u'Gloria'}, {u'artistid': [31], u'songid': 753, u'label': u"11 O'Clock Tick Tock"}, {u'artistid': [31], u'songid': 754, u'label': u'I Will Follow'}, {u'artistid': [31], u'songid': 755, u'label': u'Party Girl'}, {u'artistid': [31], u'songid': 756, u'label': u'Sunday Bloody Sunday'}, {u'artistid': [31], u'songid': 757, u'label': u'The Electric Co.'}, {u'artistid': [31], u'songid': 758, u'label': u"New Year's Day"}, {u'artistid': [31], u'songid': 759, u'label': u'"40"'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 11, u'end': 11}, u'songs': [{u'artistid': [31], u'songid': 741, u'label': u'Gloria'}, {u'artistid': [31], u'songid': 742, u'label': u'I Fall Down'}, {u'artistid': [31], u'songid': 743, u'label': u'I Threw a Brick Through a Window'}, {u'artistid': [31], u'songid': 744, u'label': u'Rejoice'}, {u'artistid': [31], u'songid': 745, u'label': u'Fire'}, {u'artistid': [31], u'songid': 746, u'label': u'Tomorrow'}, {u'artistid': [31], u'songid': 747, u'label': u'October'}, {u'artistid': [31], u'songid': 748, u'label': u'With a Shout'}, {u'artistid': [31], u'songid': 749, u'label': u'Stranger in a Strange Land'}, {u'artistid': [31], u'songid': 750, u'label': u'Scarlet'}, {u'artistid': [31], u'songid': 751, u'label': u'Is That All?'}]}})
13:56:14 T:3940  NOTICE: ('##### SONGS=', {u'jsonrpc': u'2.0', u'id': 1, u'result': {u'limits': {u'start': 0, u'total': 10, u'end': 10}, u'songs': [{u'artistid': [31], u'songid': 731, u'label': u'Twilight'}, {u'artistid': [31], u'songid': 732, u'label': u'An Cat Dubh'}, {u'artistid': [31], u'songid': 733, u'label': u'Out of Control'}, {u'artistid': [31], u'songid': 734, u'label': u'Stories for Boys'}, {u'artistid': [31], u'songid': 735, u'label': u'Ocean'}, {u'artistid': [31], u'songid': 736, u'label': u'Day Without Me'}, {u'artistid': [31], u'songid': 737, u'label': u'Another Time Another Place'}, {u'artistid': [31], u'songid': 738, u'label': u'Electric Co'}, {u'artistid': [31], u'songid': 739, u'label': u'Shadows and Tall Trees'}, {u'artistid': [31], u'songid': 740, u'label': u'I Will Follow'}]}})

Your smart playlist is OK ? You can browse it ?


RE: [RELEASE] Random and last items of video smartplaylist script for Skins - phil65 - 2013-03-26

try moving

_songs += len(_result)

one line down so that it is placed inside the if block.

Code:
...
    if _result:
        _songs += len(_result)
...