The branch, frodo has been updated
via 0d7bf200b2ae96d131d56cba6f0c6577fc58f646 (commit)
from 57fe7ffb76b96bf291fdc1431525a40444f97643 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=0d7bf200b2ae96d131d56cba6f0c6577fc58f646
commit 0d7bf200b2ae96d131d56cba6f0c6577fc58f646
Author: beenje <[email protected]>
Date: Thu Jun 13 21:38:09 2013 +0200
[script.randomtrailers] updated to version 1.0.5
diff --git a/script.randomtrailers/addon.xml b/script.randomtrailers/addon.xml
index f04d5fa..693ce74 100644
--- a/script.randomtrailers/addon.xml
+++ b/script.randomtrailers/addon.xml
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.randomtrailers"
name="Random Trailers"
- version="1.0.3"
+ version="1.0.5"
provider-name="kzeleny">
<requires>
<import addon="xbmc.python"
version="2.1.0"/>
<import addon="xbmc.addon"
version="12.0.0"/>
<import addon="script.module.simplejson" version="2.0.10"/>
+ <import addon="script.module.elementtree" version="1.2.7" />
</requires>
<extension point="xbmc.python.script"
library="default.py" />
<provides>executable</provides>
@@ -14,11 +15,11 @@
<language></language>
<platform>all</platform>
<summary lang="en">Random Trailer Player</summary>
- <description lang="en">Plays a random movie trailers from user's library.
Allows you to filter by genre if desired. Options to select number fo trailers
and to display opening / closing animationdescription </description>
+ <description lang="en">Plays a random movie trailers from user's library.
Allows you to filter by genre if desired. Options to select number fo trailers
and to display opening / closing animation. When viewing trailers you can press
I to view movie information, or Enter to watch current movie.</description>
<license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
- <forum></forum>
+ <forum>http://forum.xbmc.org/showthread.php?tid=166374</forum>
<website></website>
<email>[email protected]</email>
- <source>"https://github.com/kzeleny/script.randomtrailers"</source>
+ <source>https://github.com/kzeleny/script.randomtrailers</source>
</extension>
</addon>
diff --git a/script.randomtrailers/changelog.txt
b/script.randomtrailers/changelog.txt
index b1676c0..d7583df 100644
--- a/script.randomtrailers/changelog.txt
+++ b/script.randomtrailers/changelog.txt
@@ -1,9 +1,18 @@
-v1.0.3 (June, 4, 2013) :
+v1.0.5 (June 12, 2013) :
+ - fixed module import issues. fixed font issues
+
+v1.0.4 (June 10, 2013) :
+ - improved movie information screen
+ - added feature and setting to exclude recently watched movies from
trailers. Set to number of days after movie
+ has been played before including in trailers
+
+v1.0.3 (June 4, 2013) :
- added setting to hide movie info during playback of trailer
+ press I during playback of trailer to toggle info display
-v1.0.2 (June, 3, 2013) :
+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
+ - added feature to allow user to press esc to exit, or X to quit trailer but
play remaining.
v1.0.1 (May 30, 2013)
- added option to not ask for genre filter
diff --git a/script.randomtrailers/default.py b/script.randomtrailers/default.py
index f3e8dd1..59d6e73 100644
--- a/script.randomtrailers/default.py
+++ b/script.randomtrailers/default.py
@@ -1,7 +1,7 @@
# Random trailer player
#
# Author - kzeleny
-# Version - 1.0.2
+# Version - 1.0.4
# Compatibility - Frodo
#
@@ -14,15 +14,17 @@ import os
import random
import simplejson as json
import time
+import datetime
import xbmcaddon
+import MyFont
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)
-
addon_path = addon.getAddonInfo('path')
+hide_watched = addon.getSetting('hide_watched')
+watched_days = addon.getSetting('watched_days')
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,
'OpenSequence.mp4' ) ).decode('utf-8')
@@ -31,6 +33,14 @@ selectedGenre =''
exit_requested = False
movie_file = ''
+# Emulate Confluence fonts
+MyFont.addFont( "addon_font12" , "arial.ttf" , "15")
+MyFont.addFont( "addon_font13" , "arial.ttf" , "18")
+MyFont.addFont( "addon_font14" , "arial.ttf" , "20")
+MyFont.addFont( "addon_font15" , "arial.ttf" , "22")
+MyFont.addFont( "addon_font35_title" , "arial.ttf" , "33" , style = "bold")
+trailer=''
+do_timeout = False
def askGenres():
# default is to select from all movies
selectGenre = False
@@ -73,56 +83,51 @@ def selectGenre():
def getTrailers(genre):
# get the raw JSON output
- 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 = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMovies", "params": {"properties": ["title", "lastplayed",
"studio", "writer", "plot", "votes", "top250", "originaltitle", "director",
"tagline", "fanart", "runtime", "mpaa", "rating", "thumbnail", "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"])
+ trailers = json.loads(trailerstring)
return trailers
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)
+ global trailer
+ global do_timeout
+ trailer=random.choice(trailers["result"]["movies"])
+ lastPlay = True
+ if not trailer["lastplayed"] =='' and hide_watched == 'true':
+ pd=time.strptime(trailer["lastplayed"],'%Y-%m-%d
%H:%M:%S')
+ pd = time.mktime(pd)
+ pd = datetime.datetime.fromtimestamp(pd)
+ lastPlay = datetime.datetime.now() - pd
+ lastPlay = lastPlay.days
+ if lastPlay > int(watched_days) or watched_days == '0':
+ lastPlay = True
+ else:
+ lastPlay = False
+ if trailer["trailer"] != '' and lastPlay:
+ if hide_info == 'false':
+
w=infoWindow('script-DialogVideoInfo.xml',addon_path,'default')
+ do_timeout=True
+ w.doModal()
+ do_timeout=False
+ del w
+ if exit_requested:
+ xbmc.Player().stop()
+ else:
+ xbmc.Player().play(trailer["trailer"])
+ self.getControl(30011).setLabel(trailer["title"] + ' -
' + str(trailer["year"]))
+ self.getControl(30011).setVisible(True)
+ while xbmc.Player().isPlaying():
+ xbmc.sleep(250)
self.close()
def onAction(self, action):
ACTION_PREVIOUS_MENU = 10
ACTION_ENTER = 7
-
+ ACTION_I = 11
+ #xbmc.log('action =' + str(action.getId()))
global exit_requested
global movie_file
if action == ACTION_PREVIOUS_MENU:
@@ -131,15 +136,104 @@ class movieWindow(xbmcgui.WindowXMLDialog):
self.close()
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
+ movie_file = trailer["file"]
+ self.getControl(30011).setVisible(False)
self.close()
+
+ if action == ACTION_I:
+ self.getControl(30011).setVisible(False)
+
w=infoWindow('script-DialogVideoInfo.xml',addon_path,'default')
+ w.doModal()
+ self.getControl(30011).setVisible(True)
+class infoWindow(xbmcgui.WindowXMLDialog):
+
+ def onInit(self):
+ self.getControl(30001).setImage(trailer["thumbnail"])
+ self.getControl(30003).setImage(trailer["fanart"])
+ self.getControl(30002).setLabel(trailer["title"])
+ self.getControl(30012).setLabel(trailer["tagline"])
+ self.getControl(30004).setLabel(trailer["originaltitle"])
+ directors = trailer["director"]
+ movieDirector=''
+ for director in directors:
+ movieDirector = movieDirector + director + ', '
+ if not movieDirector =='':
+ movieDirector = movieDirector[:-2]
+ self.getControl(30005).setLabel(movieDirector)
+ writers = trailer["writer"]
+ movieWriter=''
+ for writer in writers:
+ movieWriter = movieWriter + writer + ', '
+ if not movieWriter =='':
+ movieWriter = movieWriter[:-2]
+ self.getControl(30006).setLabel(movieWriter)
+ strImdb=''
+ if not trailer["top250"] == 0:
+ strImdb = ' - IMDB Top 250:' + str(trailer["top250"])
+ self.getControl(30007).setLabel(str(round(trailer["rating"],2))
+ ' (' + str(trailer["votes"]) + ' votes)' + strImdb)
+ self.getControl(30009).setText(trailer["plot"])
+ movieStudio=''
+ studios=trailer["studio"]
+ for studio in studios:
+ movieStudio = movieStudio + studio + ', '
+ if not movieStudio =='':
+ movieStudio = movieStudio[:-2]
+ self.getControl(30010).setLabel(movieStudio + ' - ' +
str(trailer["year"]))
+ movieGenre=''
+ genres = trailer["genre"]
+ for genre in genres:
+ movieGenre = movieGenre + genre + ' / '
+ if not movieGenre =='':
+ movieGenre = movieGenre[:-3]
+ self.getControl(30011).setLabel(str(trailer["runtime"] / 60) +
' Minutes - ' + movieGenre)
+ imgRating='ratings/notrated.png'
+ if trailer["mpaa"].startswith('G'): imgRating='ratings/g.png'
+ if trailer["mpaa"] == ('G'): imgRating='ratings/g.png'
+ if trailer["mpaa"].startswith('Rated G'):
imgRating='ratings/g.png'
+ if trailer["mpaa"].startswith('PG '): imgRating='ratings/pg.png'
+ if trailer["mpaa"] == ('PG'): imgRating='ratings/pg.png'
+ if trailer["mpaa"].startswith('Rated PG'):
imgRating='ratings/pg.png'
+ if trailer["mpaa"].startswith('PG-13 '):
imgRating='ratings/pg13.png'
+ if trailer["mpaa"] == ('PG-13'): imgRating='ratings/pg13.png'
+ if trailer["mpaa"].startswith('Rated PG-13'):
imgRating='ratings/pg13.png'
+ if trailer["mpaa"].startswith('R '): imgRating='ratings/r.png'
+ if trailer["mpaa"] == ('R'): imgRating='ratings/r.png'
+ if trailer["mpaa"].startswith('Rated R'):
imgRating='ratings/r.png'
+ if trailer["mpaa"].startswith('NC17'):
imgRating='ratings/nc17.png'
+ if trailer["mpaa"].startswith('Rated NC17'):
imgRating='ratings/nc1.png'
+ self.getControl(30013).setImage(imgRating)
+ if do_timeout:
+ xbmc.sleep(2500)
+ xbmc.Player().play(trailer["trailer"])
+ self.close()
+
+ def onAction(self, action):
+ ACTION_PREVIOUS_MENU = 10
+ ACTION_ENTER = 7
+ ACTION_I = 11
+ #xbmc.log('action =' + str(action.getId()))
+ if action == ACTION_PREVIOUS_MENU:
+ global do_timeout
+ global exit_requested
+ do_timeout=False
+ xbmc.Player().stop()
+ exit_requested=True
+ self.close()
+
+ if action == ACTION_I:
+ self.close()
+
+ if action == ACTION_ENTER:
+ global movie_file
+ global exit_requested
+ movie_file = trailer["file"]
+ xbmc.Player().stop()
+ exit_requested=True
+ self.close()
+
class blankscreen(xbmcgui.Window):
def __init__(self,):
pass
@@ -148,10 +242,11 @@ class XBMCPlayer(xbmc.Player):
def __init__( self, *args, **kwargs ):
pass
def onPlayBackStarted(self):
- xbmc.log( 'Playbackstarted' )
+ pass
def onPlayBackStopped(self):
global exit_requested
+ pass
def playTrailers():
bs=blankscreen()
@@ -161,7 +256,7 @@ def playTrailers():
movie_file = ''
exit_requested = False
player = XBMCPlayer()
- xbmc.log('Getting Trailers')
+ #xbmc.log('Getting Trailers')
DO_CURTIANS = addon.getSetting('do_animation')
DO_EXIT = addon.getSetting('do_exit')
NUMBER_TRAILERS = int(addon.getSetting('number_trailers'))
diff --git a/script.randomtrailers/resources/language/English/strings.xml
b/script.randomtrailers/resources/language/English/strings.xml
index b59404e..4161ec0 100644
--- a/script.randomtrailers/resources/language/English/strings.xml
+++ b/script.randomtrailers/resources/language/English/strings.xml
@@ -5,4 +5,6 @@
<string id="32001">Play Opening and Closing Animation</string>
<string id="32002">Filter by Genre</string>
<string id="32003">Hide Movie Info</string>
+ <string id="32004">Hide Trailers of Watched Movie</string>
+ <string id="32005">Number of Days to Hide Trailers</string>
</strings>
diff --git a/script.randomtrailers/resources/settings.xml
b/script.randomtrailers/resources/settings.xml
index d4e19b2..53adb84 100644
--- a/script.randomtrailers/resources/settings.xml
+++ b/script.randomtrailers/resources/settings.xml
@@ -4,4 +4,6 @@
<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" />
+ <setting id="hide_watched" type="bool" label="32004" default="false" />
+ <setting id="watched_days" type="number" enable="!eq(-1,false)"
label="32005" default="365" />
</settings>
diff --git
a/script.randomtrailers/resources/skins/default/720p/script-trailerwindow.xml
b/script.randomtrailers/resources/skins/default/720p/script-trailerwindow.xml
index e326a1d..ac65bfa 100644
---
a/script.randomtrailers/resources/skins/default/720p/script-trailerwindow.xml
+++
b/script.randomtrailers/resources/skins/default/720p/script-trailerwindow.xml
@@ -1,30 +1,16 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<window type="window">
<controls>
- <control type="label" id="30002">
- <description>Label for movie title</description>
+ <control type="label" id="30011">
+ <description>Move Name</description>
<posx>20</posx>
<posy>20</posy>
- <width>auto</width>
- <animation effect="fade"
time="500">VisibleChange</animation>
+ <width>680</width>
<height>20</height>
<align>left</align>
<aligny>center</aligny>
<textcolor>FFFFFFFF</textcolor>
<shadowcolor>black</shadowcolor>
- </control>
- <control type="label" id="30003">
- <description>Label for movie title</description>
- <posx>20</posx>
- <posy>20</posy>
- <width>auto</width>
- <height>20</height>
- <animation effect="fade"
time="500">VisibleChange</animation>
- <label>Press ESC to quit, Enter to Play Movie</label>
- <align>left</align>
- <aligny>center</aligny>
- <textcolor>FFFFFFFF</textcolor>
- <shadowcolor>black</shadowcolor>
- </control>
+ </control>
</controls>
</window>
-----------------------------------------------------------------------
Summary of changes:
script.randomtrailers/MyFont.py | 110 ++++++++
script.randomtrailers/addon.xml | 9 +-
script.randomtrailers/changelog.txt | 15 +-
script.randomtrailers/default.py | 193 ++++++++++----
script.randomtrailers/resources/fonts/arial.ttf | Bin 0 -> 778552 bytes
.../resources/language/English/strings.xml | 2 +
.../resources/media/CurtainClosingSequence.flv | Bin 198038 -> 0 bytes
.../resources/media/CurtainOpeningSequence.flv | Bin 557673 -> 0 bytes
script.randomtrailers/resources/settings.xml | 2 +
.../skins/default/720p/script-DialogVideoInfo.xml | 283 ++++++++++++++++++++
.../skins/default/720p/script-trailerwindow.xml | 22 +--
.../resources/skins/default/media/background.png | Bin 0 -> 782770 bytes
.../resources/skins/default/media/black.png | Bin 0 -> 2814 bytes
.../skins/default/media/info/ButtonFo.png | Bin 0 -> 3683 bytes
.../skins/default/media/info/ButtonFoLong.png | Bin 0 -> 3810 bytes
.../skins/default/media/info/fandiffuse.png | Bin 0 -> 4680 bytes
.../resources/skins/default/media/info/framebg.png | Bin 0 -> 5689 bytes
.../skins/default/media/info/glassoverlay.png | Bin 0 -> 12895 bytes
.../resources/skins/default/media/info/infobar.png | Bin 0 -> 3222 bytes
.../skins/default/media/info/infobar2.png | Bin 0 -> 4062 bytes
.../resources/skins/default/media/info/line.png | Bin 0 -> 2810 bytes
.../skins/default/media/info/posterbg.png | Bin 0 -> 2533 bytes
.../skins/default/media/info/posterbg2.png | Bin 0 -> 4747 bytes
.../resources/skins/default/media/info/preview.jpg | Bin 0 -> 14956 bytes
.../resources/skins/default/media/info/tab.png | Bin 0 -> 3144 bytes
.../skins/default/media/info/trailerback.png | Bin 0 -> 3015 bytes
.../resources/skins/default/media/noposter.png | Bin 0 -> 318085 bytes
.../resources/skins/default/media/ratings/g.png | Bin 0 -> 7726 bytes
.../resources/skins/default/media/ratings/nc17.png | Bin 0 -> 7986 bytes
.../skins/default/media/ratings/notrated.png | Bin 0 -> 12388 bytes
.../resources/skins/default/media/ratings/pg.png | Bin 0 -> 8120 bytes
.../resources/skins/default/media/ratings/pg13.png | Bin 0 -> 8049 bytes
.../resources/skins/default/media/ratings/r.png | Bin 0 -> 7323 bytes
.../resources/skins/default/media/white.png | Bin 0 -> 2814 bytes
34 files changed, 562 insertions(+), 74 deletions(-)
create mode 100644 script.randomtrailers/MyFont.py
create mode 100644 script.randomtrailers/resources/fonts/arial.ttf
delete mode 100644
script.randomtrailers/resources/media/CurtainClosingSequence.flv
delete mode 100644
script.randomtrailers/resources/media/CurtainOpeningSequence.flv
create mode 100644
script.randomtrailers/resources/skins/default/720p/script-DialogVideoInfo.xml
create mode 100644
script.randomtrailers/resources/skins/default/media/background.png
create mode 100644
script.randomtrailers/resources/skins/default/media/black.png
create mode 100644
script.randomtrailers/resources/skins/default/media/info/ButtonFo.png
create mode 100644
script.randomtrailers/resources/skins/default/media/info/ButtonFoLong.png
create mode 100644
script.randomtrailers/resources/skins/default/media/info/fandiffuse.png
create mode 100644
script.randomtrailers/resources/skins/default/media/info/framebg.png
create mode 100644
script.randomtrailers/resources/skins/default/media/info/glassoverlay.png
create mode 100644
script.randomtrailers/resources/skins/default/media/info/infobar.png
create mode 100644
script.randomtrailers/resources/skins/default/media/info/infobar2.png
create mode 100644
script.randomtrailers/resources/skins/default/media/info/line.png
create mode 100644
script.randomtrailers/resources/skins/default/media/info/posterbg.png
create mode 100644
script.randomtrailers/resources/skins/default/media/info/posterbg2.png
create mode 100644
script.randomtrailers/resources/skins/default/media/info/preview.jpg
create mode 100644
script.randomtrailers/resources/skins/default/media/info/tab.png
create mode 100644
script.randomtrailers/resources/skins/default/media/info/trailerback.png
create mode 100644
script.randomtrailers/resources/skins/default/media/noposter.png
create mode 100644
script.randomtrailers/resources/skins/default/media/ratings/g.png
create mode 100644
script.randomtrailers/resources/skins/default/media/ratings/nc17.png
create mode 100644
script.randomtrailers/resources/skins/default/media/ratings/notrated.png
create mode 100644
script.randomtrailers/resources/skins/default/media/ratings/pg.png
create mode 100644
script.randomtrailers/resources/skins/default/media/ratings/pg13.png
create mode 100644
script.randomtrailers/resources/skins/default/media/ratings/r.png
create mode 100644
script.randomtrailers/resources/skins/default/media/white.png
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons