• 1(current)
  • 2
  • 3
  • 4
  • 5
  • 7
  •   
Random Movie script for skins
#1
EDIT: Please note - I've updated this script for Gotham (and because I'm a bit better at python now too...). New location for download here: https://github.com/elParaguayo/script.ra...master.zip

The intention is for this to be added to the official repository but I need to test for more bugs first.



I've been helping out on the Cirrus Extended skin for a few months now. For the latest release I wrote a short script that plays a random movie from the user's library. The script allows the user to restrict the selection by genre/unwatched movies.

I wanted to make the experience seamless with the skin as a whole, so the code to launch the script is coded directly into the skin (rather than launching through the addons menu).

I therefore thought I'd share the code with other skin developers so that they could include with their skins if they wanted to.

Script id: script.randommovie
Compatibility: Dharma (see below)
Source: https://github.com/elParaguayo/xbmc-random-movies
Download (Dharma): https://github.com/elParaguayo/xbmc-rand...all/master
Download (pre-Eden): https://github.com/elParaguayo/xbmc-rand...ll/preEden


Skin code:
Up to the skinner as to where to include the code. The key lines are:
For filter by genre:
Code:
<onclick>RunScript(script.randommovie, filtergenre=True)</onclick>
<visible>System.HasAddon(script.randommovie)</visible>

For no genre filter:
Code:
<onclick>RunScript(script.randommovie)</onclick>
<visible>System.HasAddon(script.randommovie)</visible>

The user is first asked (via a yes/no dialog) whether they want to restrict the choice to unwatched movies. If the genre filter has been delected then the list of genres populates a DialogSelect list.

As I understand it, this isn't compatible in post-Dharma versions - I assume this is down to the deprecation of the http api requests and their replacement with JSON RPC calls.

Once I get pre-Eden working on my laptop I'll convert the script. EDIT: DONE.

I hope someone else finds this useful.

el_P


EDIT: Please note, there is a more comprehensive Random Items script (available here) which you may want to consider looking at. Depends what your needs are!
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#2
It's working nice. I have a suggestion though, couldn't you add the genre bit too as a pop up instead of leaving the choice to the skinner. I can imagine I sometimes want the choice for genre and sometimes I don't. The way it's implemented I have to edit the skin to toggle between these two settings.
Reply
#3
Big_Noid Wrote:It's working nice. I have a suggestion though, couldn't you add the genre bit too as a pop up instead of leaving the choice to the skinner. I can imagine I sometimes want the choice for genre and sometimes I don't. The way it's implemented I have to edit the skin to toggle between these two settings.

Yeah, I did think about that too.

I might add another option e.g.
-no parameter - play random movie (so as not to break existing skin implementations)
-filtergenre - direct link to genre selection
-userchoice - user asked whether he wants to pick genre or not.

I'll add to my To Do list...

Thanks!
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#4
Update:

I've added a pre-Eden compatible version of the script (download link in first post).

I've also added (just to pre-Eden at the moment) the option to prompt the user whether they want to filter by genre, so skinners only need to include the one call to the script if they want. See the readme file for more info.

NB: The readme is currently incorrect (can't update until I'm home tonight!) - the args that can be passed are "filtergenre=True" and "prompt=True".
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#5
With the prompt=true addition it is now perfect. Works really great, it's like having a sneak preview at home Big Grin
Reply
#6
UPDATE: Minor tweak to fix an error where the returned data contained an accented letter.

Download link unchanged - see 1st post.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#7
el_Paraguayo, could your script be edited to work in a playlist submenu context?

for example, i have a shortcut to a video playlist with various tv shows attached to my home menu. could you edit your script so that the random button would appear under the playlist and i'd be able to play a random tv show?

i think this would be a fantastic feature in any skin.

regards,
mark
Reply
#8
Mark,

Sorry for the slow reply - hadn't realised there'd been a new post here.

I think that it should be possible.

