• 1
  • 3
  • 4
  • 5
  • 6(current)
  • 7
Random Movie script for skins
#76
Here you go:
Code:
import xbmc
import simplejson as json

class Main:
    def __init__( self ):
        JSONrequest = {"jsonrpc": "2.0",
                       "method": "VideoLibrary.GetGenres",
                       "params": {"type": "movie"},
                       "id": 1}  
        genreresult = unicode(xbmc.executeJSONRPC(json.dumps(JSONrequest)), errors='ignore')

        genres = json.loads(genreresult)

        with open('special://skin/720p/ListGenre.xml','w') as fileGenre:

            fileGenre.write('<includes>\n')
            fileGenre.write('\t<include name="ListGenre">\n')
            fileGenre.write('\t\t<content>\n')

            for genre in genres["result"]["genres"]:
                fileGenre.write('\t\t\t<item id="%s">\n' % (genre["genreid"]))
                fileGenre.write('\t\t\t\t<label>"%s"</label>\n' % (genre["genreid"]))
                fileGenre.write('\t\t\t\t<label2>%s</label2>\n' % (genre["label"]))
                fileGenre.write('\t\t\t\t<onclick>-</onclick>\n')
                fileGenre.write('\t\t\t</item>\n')
            fileGenre.write('\t\t</content>\n')
            fileGenre.write('\t</include>\n')
            fileGenre.write('</includes>')


if ( __name__ == "__main__" ):
    Main()
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#77
Hi el_Paraguayo,

I've just seen your reply,
Congrats are in order, you've just made my day!!!

The script works great,
just like it used to in dharma. I can now once more create the genre menu buttons.

I did had to change this
PHP Code:
with open('special://skin/720p/ListGenre.xml','w') as fileGenre

into this
PHP Code:
with open(xbmc.translatePath('special://skin/720p/ListGenre.xml'),'w') as fileGenre

Many thanks for your trouble and time spent in adapting the script.

Sram
Reply
#78
My pleasure.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#79
Do we know if this script is working with Gotham? Warliom's Aeon Nox 4.1.9 "requires" this plugin, so I'd like to install it. Secondly, how do I install it please?

Thanks,
Reply
#80
I've not tried on Gotham but I see no reason for the code not to work. I may be able to take a look this weekend.

In terms of installing, it's currently a case of downloading the zip file from github and extracting it into your add-ons folder.

I really should try to get this added to the main repo...
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#81
Thanks for the help, I've installed it. But after i click YES on "Restrict selection to unwatched movies only?" I get a Error message saying:

Error
Script Failed! Random Movie Player

Thought I'd let you know, thanks for the help anyhow.

PS: I'm running on Gotham 13.0 and Aeon Nox 4.1.9.9
Reply
#82
Thanks for the update.

I'm running Frodo on my main machine, but I'll stick Gotham on a laptop and take a look.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#83
OK. The script works for me on Gotham without any changes. Did you download the right version? You need the "preEden" version (shows how old the script is!!): https://github.com/elParaguayo/xbmc-rand...ee/preEden

There's not much in the way of error checking, so you'll need to make sure your videos are in your library and that there is at least one unwatched one (if you're going for that option).

if you still get an error, can you post the error message from the log file and I'll take a look.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#84
Alright, so I had gone to the first link and downloaded whichever version that was (probably the original). I now installed the preEden one, and it seems to be fine. The preEden version definitely worked.

Thanks again!
Reply
#85
FYI - I'm tidying up the script so it can be added to the main XBMC repository.

Working version is here: https://github.com/elParaguayo/script.randommovie
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#86
Is it possible to alter the script that it will start Cinema Experience (http://forum.kodi.tv/showthread.php?tid=...ght=random) followed by a random movie?
Reply
#87
Is it possible to do? Almost certainly.

Have I got time at the moment? Probably not.

However, I think all you'd need to do is amend the script so that it returns the movieid rather than the filepath and then either play the film (using JSON plus the movieid parameter) or start Cinema Experience passing the args "movieid=xx".

I don't actually use the random movie or cinema experience so it's not going to be high on my list of things to do but you're welcome to fork the script and have a go if you want.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#88
Tried everything I could this week, but to be honest I don't know what I'm doing, I am definitely not a coder Sad
Reply
#89
I think you'd need to change line 143 of default.py from
Code:
movieList.append(movie["file"])
to
Code:
movieList.append(movie["movieid"])

And then change line 261 from
Code:
xbmc.executebuiltin('PlayMedia(' + randomMovie + ',0,noresume)')
to
Code:
jsoncmd={'jsonrpc': '2.0',
         'method': 'Addons.ExecuteAddon',
         'params': {'wait': False,
                    'addonid': 'script.cinema.experience',
                    'params': ['movieid={}'.format(randomMovie)]},
         'id':0}
cmd = json.dumps(jsoncmd)
xbmc.executeJSONRPC(cmd)

This is completely untested by the way so make a copy of the script before you try this!
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#90
The Script works perfect with Movies without german Chars like ä,ö,ü,ß in the Title, but with this Chars in the Movietitle Kodi won't play the File.

For Example:
The Movie is named "Star Trek - 04 - Zurück in die Gegenwart"
The Title in the NFO file looks like "<title>Star Trek - 04 - Zurück in die Gegenwart</title>".

The Error in the Kodi log File: ERROR: PlayMedia could not play media: H:\Filme\Star Trek\Star Trek - 04 - Zurck in die Gegenwart\Star Trek - 04 - Zurck in die Gegenwart.mkv

All Movies plays well without using the Script

I apologize for my bad english Angel
Reply
  • 1
  • 3
  • 4
  • 5
  • 6(current)
  • 7

Logout Mark Read Team Forum Stats Members Help
Random Movie script for skins0