Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

3.0.4

  • Loading branch information...
commit 510830bfcd927d2447601ab316e52ad20f1928ce 1 parent 22ba643
@Giftie authored
View
3  addon.py
@@ -152,12 +152,11 @@
prev_trigger = ""
script_header = "[ %s ]" % __scriptID__
-from ce_playlist import _get_special_items, build_music_playlist, _rebuild_playlist
+from ce_playlist import _get_special_items, build_music_playlist, _rebuild_playlist, _store_playlist, _get_queued_video_info
from slides import _fetch_slides
from new_trailer_downloader import downloader
from utils import settings_to_log
from launch_automation import Launch_automation
-from pre_eden_code import _store_playlist, _get_queued_video_info
#Check to see if module is moved to /userdata/addon_data/script.cinema.experience
if not xbmcvfs.exists( os.path.join( BASE_CURRENT_SOURCE_PATH, "ha_scripts", "home_automation.py" ) ) and ha_settings[ "ha_enable" ]:
View
2  addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.cinema.experience"
name="Cinema Experience"
- version="3.0.3"
+ version="3.0.4"
provider-name="Giftie - nuka1195">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
View
17 changelog.txt
@@ -1,12 +1,17 @@
+3.0.4
+- fix - setting error for a single music file during trivia
+- change - code clean up
+- add - FSK Ratings added, along with converting to near MPAA rating
+
3.0.3
-- fix - Coming Attraction Intro Videos
-- fix - removed code that could cause the music library to flash after trivia
-- add - give user the ability to diable YouTube(or any plug-in required) Trailers
-- fix - stop downloader from trying to download local trailers
+- fix - Coming Attraction Intro Videos
+- fix - removed code that could cause the music library to flash after trivia
+- add - give user the ability to diable YouTube(or any plug-in required) Trailers
+- fix - stop downloader from trying to download local trailers
3.0.2
-- fix - make sure home_automation.py is moved in service.py if it does not exist
-- fix - have script wait until full screen video is playing before detecting a stop, should fix when XBMC is slow to start
+- fix - make sure home_automation.py is moved in service.py if it does not exist
+- fix - have script wait until full screen video is playing before detecting a stop, should fix when XBMC is slow to start
3.0.1
- fix - more HTTP-API calls removed(none should be left in functioning code)
View
46 resources/lib/ce_player.py
@@ -7,41 +7,39 @@
false = False
null = None
-__script__ = sys.modules[ "__main__" ].__script__
-__scriptID__ = sys.modules[ "__main__" ].__scriptID__
-triggers = sys.modules[ "__main__" ].triggers
-trivia_settings = sys.modules[ "__main__" ].trivia_settings
-trailer_settings = sys.modules[ "__main__" ].trailer_settings
-video_settings = sys.modules[ "__main__" ].video_settings
-feature_settings = sys.modules[ "__main__" ].feature_settings
-ha_settings = sys.modules[ "__main__" ].ha_settings
-extra_settings = sys.modules[ "__main__" ].extra_settings
-
-_A_ = xbmcaddon.Addon( __scriptID__ )
+__script__ = sys.modules[ "__main__" ].__script__
+__scriptID__ = sys.modules[ "__main__" ].__scriptID__
+triggers = sys.modules[ "__main__" ].triggers
+trivia_settings = sys.modules[ "__main__" ].trivia_settings
+trailer_settings = sys.modules[ "__main__" ].trailer_settings
+video_settings = sys.modules[ "__main__" ].video_settings
+feature_settings = sys.modules[ "__main__" ].feature_settings
+ha_settings = sys.modules[ "__main__" ].ha_settings
+extra_settings = sys.modules[ "__main__" ].extra_settings
+BASE_CACHE_PATH = sys.modules["__main__"].BASE_CACHE_PATH
+BASE_RESOURCE_PATH = sys.modules["__main__"].BASE_RESOURCE_PATH
+BASE_CURRENT_SOURCE_PATH = sys.modules["__main__"].BASE_CURRENT_SOURCE_PATH
+__addon__ = xbmcaddon.Addon( __scriptID__ )
# language method
-_L_ = _A_.getLocalizedString
+__language__ = __addon__.getLocalizedString
number_of_features = feature_settings[ "number_of_features" ] + 1
playback = ""
-BASE_CACHE_PATH = os.path.join( xbmc.translatePath( "special://profile" ).decode('utf-8'), "Thumbnails", "Video" )
-BASE_CURRENT_SOURCE_PATH = os.path.join( xbmc.translatePath( "special://profile/addon_data/" ).decode('utf-8'), os.path.basename( _A_.getAddonInfo('path') ) )
-BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( _A_.getAddonInfo('path').decode('utf-8'), 'resources' ) )
sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )
-headings = ( _L_(32600), _L_(32601), _L_(32602), _L_(32603), _L_(32604), _L_(32605), _L_(32606), _L_(32607), _L_(32608), _L_(32609), _L_(32610), _L_(32611), _L_(32612) )
+headings = ( __language__(32600), __language__(32601), __language__(32602), __language__(32603), __language__(32604), __language__(32605), __language__(32606), __language__(32607), __language__(32608), __language__(32609), __language__(32610), __language__(32611), __language__(32612) )
header = "Cinema Experience"
time_delay = 200
-image = xbmc.translatePath( os.path.join( _A_.getAddonInfo("path"), "icon.png") ).decode('utf-8')
+image = xbmc.translatePath( os.path.join( __addon__.getAddonInfo("path"), "icon.png") ).decode('utf-8')
playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )
is_paused = False
prev_trigger = ""
script_header = "[ %s ]" % __scriptID__
-from ce_playlist import _get_special_items, build_music_playlist, _rebuild_playlist
+from ce_playlist import _get_special_items, build_music_playlist, _rebuild_playlist, _store_playlist, _get_queued_video_info
from slides import _fetch_slides
from new_trailer_downloader import downloader
from utils import settings_to_log
from launch_automation import Launch_automation
-from pre_eden_code import _store_playlist, _get_queued_video_info
class Script():
def __init__(self, *args, **kwargs):
@@ -62,7 +60,7 @@ def start_script( self, library_view = "oldway" ):
while not xbmc.getCondVisibility( "Container.Content(movies)" ):
pass
if feature_settings[ "enable_notification" ]:
- xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header, _L_( 32546 ), 300000, image) )
+ xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header, __language__( 32546 ), 300000, image) )
# wait until playlist is full to the required number of features
xbmc.log( "[ script.cinema.experience ] - Waiting for queue to be filled with %s Feature films" % number_of_features, level=xbmc.LOGNOTICE )
count = 0
@@ -70,7 +68,7 @@ def start_script( self, library_view = "oldway" ):
if playlist.size() > count:
xbmc.log( "[ script.cinema.experience ] - User queued %s of %s Feature films" % (playlist.size(), number_of_features), level=xbmc.LOGNOTICE )
header1 = header + " - Feature " + "%d" % playlist.size()
- message = _L_( 32543 ) + playlist[playlist.size() -1].getdescription()
+ message = __language__( 32543 ) + playlist[playlist.size() -1].getdescription()
if feature_settings[ "enable_notification" ]:
xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header1, message, time_delay, image) )
count = playlist.size()
@@ -81,14 +79,14 @@ def start_script( self, library_view = "oldway" ):
xbmc.log( "[ script.cinema.experience ] - User queued %s Feature films" % playlist.size(), level=xbmc.LOGNOTICE )
if not early_exit:
header1 = header + " - Feature " + "%d" % playlist.size()
- message = _L_( 32543 ) + playlist[playlist.size() -1].getdescription()
+ message = __language__( 32543 ) + playlist[playlist.size() -1].getdescription()
if feature_settings[ "enable_notification" ]:
xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header1, message, time_delay, image) )
early_exit = False
# If for some reason the limit does not get reached and the window changed, cancel script
if playlist.size() < number_of_features and library_view != "oldway":
if feature_settings[ "enable_notification" ]:
- xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header, _L_( 32544 ), time_delay, image) )
+ xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % (header, __language__( 32544 ), time_delay, image) )
_clear_playlists()
else:
mpaa, audio, genre, movie, equivalent_mpaa = _get_queued_video_info( feature = 0 )
@@ -321,7 +319,7 @@ def _play_trivia( self, mpaa, genre, plist, equivalent_mpaa ):
from xbmcscript_trivia import Trivia
xbmc.log( "[ script.cinema.experience ] - Starting Trivia script", level=xbmc.LOGNOTICE )
Launch_automation().launch_automation( triggers[2] ) # Trivia Start
- ui = Trivia( "script-CExperience-trivia.xml", _A_.getAddonInfo('path'), "default", "720p" )
+ ui = Trivia( "script-CExperience-trivia.xml", __addon__.getAddonInfo('path'), "default", "720p" )
ui.doModal()
del ui
# we need to activate the video window
View
135 resources/lib/ce_playlist.py
@@ -1,38 +1,32 @@
# -*- coding: utf-8 -*-
+import traceback, os, re, sys
+from urllib import quote_plus
+from random import shuffle, random
__script__ = "Cinema Experience"
__scriptID__ = "script.cinema.experience"
__modname__ = "ce_playlist.py"
-import traceback, os, re, sys
import xbmc, xbmcaddon, xbmcgui
-from urllib import quote_plus
-from random import shuffle, random
log_message = "[ " + __scriptID__ + " ] - [ " + __modname__ + " ]"
-_A_ = xbmcaddon.Addon( __scriptID__ )
-# language method
-_L_ = _A_.getLocalizedString
-
-trivia_settings = sys.modules["__main__"].trivia_settings
-trailer_settings = sys.modules["__main__"].trailer_settings
-feature_settings = sys.modules["__main__"].feature_settings
-video_settings = sys.modules["__main__"].video_settings
-
+log_sep = "-"*70
-#tmp_paths = []
-BASE_CACHE_PATH = os.path.join( xbmc.translatePath( "special://profile" ), "Thumbnails", "Video" )
-BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( _A_.getAddonInfo('path'), 'resources' ) )
+trivia_settings = sys.modules[ "__main__" ].trivia_settings
+trailer_settings = sys.modules[ "__main__" ].trailer_settings
+feature_settings = sys.modules[ "__main__" ].feature_settings
+video_settings = sys.modules[ "__main__" ].video_settings
+BASE_CACHE_PATH = sys.modules[ "__main__" ].BASE_CACHE_PATH
+BASE_RESOURCE_PATH = sys.modules[ "__main__" ].BASE_RESOURCE_PATH
+BASE_CURRENT_SOURCE_PATH = sys.modules[ "__main__" ].BASE_CURRENT_SOURCE_PATH
sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )
from music import parse_playlist
-
-from pre_eden_code import _rebuild_playlist
+from json_utils import find_movie_details, retrieve_json_dict
+from utils import list_to_string
from xbmcvfs import exists as exists
from folder import dirEntries
-log_sep = "-"*70
-
def _get_trailers( items, equivalent_mpaa, mpaa, genre, movie, mode = "download" ):
xbmc.log( "[script.cinema.experience] - [ce_playlist.py] - _get_trailers started", level=xbmc.LOGDEBUG )
# return if not user preference
@@ -264,7 +258,7 @@ def build_music_playlist():
track_info, track_location = parse_playlist( saved_playlist, xbmc.getSupportedMedia('music') )
elif os.path.splitext( trivia_settings[ "trivia_music_file" ] )[1] in xbmc.getSupportedMedia('music'):
for track in range(100):
- track_location.append( trivia[ "trivia_music_file" ] )
+ track_location.append( trivia_settings[ "trivia_music_file" ] )
# otherwise
else:
if trivia_settings[ "trivia_music_folder" ]:
@@ -274,3 +268,104 @@ def build_music_playlist():
shuffle( track_location )
for track in track_location:
music_playlist.add( track, )
+
+def get_equivalent_rating( rating ):
+ if rating == "":
+ rating = "NR"
+ #MPAA
+ elif rating.startswith("Rated"):
+ rating = rating.split( " " )[ 1 - ( len( rating.split( " " ) ) == 1 ) ]
+ rating = ( rating, "NR", )[ rating not in ( "G", "PG", "PG-13", "R", "NC-17", "Unrated", ) ]
+ #BBFC
+ elif rating.startswith("UK"):
+ if rating.startswith( "UK:" ):
+ rating = rating.split( ":" )[ 1 - ( len( rating.split( ":" ) ) == 1 ) ]
+ else:
+ rating = rating.split( " " )[ 1 - ( len( rating.split( " " ) ) == 1 ) ]
+ rating = ( rating, "NR", )[ rating not in ( "12", "12A", "PG", "15", "18", "R18", "MA", "U", ) ]
+ elif rating.startswith("FSK"):
+ if rating.startswith( "FSK:" ):
+ rating = rating.split( ":" )[ 1 - ( len( rating.split( ":" ) ) == 1 ) ]
+ else:
+ rating = rating.split( " " )[ 1 - ( len( rating.split( " " ) ) == 1 ) ]
+ else:
+ rating = ( rating, "NR", )[ rating not in ( "0", "6", "12", "12A", "PG", "15", "16", "18", "R18", "MA", "U", ) ]
+ if rating not in ( "G", "PG", "PG-13", "R", "NC-17", "Unrated", "NR" ):
+ if rating in ("12", "12A",):
+ equivalent_mpaa = "PG-13"
+ elif rating in ( "15", "16" ):
+ equivalent_mpaa = "R"
+ elif rating in ( "0", "U" ):
+ equivalent_mpaa = "G"
+ elif rating in ( "6", ):
+ equivalent_mpaa = "PG"
+ elif rating in ("18", "R18", "MA",):
+ equivalent_mpaa = "NC-17"
+ else:
+ equivalent_mpaa = rating
+ return equivalent_mpaa, rating
+
+# moved from pre_eden_code
+def _store_playlist():
+ p_list = []
+ xbmc.log( "[script.cinema.experience] - Storing Playlist in memory", level=xbmc.LOGNOTICE )
+ json_query = '{"jsonrpc": "2.0", "method": "Playlist.GetItems", "params": {"playlistid": 1, "properties": ["title", "file", "thumbnail", "streamdetails", "mpaa", "genre"] }, "id": 1}'
+ p_list = retrieve_json_dict( json_query, items="items", force_log=False )
+ return p_list
+
+def _movie_details( movie_id ):
+ movie_details = []
+ xbmc.log( "[script.cinema.experience] - Retrieving Movie Details", level=xbmc.LOGNOTICE )
+ json_query = '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"movieid": %d, "properties": ["title", "file", "thumbnail", "streamdetails", "mpaa", "genre"]}, "id": 1}' % movie_id
+ movie_details = retrieve_json_dict( json_query, items="moviedetails", force_log=False )
+ return movie_details
+
+def _rebuild_playlist( plist ): # rebuild movie playlist
+ xbmc.log( "[script.cinema.experience] - [ce_playlist.py] - Rebuilding Playlist", level=xbmc.LOGNOTICE )
+ playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )
+ playlist.clear()
+ for movie in plist:
+ try:
+ xbmc.log( "[script.cinema.experience] - Movie Title: %s" % movie["title"], level=xbmc.LOGDEBUG )
+ xbmc.log( "[script.cinema.experience] - Movie Thumbnail: %s" % movie["thumbnail"], level=xbmc.LOGDEBUG )
+ xbmc.log( "[script.cinema.experience] - Full Movie Path: %s" % movie["file"], level=xbmc.LOGDEBUG )
+ json_command = '{"jsonrpc": "2.0", "method": "Playlist.Add", "params": {"playlistid": 1, "item": {"movieid": %d} }, "id": 1}' % movie["id"]
+ json_response = xbmc.executeJSONRPC(json_command)
+ xbmc.log( "[script.cinema.experience] - JSONRPC Response: \n%s" % movie["title"], level=xbmc.LOGDEBUG )
+ except:
+ traceback.print_exc()
+ # give XBMC a chance to add to the playlist... May not be needed, but what's 50ms?
+ xbmc.sleep( 50 )
+
+def _get_queued_video_info( feature = 0 ):
+ xbmc.log( "%s - _get_queued_video_info() Started" % log_message, level=xbmc.LOGDEBUG )
+ equivalent_mpaa = "NR"
+ try:
+ # get movie name
+ plist = _store_playlist()
+ movie_detail = _movie_details( plist[feature]['id'] )
+ movie_title = movie_detail['title']
+ path = movie_detail['file']
+ mpaa = movie_detail['mpaa']
+ genre = list_to_string( movie_detail['genre'] )
+ try:
+ audio = movie_detail['streamdetails']['audio'][0]['codec']
+ except:
+ audio = "other"
+ equivalent_mpaa, short_mpaa = get_equivalent_rating( mpaa )
+ except:
+ traceback.print_exc()
+ movie_title = path = mpaa = audio = genre = movie = equivalent_mpaa, short_mpaa = ""
+ # spew queued video info to log
+ xbmc.log( "%s - Queued Movie Information" % log_message, level=xbmc.LOGDEBUG )
+ xbmc.log( "%s %s" % ( log_message,log_sep ), level=xbmc.LOGDEBUG )
+ xbmc.log( "%s - Title: %s" % ( log_message, movie_title, ), level=xbmc.LOGDEBUG )
+ xbmc.log( "%s - Path: %s" % ( log_message, path, ), level=xbmc.LOGDEBUG )
+ xbmc.log( "%s - Genre: %s" % ( log_message, genre, ), level=xbmc.LOGDEBUG )
+ xbmc.log( "%s - MPAA: %s" % ( log_message, short_mpaa, ), level=xbmc.LOGDEBUG )
+ xbmc.log( "%s - Audio: %s" % ( log_message, audio, ), level=xbmc.LOGDEBUG )
+ if video_settings[ "audio_videos_folder" ]:
+ xbmc.log( "%s - Folder: %s" % ( log_message, ( video_settings[ "audio_videos_folder" ] + { "dts": "DTS", "dca": "DTS", "ac3": "Dolby", "dtsma": "DTSHD-MA", "dtshd_ma": "DTSHD-MA", "a_truehd": "Dolby TrueHD", "truehd": "Dolby TrueHD" }.get( audio, "Other" ) + video_settings[ "audio_videos_folder" ][ -1 ], ) ), level=xbmc.LOGDEBUG )
+ xbmc.log( "%s %s" % ( log_message, log_sep ), level=xbmc.LOGDEBUG )
+ # return results
+ return short_mpaa, audio, genre, path, equivalent_mpaa
View
104 resources/lib/pre_eden_code.py
@@ -1,104 +0,0 @@
-# -*- coding: utf-8 -*-
-__scriptID__ = "script.cinema.experience"
-__modname__ = "pre_eden_code.py"
-log_message = "[ " + __scriptID__ + " ] - [ " + __modname__ + " ]"
-log_sep = "-"*70
-
-import xbmc, xbmcgui, xbmcaddon
-import traceback, os, sys
-from urllib import quote_plus
-from json_utils import find_movie_details, retrieve_json_dict
-from utils import list_to_string
-
-_A_ = xbmcaddon.Addon( __scriptID__ )
-# language method
-_L_ = _A_.getLocalizedString
-
-trivia_settings = sys.modules["__main__"].trivia_settings
-trailer_settings = sys.modules["__main__"].trailer_settings
-feature_settings = sys.modules["__main__"].feature_settings
-video_settings = sys.modules["__main__"].video_settings
-
-def _store_playlist():
- p_list = []
- xbmc.log( "[script.cinema.experience] - Storing Playlist in memory", level=xbmc.LOGNOTICE )
- json_query = '{"jsonrpc": "2.0", "method": "Playlist.GetItems", "params": {"playlistid": 1, "properties": ["title", "file", "thumbnail", "streamdetails", "mpaa", "genre"] }, "id": 1}'
- p_list = retrieve_json_dict( json_query, items="items", force_log=False )
- return p_list
-
-def _movie_details( movie_id ):
- movie_details = []
- xbmc.log( "[script.cinema.experience] - Retrieving Movie Details", level=xbmc.LOGNOTICE )
- json_query = '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"movieid": %d, "properties": ["title", "file", "thumbnail", "streamdetails", "mpaa", "genre"]}, "id": 1}' % movie_id
- movie_details = retrieve_json_dict( json_query, items="moviedetails", force_log=False )
- return movie_details
-
-def _rebuild_playlist( plist ): # rebuild movie playlist
- xbmc.log( "[script.cinema.experience] - [ce_playlist.py] - Rebuilding Playlist", level=xbmc.LOGNOTICE )
- playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )
- playlist.clear()
- for movie in plist:
- try:
- xbmc.log( "[script.cinema.experience] - Movie Title: %s" % movie["title"], level=xbmc.LOGDEBUG )
- xbmc.log( "[script.cinema.experience] - Movie Thumbnail: %s" % movie["thumbnail"], level=xbmc.LOGDEBUG )
- xbmc.log( "[script.cinema.experience] - Full Movie Path: %s" % movie["file"], level=xbmc.LOGDEBUG )
- json_command = '{"jsonrpc": "2.0", "method": "Playlist.Add", "params": {"playlistid": 1, "item": {"movieid": %d} }, "id": 1}' % movie["id"]
- json_response = xbmc.executeJSONRPC(json_command)
- xbmc.log( "[script.cinema.experience] - JSONRPC Response: \n%s" % movie["title"], level=xbmc.LOGDEBUG )
- except:
- traceback.print_exc()
- # give XBMC a chance to add to the playlist... May not be needed, but what's 50ms?
- xbmc.sleep( 50 )
-
-def _get_queued_video_info( feature = 0 ):
- xbmc.log( "%s - _get_queued_video_info() Started" % log_message, level=xbmc.LOGDEBUG )
- equivalent_mpaa = "NR"
- try:
- # get movie name
- plist = _store_playlist()
- movie_detail = _movie_details( plist[feature]['id'] )
- movie_title = movie_detail['title']
- path = movie_detail['file']
- mpaa = movie_detail['mpaa']
- genre = list_to_string( movie_detail['genre'] )
- try:
- audio = movie_detail['streamdetails']['audio'][0]['codec']
- except:
- audio = "other"
- if mpaa == "":
- mpaa = "NR"
- elif mpaa.startswith("Rated"):
- mpaa = mpaa.split( " " )[ 1 - ( len( mpaa.split( " " ) ) == 1 ) ]
- mpaa = ( mpaa, "NR", )[ mpaa not in ( "G", "PG", "PG-13", "R", "NC-17", "Unrated", ) ]
- elif mpaa.startswith("UK"):
- mpaa = mpaa.split( ":" )[ 1 - ( len( mpaa.split( ":" ) ) == 1 ) ]
- mpaa = ( mpaa, "NR", )[ mpaa not in ( "12", "12A", "PG", "15", "18", "R18", "MA", "U", ) ]
- else:
- mpaa = ( mpaa, "NR", )[ mpaa not in ( "12", "12A", "PG", "15", "18", "R18", "MA", "U", ) ]
- if mpaa not in ( "G", "PG", "PG-13", "R", "NC-17", "Unrated", "NR" ):
- if mpaa in ("12", "12A",):
- equivalent_mpaa = "PG-13"
- elif mpaa == "15":
- equivalent_mpaa = "R"
- elif mpaa == "U":
- equivalent_mpaa = "G"
- elif mpaa in ("18", "R18", "MA",):
- equivalent_mpaa = "NC-17"
- else:
- equivalent_mpaa = mpaa
- except:
- traceback.print_exc()
- movie_title = path = mpaa = audio = genre = movie = equivalent_mpaa = ""
- # spew queued video info to log
- xbmc.log( "%s - Queued Movie Information" % log_message, level=xbmc.LOGDEBUG )
- xbmc.log( "%s %s" % ( log_message,log_sep ), level=xbmc.LOGDEBUG )
- xbmc.log( "%s - Title: %s" % ( log_message, movie_title, ), level=xbmc.LOGDEBUG )
- xbmc.log( "%s - Path: %s" % ( log_message, path, ), level=xbmc.LOGDEBUG )
- xbmc.log( "%s - Genre: %s" % ( log_message, genre, ), level=xbmc.LOGDEBUG )
- xbmc.log( "%s - MPAA: %s" % ( log_message, mpaa, ), level=xbmc.LOGDEBUG )
- xbmc.log( "%s - Audio: %s" % ( log_message, audio, ), level=xbmc.LOGDEBUG )
- if video_settings[ "audio_videos_folder" ]:
- xbmc.log( "%s - Folder: %s" % ( log_message, ( video_settings[ "audio_videos_folder" ] + { "dts": "DTS", "dca": "DTS", "ac3": "Dolby", "dtsma": "DTSHD-MA", "dtshd_ma": "DTSHD-MA", "a_truehd": "Dolby TrueHD", "truehd": "Dolby TrueHD" }.get( audio, "Other" ) + video_settings[ "audio_videos_folder" ][ -1 ], ) ), level=xbmc.LOGDEBUG )
- xbmc.log( "%s %s" % ( log_message, log_sep ), level=xbmc.LOGDEBUG )
- # return results
- return mpaa, audio, genre, path, equivalent_mpaa
View
19 resources/lib/scrapers/amt_current/scraper.py
@@ -4,29 +4,24 @@
Apple Movie Trailers current trailers scraper
"""
-import sys
-import os
-
-import xbmc
-import xbmcaddon
-import time
-import re
-import urllib
+import os, sys, time, re, urllib
from random import shuffle, random
from xml.sax.saxutils import unescape
+import xbmc
+
#__useragent__ = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27"
__useragent__ = "QuickTime/7.6.5 (qtver=7.6.5;os=Windows NT 5.1Service Pack 3)"
#__useragent__ = "Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.0.1) Gecko/2008070208 Firefox/3.6"
-_A_ = xbmcaddon.Addon('script.cinema.experience')
-_L_ = _A_.getLocalizedString
class _urlopener( urllib.FancyURLopener ):
version = __useragent__
# set for user agent
urllib._urlopener = _urlopener()
-BASE_CURRENT_SOURCE_PATH = sys.modules[ "__main__" ].BASE_CURRENT_SOURCE_PATH
+BASE_CACHE_PATH = sys.modules["__main__"].BASE_CACHE_PATH
+BASE_RESOURCE_PATH = sys.modules["__main__"].BASE_RESOURCE_PATH
+BASE_CURRENT_SOURCE_PATH = sys.modules["__main__"].BASE_CURRENT_SOURCE_PATH
class _Parser:
"""
@@ -118,7 +113,7 @@ def _parse_source( self, xmlSource ):
# size
#size = long( re.findall( "filesize=\"([0-9]*)", preview[ 0 ] )[ 0 ] )
# add the item to our media list
- self.trailers += [ ( id, title, trailer, poster, plot, runtime, mpaa, releasedate, studio, genre, _L_( 32605 ), director, ) ]
+ self.trailers += [ ( id, title, trailer, poster, plot, runtime, mpaa, releasedate, studio, genre, "Movie Trailer", director, ) ]
# increment counter
count += 1
# if we have enough exit
View
32 resources/lib/scrapers/local/scraper.py
@@ -7,26 +7,24 @@
"""
# TODO: add watched.xml to skip watched trailers
-import os, sys, re
+import os, sys, time, re, urllib
+from random import shuffle, random
+from xml.sax.saxutils import unescape
+
import xbmc
-from random import shuffle
-import xbmcaddon
logmessage = "[ " + __scriptID__ + " ] - [ " + __modname__ + " ]"
-_A_ = xbmcaddon.Addon( __scriptID__ )
-_L_ = _A_.getLocalizedString
-trailer_settings = sys.modules[ "__main__" ].trailer_settings
-BASE_RESOURCE_PATH = sys.modules[ "__main__" ].BASE_CURRENT_SOURCE_PATH
-
+trailer_settings = sys.modules[ "__main__" ].trailer_settings
+BASE_CACHE_PATH = sys.modules[ "__main__" ].BASE_CACHE_PATH
+BASE_RESOURCE_PATH = sys.modules[ "__main__" ].BASE_RESOURCE_PATH
+BASE_CURRENT_SOURCE_PATH = sys.modules[ "__main__" ].BASE_CURRENT_SOURCE_PATH
sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )
from folder import dirEntries
from ce_playlist import _set_trailer_info
class Main:
xbmc.log("%s - Local Folder Trailer Scraper Started" % logmessage, level=xbmc.LOGNOTICE )
- # base paths
- BASE_CURRENT_SOURCE_PATH = BASE_RESOURCE_PATH
-
+
def __init__( self, equivalent_mpaa=None, mpaa=None, genre=None, settings=None, movie=None ):
self.mpaa = equivalent_mpaa
self.genre = genre.replace( "Sci-Fi", "Science Fiction" ).replace( "Action", "Action and ADV" ).replace( "Adventure", "ACT and Adventure" ).replace( "ACT", "Action" ).replace( "ADV", "Adventure" ).split( " / " )
@@ -87,9 +85,9 @@ def _get_watched( self ):
try:
# base path to watched file
if int( self.settings[ "trailer_play_mode" ] )== 1:
- base_path = os.path.join( self.BASE_CURRENT_SOURCE_PATH, "downloader" + "_watched.txt" )
+ base_path = os.path.join( BASE_CURRENT_SOURCE_PATH, "downloader" + "_watched.txt" )
else:
- base_path = os.path.join( self.BASE_CURRENT_SOURCE_PATH, self.settings[ "trailer_scraper" ] + "_watched.txt" )
+ base_path = os.path.join( BASE_CURRENT_SOURCE_PATH, self.settings[ "trailer_scraper" ] + "_watched.txt" )
# open path
usock = open( base_path, "r" )
# read source
@@ -102,9 +100,9 @@ def _get_watched( self ):
def _reset_watched( self ):
xbmc.log("%s - Resetting Watched List" % logmessage, level=xbmc.LOGNOTICE )
if int( self.settings[ "trailer_play_mode" ] )== 1:
- base_path = os.path.join( self.BASE_CURRENT_SOURCE_PATH, "downloader" + "_watched.txt" )
+ base_path = os.path.join( BASE_CURRENT_SOURCE_PATH, "downloader" + "_watched.txt" )
else:
- base_path = os.path.join( self.BASE_CURRENT_SOURCE_PATH, self.settings[ "trailer_scraper" ] + "_watched.txt" )
+ base_path = os.path.join( BASE_CURRENT_SOURCE_PATH, self.settings[ "trailer_scraper" ] + "_watched.txt" )
if ( os.path.isfile( base_path ) ):
os.remove( base_path )
self.watched = []
@@ -114,9 +112,9 @@ def _save_watched( self ):
try:
# base path to watched file
if int( self.settings[ "trailer_play_mode" ] )== 1:
- base_path = os.path.join( self.BASE_CURRENT_SOURCE_PATH, "downloader" + "_watched.txt" )
+ base_path = os.path.join( BASE_CURRENT_SOURCE_PATH, "downloader" + "_watched.txt" )
else:
- base_path = os.path.join( self.BASE_CURRENT_SOURCE_PATH, self.settings[ "trailer_scraper" ] + "_watched.txt" )
+ base_path = os.path.join( BASE_CURRENT_SOURCE_PATH, self.settings[ "trailer_scraper" ] + "_watched.txt" )
# if the path to the source file does not exist create it
if ( not os.path.isdir( os.path.dirname( base_path ) ) ):
os.makedirs( os.path.dirname( base_path ) )
View
34 resources/lib/scrapers/xbmc_library/scraper.py
@@ -6,34 +6,30 @@
XBMC Movie Library Trailer Scraper
"""
-import sys
-import os
-import xbmcaddon
-import xbmc
-
-from random import shuffle
-from urllib import quote_plus
-import datetime, traceback
+import os, sys, time, re, urllib, traceback, datetime
+from random import shuffle, random
+from xml.sax.saxutils import unescape
if sys.version_info < (2, 7):
import simplejson
else:
import json as simplejson
+import xbmc
+
logmessage = "[ " + __scriptID__ + " ] - [ " + __modname__ + " ]"
-_A_ = xbmcaddon.Addon('script.cinema.experience')
-_L_ = _A_.getLocalizedString
-trailer_settings = sys.modules[ "__main__" ].trailer_settings
-BASE_RESOURCE_PATH = sys.modules[ "__main__" ].BASE_CURRENT_SOURCE_PATH
+
+trailer_settings = sys.modules[ "__main__" ].trailer_settings
+BASE_CACHE_PATH = sys.modules[ "__main__" ].BASE_CACHE_PATH
+BASE_RESOURCE_PATH = sys.modules[ "__main__" ].BASE_RESOURCE_PATH
+BASE_CURRENT_SOURCE_PATH = sys.modules[ "__main__" ].BASE_CURRENT_SOURCE_PATH
sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )
from ce_playlist import _get_thumbnail, _get_trailer_thumbnail
-unwatched_movie_only = True
-__useragent__ = "QuickTime/7.2 (qtver=7.2;os=Windows NT 5.1Service Pack 3)"
+__useragent__ = "QuickTime/7.2 (qtver=7.2;os=Windows NT 5.1Service Pack 3)"
class Main:
xbmc.log( "%s - XBMC Movie Library Trailer Scraper" % logmessage, level=xbmc.LOGNOTICE )
- BASE_CURRENT_SOURCE_PATH = BASE_RESOURCE_PATH
-
+
def __init__( self, equivalent_mpaa=None, mpaa=None, genre=None, settings=None, movie=None ):
self.settings = settings
if settings['trailer_limit_mpaa']:
@@ -105,7 +101,7 @@ def _get_watched( self ):
xbmc.log("%s - Getting Watched List" % logmessage, level=xbmc.LOGNOTICE )
try:
# base path to watched file
- base_path = os.path.join( self.BASE_CURRENT_SOURCE_PATH, self.settings[ "trailer_scraper" ] + "_watched.txt" )
+ base_path = os.path.join( BASE_CURRENT_SOURCE_PATH, self.settings[ "trailer_scraper" ] + "_watched.txt" )
# open path
usock = open( base_path, "r" )
# read source
@@ -117,7 +113,7 @@ def _get_watched( self ):
def _reset_watched( self ):
xbmc.log("%s - Resetting Watched List" % logmessage, level=xbmc.LOGNOTICE )
- base_path = os.path.join( self.BASE_CURRENT_SOURCE_PATH, self.settings[ "trailer_scraper" ] + "_watched.txt" )
+ base_path = os.path.join( BASE_CURRENT_SOURCE_PATH, self.settings[ "trailer_scraper" ] + "_watched.txt" )
if os.path.isfile( base_path ):
os.remove( base_path )
self.watched = []
@@ -126,7 +122,7 @@ def _save_watched( self ):
xbmc.log("%s - Saving Watched List" % logmessage, level=xbmc.LOGNOTICE )
try:
# base path to watched file
- base_path = os.path.join( self.BASE_CURRENT_SOURCE_PATH, self.settings[ "trailer_scraper" ] +"_watched.txt" )
+ base_path = os.path.join( BASE_CURRENT_SOURCE_PATH, self.settings[ "trailer_scraper" ] +"_watched.txt" )
# if the path to the source file does not exist create it
if not os.path.isdir( os.path.dirname( base_path ) ):
os.makedirs( os.path.dirname( base_path ) )
View
18 resources/lib/slides.py
@@ -1,29 +1,23 @@
# -*- coding: utf-8 -*-
-import os, sys
-import xbmcgui,xbmc, xbmcaddon
-
+import os, sys, re
from random import shuffle, random
-import re
__script__ = "Cinema Experience"
__scriptID__ = "script.cinema.experience"
-_A_ = xbmcaddon.Addon( __scriptID__ )
-# language method
-_L_ = _A_.getLocalizedString
-
-BASE_CURRENT_SOURCE_PATH = os.path.join( xbmc.translatePath( "special://profile/addon_data/" ), os.path.basename( _A_.getAddonInfo('path') ) ).replace("\\\\","\\")
-BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( _A_.getAddonInfo('path'), 'resources' ) ).replace("\\\\","\\")
+slide_settings = sys.modules["__main__"].trivia_settings
+BASE_CACHE_PATH = sys.modules["__main__"].BASE_CACHE_PATH
+BASE_RESOURCE_PATH = sys.modules["__main__"].BASE_RESOURCE_PATH
+BASE_CURRENT_SOURCE_PATH = sys.modules["__main__"].BASE_CURRENT_SOURCE_PATH
sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )
+import xbmcgui,xbmc, xbmcaddon
from xbmcvfs import delete as delete_file
from xbmcvfs import exists as exists
from xbmcvfs import copy as file_copy
from folder import dirEntries, getFolders
-slide_settings = sys.modules["__main__"].trivia_settings
-
def _fetch_slides( movie_mpaa ):
# get watched list
watched = _load_watched_trivia_file()
View
25 resources/lib/xbmcscript_player.py
@@ -16,22 +16,19 @@
from urllib import quote_plus
from random import shuffle, random
-_A_ = xbmcaddon.Addon( __scriptID__ )
-trivia_settings = sys.modules["__main__"].trivia_settings
-trailer_settings = sys.modules["__main__"].trailer_settings
-feature_settings = sys.modules["__main__"].feature_settings
-video_settings = sys.modules["__main__"].video_settings
-triggers = sys.modules["__main__"].triggers
-
-log_sep = "-"*70
-
-BASE_CACHE_PATH = os.path.join( xbmc.translatePath( "special://profile" ), "Thumbnails", "Video" )
-BASE_CURRENT_SOURCE_PATH = os.path.join( xbmc.translatePath( "special://profile/addon_data/" ), os.path.basename( _A_.getAddonInfo('path') ) )
-BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( _A_.getAddonInfo('path'), 'resources' ) )
+trivia_settings = sys.modules["__main__"].trivia_settings
+trailer_settings = sys.modules["__main__"].trailer_settings
+feature_settings = sys.modules["__main__"].feature_settings
+video_settings = sys.modules["__main__"].video_settings
+triggers = sys.modules["__main__"].triggers
+BASE_CACHE_PATH = sys.modules["__main__"].BASE_CACHE_PATH
+BASE_RESOURCE_PATH = sys.modules["__main__"].BASE_RESOURCE_PATH
+BASE_CURRENT_SOURCE_PATH = sys.modules["__main__"].BASE_CURRENT_SOURCE_PATH
sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )
-from ce_playlist import _get_special_items, _get_trailers, _set_trailer_info
-from pre_eden_code import _get_queued_video_info
+_A_ = xbmcaddon.Addon( __scriptID__ )
+
+from ce_playlist import _get_special_items, _get_trailers, _set_trailer_info, _get_queued_video_info
class Main:
def __init__( self ):
View
42 resources/lib/xbmcscript_trivia.py
@@ -4,41 +4,29 @@
__scriptID__ = "script.cinema.experience"
# main imports
-import os, sys, traceback
-import xbmcgui
-import xbmc
-import xbmcaddon
-import threading
-import binascii
+import os, sys, traceback, threading, binascii, re, time
from random import shuffle, random
-import re
-import time
-
-
-_A_ = xbmcaddon.Addon(__scriptID__)
-_L_ = _A_.getLocalizedString
-_S_ = _A_.getSetting
-
-trivia_settings = sys.modules["__main__"].trivia_settings
-trailer_settings = sys.modules["__main__"].trailer_settings
-feature_settings = sys.modules["__main__"].feature_settings
-video_settings = sys.modules["__main__"].video_settings
+import xbmc, xbmcgui, xbmcaddon
+from xbmcvfs import delete as delete_file
+from xbmcvfs import exists as exists
-BASE_RESOURCE_PATH = os.path.join( xbmc.translatePath( _A_.getAddonInfo('path') ), 'resources' )
+trivia_settings = sys.modules["__main__"].trivia_settings
+trailer_settings = sys.modules["__main__"].trailer_settings
+feature_settings = sys.modules["__main__"].feature_settings
+video_settings = sys.modules["__main__"].video_settings
+BASE_CACHE_PATH = sys.modules["__main__"].BASE_CACHE_PATH
+BASE_RESOURCE_PATH = sys.modules["__main__"].BASE_RESOURCE_PATH
+BASE_CURRENT_SOURCE_PATH = sys.modules["__main__"].BASE_CURRENT_SOURCE_PATH
sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )
-from music import parse_playlist
-from ce_playlist import build_music_playlist
-CEPlayer = xbmc.Player
-from pre_eden_code import _rebuild_playlist
-from xbmcvfs import delete as delete_file
-from xbmcvfs import exists as exists
+from music import parse_playlist
+from ce_playlist import build_music_playlist, _rebuild_playlist
from folder import dirEntries
+
+CEPlayer = xbmc.Player
volume_query = '{"jsonrpc": "2.0", "method": "Application.GetProperties", "params": { "properties": [ "volume" ] }, "id": 1}'
class Trivia( xbmcgui.WindowXML ):
- # base paths
- BASE_CURRENT_SOURCE_PATH = os.path.join( xbmc.translatePath( "special://profile/addon_data/" ), os.path.basename( _A_.getAddonInfo('path') ) )
# special action codes
ACTION_NEXT_SLIDE = ( 2, 3, 7, )
ACTION_PREV_SLIDE = ( 1, 4, )
Please sign in to comment.
Something went wrong with that request. Please try again.