There are two things you're asking:
1) Make script work for TV shows (currently it's movies only - seemed a bit counter-intuitive to do for TV shows as you'd usually watch episodes in order)
2) Make script work for Playlists (as above).

I think that the JSON RPC spec provides enough info for the script to work on TV shows and playlists without too much additional work.

In terms of adding it to the skin - have you modded your skin so there's a direct link to your playlist, or were you hoping to get this added as a context menu item for each playlist automatically? If it's the former I can help, if it's the latter then this is probably outside of my skills!

I'll take a look.

el_P
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#9
For anyone trying to use the pre-Eden version on the the latest nightlies, you'll need to change one word in the script to make it work:

In line 33 of default.py in the script.randommovies folder. Change "fields" to "properties".

I'll push the update to github when I get the chance - DONE
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#10
Hey,

I don't know much about skinning (know Python, though). Can someone give me an easy solution how to integrate this into confluence?

Cheers
Reply
#11
I hope it is possible to change your script in order to make a sort of film using a playlist?
Reply
#12
arnuschky Wrote:Hey,

I don't know much about skinning (know Python, though). Can someone give me an easy solution how to integrate this into confluence?

Cheers

Hi, you could add it to the Movie sub-menu on the home screen by editing the IncludesHomeMenuItems.xml located in the 720p folder. Search for the section named <include name="HomeSubMenuMovies"> and add a new button there..

Here is a example..

Code:
<include name="HomeSubMenuMovies">
        <control type="image" id="90161">
            <width>35</width>
            <height>35</height>
            <texture border="0,0,0,3" flipx="true">HomeSubEnd.png</texture>
        </control>
        <control type="button" id="90162">
            <include>ButtonHomeSubCommonValues</include>
            <label>31328</label>
            <onclick>ActivateWindow(Videos,RecentlyAddedMovies,return)</onclick>
        </control>
        <control type="button" id="90163">
            <include>ButtonHomeSubCommonValues</include>
            <label>369</label>
            <onclick>ActivateWindow(Videos,MovieTitles,return)</onclick>
        </control>
        <control type="button" id="90164">
            <include>ButtonHomeSubCommonValues</include>
            <label>135</label>
            <onclick>ActivateWindow(Videos,MovieGenres,return)</onclick>
        </control>
        <control type="button" id="90165">
            <include>ButtonHomeSubCommonValues</include>
            <label>652</label>
            <onclick>ActivateWindow(Videos,MovieYears,return)</onclick>
        </control>
        <control type="button" id="90166">
            <include>ButtonHomeSubCommonValues</include>
            <label>344</label>
            <onclick>ActivateWindow(Videos,MovieActors,return)</onclick>
        </control>
        <!-- Random Movie Mod -->
        <control type="button" id="90167">
            <include>ButtonHomeSubCommonValues</include>
            <label>Random Movie</label>
            <onclick>RunScript(script.randommovie,prompt=True)</onclick>
            <visible>System.HasAddon(script.randommovie)</visible>
        </control>        
        <control type="image" id="90168">
            <width>35</width>
            <height>35</height>
            <texture border="0,0,0,3">HomeSubEnd.png</texture>
        </control>
    </include>
Reply
#13
fmronan Wrote:I hope it is possible to change your script in order to make a sort of film using a playlist?

Hi fmronan.

I'm not sure I understand what you want to do. Can you explain a bit more?

el_P
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#14
FYI I will be working on some new features to include in the script: e.g. playing x random trailers and then user being able to select which film to watch, adding random music option (e.g. by genre), etc.

(I take no credit for the ideas, they came from PatrickBateman in the Cirrus forum).

I also need to update for the latest changes to JSON-RPC so that the script will be Eden ready.

I am unlikely to do any further work to the Dharma version of the script.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#15
google translation:
I would be able to view the film at random contained in a video playlist
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 7
  •   



Logout Mark Read Team Forum Stats Members Help
Random Movie script for skins0
This forum uses Lukasz Tkacz MyBB addons.