The branch, frodo has been updated
via afdbd514635af42d4d346ce7d7190a2591180a25 (commit)
from 7da9a42b86ddee56e17b20b8e3660887de3dfc58 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=afdbd514635af42d4d346ce7d7190a2591180a25
commit afdbd514635af42d4d346ce7d7190a2591180a25
Author: beenje <[email protected]>
Date: Tue Jun 4 22:48:28 2013 +0200
[script.randomtrailers] updated to version 1.0.3
diff --git a/script.randomtrailers/addon.xml b/script.randomtrailers/addon.xml
index 90dcd70..f04d5fa 100644
--- a/script.randomtrailers/addon.xml
+++ b/script.randomtrailers/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="script.randomtrialers"
+<addon id="script.randomtrailers"
name="Random Trailers"
- version="1.0.0"
+ version="1.0.3"
provider-name="kzeleny">
<requires>
<import addon="xbmc.python"
version="2.1.0"/>
diff --git a/script.randomtrailers/changelog.txt
b/script.randomtrailers/changelog.txt
index a428187..b1676c0 100644
--- a/script.randomtrailers/changelog.txt
+++ b/script.randomtrailers/changelog.txt
@@ -1,2 +1,12 @@
+v1.0.3 (June, 4, 2013) :
+ - added setting to hide movie info during playback of trailer
+
+v1.0.2 (June, 3, 2013) :
+ - added feature to allow playing movie of currently playing trailer by
pressing enter while trailer is playing
+ - added feature to allow user to press esc to quit currently running trailer
+
+v1.0.1 (May 30, 2013)
+ - added option to not ask for genre filter
+
v1.0.0 (May 27, 2013) :
- initial release, includes opitons for selecting genre, nubmer trailers,
and to display open and close animation.
diff --git a/script.randomtrailers/default.py b/script.randomtrailers/default.py
index 092c35f..f3e8dd1 100644
--- a/script.randomtrailers/default.py
+++ b/script.randomtrailers/default.py
@@ -1,7 +1,7 @@
# Random trailer player
#
# Author - kzeleny
-# Version - 1.0.1
+# Version - 1.0.2
# Compatibility - Frodo
#
@@ -18,16 +18,18 @@ import xbmcaddon
addon = xbmcaddon.Addon()
number_trailers = addon.getSetting('number_trailers')
do_curtains = addon.getSetting('do_animation')
-
+do_genre = addon.getSetting('do_genre')
+hide_info = addon.getSetting('hide_info')
xbmc.log('do curtains = ' + do_curtains)
-path = addon.getAddonInfo('path')
-resources_path = xbmc.translatePath( os.path.join( path, 'resources' )
).decode('utf-8')
+addon_path = addon.getAddonInfo('path')
+resources_path = xbmc.translatePath( os.path.join( addon_path, 'resources' )
).decode('utf-8')
media_path = xbmc.translatePath( os.path.join( resources_path, 'media' )
).decode('utf-8')
-open_curtain_path = xbmc.translatePath( os.path.join( media_path,
'CurtainOpeningSequence.flv' ) ).decode('utf-8')
-close_curtain_path = xbmc.translatePath( os.path.join( media_path,
'CurtainClosingSequence.flv' ) ).decode('utf-8')
-
-
+open_curtain_path = xbmc.translatePath( os.path.join( media_path,
'OpenSequence.mp4' ) ).decode('utf-8')
+close_curtain_path = xbmc.translatePath( os.path.join( media_path,
'ClosingSequence.mp4' ) ).decode('utf-8')
+selectedGenre =''
+exit_requested = False
+movie_file = ''
def askGenres():
# default is to select from all movies
@@ -44,12 +46,12 @@ def selectGenre():
success = False
selectedGenre = ""
myGenres = []
-
+ trailerstring = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMovies", "params": { "properties": ["genre", "playcount",
"file", "trailer"]}, "id": 1}')
+ trailerstring = unicode(trailerstring, 'utf-8', errors='ignore')
+ trailers = json.loads(trailerstring)
for movie in trailers["result"]["movies"]:
# Let's get the movie genres
- # If we're only looking at unwatched movies then restrict list to those
movies
genres = movie["genre"]
- # genres = movie["genre"].split(" / ")
for genre in genres:
# check if the genre is a duplicate
if not genre in myGenres:
@@ -69,47 +71,134 @@ def selectGenre():
# return the genre and whether the choice was successfult
return success, selectedGenre
-def getTrailers():
+def getTrailers(genre):
# get the raw JSON output
- trailerstring = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMovies", "params": { "properties": ["genre", "playcount",
"file", "trailer"]}, "id": 1}')
+ xbmc.log('selected genre = ' + genre)
+ trailerstring = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMovies", "params": {"properties": ["title", "file", "year",
"genre", "trailer"], "filter": {"field": "genre", "operator": "contains",
"value": "%s"}}, "id": 1}' % genre)
trailerstring = unicode(trailerstring, 'utf-8', errors='ignore')
trailers = json.loads(trailerstring)
+ random.shuffle(trailers["result"]["movies"])
return trailers
-def getTrailerList(filterGenre,genre):
- moviegenre = []
- trailerList =[]
- for trailer in trailers["result"]["movies"]:
- trailergenre = trailer["genre"]
- if not trailer["trailer"] == '':
- if ( filterGenre and genre in trailergenre ) or not
filterGenre:
- trailerList.append(trailer["trailer"])
- return trailerList
+class movieWindow(xbmcgui.WindowXMLDialog):
+
+ def onInit(self):
+ global SelectedGenre
+ player = XBMCPlayer()
+ self.play_control = self.getControl(30003)
+ self.name_control = self.getControl(30002)
+ self.name_control.setVisible(False)
+ self.play_control.setVisible(False)
+ DO_MUTE = addon.getSetting('do_mute')
+ DO_EXIT = addon.getSetting('do_exit')
+ trailers = getTrailers(selectedGenre)
+ movieTrailer =''
+ sanity =0
+ while movieTrailer == '':
+ sanity = sanity + 1
+ trailer=random.choice(trailers["result"]["movies"])
+ if not trailer["trailer"] == '':
+ movieYear = trailer["year"]
+ self.movieFile = trailer["file"]
+ movieTrailer = trailer["trailer"]
+ movieTitle = trailer["title"]
+ self.name_control.setLabel(movieTitle + ' - ' +
str(movieYear))
+ if sanity == 100:
+ break
+ if not movieTrailer == '':
+ player.play(movieTrailer)
+ while player.isPlaying():
+ if hide_info == 'false':
+ nameVisible =
xbmc.getCondVisibility("Control.IsVisible(30002)")
+ if nameVisible:
+
self.name_control.setVisible(False)
+
self.play_control.setVisible(True)
+ else:
+
self.play_control.setVisible(False)
+
self.name_control.setVisible(True)
+ xbmc.sleep(3000)
+ self.close()
+
+ def onAction(self, action):
+ ACTION_PREVIOUS_MENU = 10
+ ACTION_ENTER = 7
-trailers = getTrailers()
+ global exit_requested
+ global movie_file
+ if action == ACTION_PREVIOUS_MENU:
+ xbmc.Player().stop()
+ exit_requested = True
+ self.close()
-filtergenre = askGenres()
+ if action == ACTION_ENTER:
+ self.play_control = self.getControl(30003)
+ self.name_control = self.getControl(30002)
+ self.removeControl(self.play_control)
+ self.removeControl(self.name_control)
+ exit_requested = True
+ xbmc.Player().stop()
+ movie_file = self.movieFile
+ self.close()
+
+class blankscreen(xbmcgui.Window):
+ def __init__(self,):
+ pass
+
+class XBMCPlayer(xbmc.Player):
+ def __init__( self, *args, **kwargs ):
+ pass
+ def onPlayBackStarted(self):
+ xbmc.log( 'Playbackstarted' )
+
+ def onPlayBackStopped(self):
+ global exit_requested
+
+def playTrailers():
+ bs=blankscreen()
+ bs.show()
+ global exit_requested
+ global movie_file
+ movie_file = ''
+ exit_requested = False
+ player = XBMCPlayer()
+ xbmc.log('Getting Trailers')
+ DO_CURTIANS = addon.getSetting('do_animation')
+ DO_EXIT = addon.getSetting('do_exit')
+ NUMBER_TRAILERS = int(addon.getSetting('number_trailers'))
+ if DO_CURTIANS == 'true':
+ player.play(open_curtain_path)
+ while player.isPlaying():
+ xbmc.sleep(250)
+ trailercount = 0
+ while not exit_requested:
+ for x in xrange(0, NUMBER_TRAILERS):
+ myMovieWindow = movieWindow('script-trailerwindow.xml',
addon_path,'default',)
+ myMovieWindow.doModal()
+ del myMovieWindow
+ if exit_requested:
+ break
+ if not exit_requested:
+ if DO_CURTIANS == 'true':
+ player.play(close_curtain_path)
+ while player.isPlaying():
+ xbmc.sleep(250)
+ exit_requested=True
+ if not movie_file == '':
+ xbmc.Player(0).play(movie_file)
+ movie_file = ''
+ del bs
+
+filtergenre = False
+if do_genre == 'true':
+ filtergenre = askGenres()
+
success = False
if filtergenre:
success, selectedGenre = selectGenre()
if success:
- trailerList = getTrailerList(True, selectedGenre)
+ trailers = getTrailers(selectedGenre)
else:
- trailerList = getTrailerList(False,"")
-
-random.shuffle(trailerList)
-playlist = xbmc.PlayList(0)
-playlist.clear()
-trailercount = 0
-if do_curtains == 'true':
- playlist.add(open_curtain_path)
-for trailer in trailerList:
+ trailers = getTrailers("")
- trailercount = trailercount +1
- playlist.add(trailer)
- if trailercount == int(number_trailers):
- break
-if do_curtains == 'true':
- playlist.add(close_curtain_path)
-xbmc.Player().play(playlist)
+playTrailers()
diff --git a/script.randomtrailers/resources/language/English/strings.xml
b/script.randomtrailers/resources/language/English/strings.xml
index 2cc1075..b59404e 100644
--- a/script.randomtrailers/resources/language/English/strings.xml
+++ b/script.randomtrailers/resources/language/English/strings.xml
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
- <!-- All %s must remain in string but can change position -->
- <string id="32000">Number Of Trailers to Play</string>
+ <!-- All %s must remain in string but can change position -->
+ <string id="32000">Number Of Trailers to Play</string>
<string id="32001">Play Opening and Closing Animation</string>
+ <string id="32002">Filter by Genre</string>
+ <string id="32003">Hide Movie Info</string>
</strings>
diff --git a/script.randomtrailers/resources/settings.xml
b/script.randomtrailers/resources/settings.xml
index 2ef0ae1..d4e19b2 100644
--- a/script.randomtrailers/resources/settings.xml
+++ b/script.randomtrailers/resources/settings.xml
@@ -2,4 +2,6 @@
<settings>
<setting id="number_trailers" type="number" label="32000" default="10" />
<setting id="do_animation" type="bool" label="32001" default="true" />
+ <setting id="do_genre" type="bool" label="32002" default="true" />
+ <setting id="hide_info" type="bool" label="32003" default="false" />
</settings>
-----------------------------------------------------------------------
Summary of changes:
script.randomtrailers/.gitignore | 215 --------------------
script.randomtrailers/addon.xml | 4 +-
script.randomtrailers/changelog.txt | 10 +
script.randomtrailers/default.py | 171 ++++++++++++----
.../resources/language/English/strings.xml | 6 +-
.../resources/media/ClosingSequence.mp4 | Bin 0 -> 1197799 bytes
.../resources/media/OpenSequence.mp4 | Bin 0 -> 897954 bytes
script.randomtrailers/resources/settings.xml | 2 +
.../skins/default/720p/script-trailerwindow.xml | 30 +++
9 files changed, 178 insertions(+), 260 deletions(-)
delete mode 100644 script.randomtrailers/.gitignore
create mode 100644 script.randomtrailers/resources/media/ClosingSequence.mp4
create mode 100644 script.randomtrailers/resources/media/OpenSequence.mp4
create mode 100644
script.randomtrailers/resources/skins/default/720p/script-trailerwindow.xml
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons