def onPlayBackStopped(self): logger.log('Service: Playback Stopped', log_utils.LOGNOTICE) if self.tracked: # clear the playlist if SALTS was playing and only one item in playlist to # use playlist to determine playback method in get_sources pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) plugin_url = 'plugin://%s/' % (kodi.get_id()) if pl.size() == 1 and pl[0].getfilename().lower().startswith(plugin_url): logger.log('Service: Clearing Single Item SALTS Playlist', log_utils.LOGDEBUG) pl.clear() playedTime = float(self._lastPos) try: percent_played = int((playedTime / self._totalTime) * 100) except: percent_played = 0 # guard div by zero pTime = utils.format_time(playedTime) tTime = utils.format_time(self._totalTime) logger.log('Service: Played %s of %s total = %s%%' % (pTime, tTime, percent_played), log_utils.LOGDEBUG) if playedTime == 0 and self._totalTime == 999999: logger.log('Kodi silently failed to start playback', log_utils.LOGWARNING) elif playedTime >= 5: if percent_played <= 98: logger.log('Service: Setting bookmark on |%s|%s|%s| to %s seconds' % (self.trakt_id, self.season, self.episode, playedTime), log_utils.LOGDEBUG) self.db_connection.set_bookmark(self.trakt_id, playedTime, self.season, self.episode) if percent_played >= 75 and self._from_library: if kodi.has_addon('script.trakt'): run = 'RunScript(script.trakt, action=sync, silent=True)' xbmc.executebuiltin(run) self.reset()
def onPlayBackStopped(self): logger.log('Service: Playback Stopped', log_utils.LOGNOTICE) if self.tracked: # clear the playlist if transistortv was playing and only one item in playlist to # use playlist to determine playback method in get_sources pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) plugin_url = 'plugin://%s/' % (kodi.get_id()) if pl.size() == 1 and pl[0].getfilename().lower().startswith(plugin_url): logger.log('Service: Clearing Single Item Stream All The Sources Playlist', log_utils.LOGDEBUG) pl.clear() playedTime = float(self._lastPos) try: percent_played = int((playedTime / self._totalTime) * 100) except: percent_played = 0 # guard div by zero pTime = utils.format_time(playedTime) tTime = utils.format_time(self._totalTime) logger.log('Service: Played %s of %s total = %s%%' % (pTime, tTime, percent_played), log_utils.LOGDEBUG) if playedTime == 0 and self._totalTime == 999999: logger.log('Kodi silently failed to start playback', log_utils.LOGWARNING) elif playedTime >= 5: if percent_played <= 98: logger.log('Service: Setting bookmark on |%s|%s|%s| to %s seconds' % (self.trakt_id, self.season, self.episode, playedTime), log_utils.LOGDEBUG) self.db_connection.set_bookmark(self.trakt_id, playedTime, self.season, self.episode) if percent_played >= 75 and self._from_library: if kodi.has_addon('script.trakt'): run = 'RunScript(script.trakt, action=sync, silent=True)' xbmc.executebuiltin(run) self.reset()
def disable_global_cx(was_on): if kodi.has_addon('plugin.program.super.favourites'): active_plugin = xbmc.getInfoLabel('Container.PluginName') sf = xbmcaddon.Addon('plugin.program.super.favourites') if active_plugin == kodi.get_id(): if sf.getSetting('CONTEXT') == 'true': logger.log('Disabling Global CX while SALTS is active', log_utils.LOGDEBUG) was_on = True sf.setSetting('CONTEXT', 'false') elif was_on: logger.log('Re-enabling Global CX while SALTS is not active', log_utils.LOGDEBUG) sf.setSetting('CONTEXT', 'true') was_on = False return was_on
def disable_global_cx(was_on): if kodi.has_addon('plugin.program.super.favourites'): active_plugin = xbmc.getInfoLabel('Container.PluginName') sf = xbmcaddon.Addon('plugin.program.super.favourites') if active_plugin == kodi.get_id(): if sf.getSetting('CONTEXT') == 'true': logger.log('Disabling Global CX while Stream All The Sources is active', log_utils.LOGDEBUG) was_on = True sf.setSetting('CONTEXT', 'false') elif was_on: logger.log('Re-enabling Global CX while Stream All The Sources is not active', log_utils.LOGDEBUG) sf.setSetting('CONTEXT', 'true') was_on = False return was_on
import xbmcvfs import kodi import pyaes from constants import * # @UnusedWildImport from sigsaur_lib import strings logger = log_utils.Logger.get_logger() THEME_LIST = [ 'Shine', 'Luna_Blue', 'Iconic', 'Simple', 'SALTy', 'SALTy (Blended)', 'SALTy (Blue)', 'SALTy (Frog)', 'SALTy (Green)', 'SALTy (Macaw)', 'SALTier (Green)', 'SALTier (Orange)', 'SALTier (Red)', 'IGDB', 'Simply Elegant', 'IGDB Redux', 'NaCl' ] THEME = THEME_LIST[int(kodi.get_setting('theme') or 0)] if kodi.has_addon('script.sigsaur.themepak'): themepak_path = xbmcaddon.Addon('script.sigsaur.themepak').getAddonInfo( 'path') else: themepak_path = kodi.get_path() THEME_PATH = os.path.join(themepak_path, 'art', 'themes', THEME) translations = kodi.Translations(strings.STRINGS) SORT_FIELDS = [(SORT_LIST[int(kodi.get_setting('sort1_field'))], SORT_SIGNS[kodi.get_setting('sort1_order')]), (SORT_LIST[int(kodi.get_setting('sort2_field'))], SORT_SIGNS[kodi.get_setting('sort2_order')]), (SORT_LIST[int(kodi.get_setting('sort3_field'))], SORT_SIGNS[kodi.get_setting('sort3_order')]), (SORT_LIST[int(kodi.get_setting('sort4_field'))], SORT_SIGNS[kodi.get_setting('sort4_order')]),
import json import zipfile import StringIO import time import utils import log_utils import kodi import utils2 from db_utils import DB_Connection from constants import VIDEO_TYPES import xml.etree.ElementTree as ET logger = log_utils.Logger.get_logger(__name__) logger.disable() CACHE_INSTALLED = kodi.has_addon('script.module.image_cache') if CACHE_INSTALLED: import image_cache db_connection = DB_Connection() PLACE_POSTER = os.path.join(kodi.get_path(), 'resources', 'place_poster.png') DEFAULT_FANART = utils2.art('fanart.jpg') OMDB_ENABLED = kodi.get_setting('omdb_enable') == 'true' TVMAZE_ENABLED = kodi.get_setting('tvmaze_enable') == 'true' FANARTTV_ENABLED = kodi.get_setting('fanart_enable') == 'true' BG_ENABLED = kodi.get_setting('bg_enable') == 'true' POSTER_ENABLED = kodi.get_setting('poster_enable') == 'true' BANNER_ENABLED = kodi.get_setting('banner_enable') == 'true' CLEARART_ENABLED = kodi.get_setting('clearart_enable') == 'true' THUMB_ENABLED = kodi.get_setting('thumb_enable') == 'true' GIF_ENABLED = False
import xbmcvfs import kodi import pyaes from constants import * # @UnusedWildImport from salts_lib import strings logger = log_utils.Logger.get_logger() THEME_LIST = [ 'Shine', 'Luna_Blue', 'Iconic', 'Simple', 'SALTy', 'SALTy (Blended)', 'SALTy (Blue)', 'SALTy (Frog)', 'SALTy (Green)', 'SALTy (Macaw)', 'SALTier (Green)', 'SALTier (Orange)', 'SALTier (Red)', 'IGDB', 'Simply Elegant', 'IGDB Redux', 'NaCl' ] THEME = THEME_LIST[int(kodi.get_setting('theme') or 0)] if kodi.has_addon('script.salts.themepak'): themepak_path = xbmcaddon.Addon('plugin.video.saltsrd.lite').getAddonInfo( 'path') else: themepak_path = kodi.get_path() THEME_PATH = os.path.join(themepak_path, 'art', 'themes', THEME) translations = kodi.Translations(strings.STRINGS) SORT_FIELDS = [(SORT_LIST[int(kodi.get_setting('sort1_field'))], SORT_SIGNS[kodi.get_setting('sort1_order')]), (SORT_LIST[int(kodi.get_setting('sort2_field'))], SORT_SIGNS[kodi.get_setting('sort2_order')]), (SORT_LIST[int(kodi.get_setting('sort3_field'))], SORT_SIGNS[kodi.get_setting('sort3_order')]), (SORT_LIST[int(kodi.get_setting('sort4_field'))], SORT_SIGNS[kodi.get_setting('sort4_order')]),
import log_utils import utils import xbmc import xbmcaddon import xbmcvfs import kodi import pyaes from constants import * # @UnusedWildImport from salts_lib import strings logger = log_utils.Logger.get_logger() THEME_LIST = ['Shine', 'Luna_Blue', 'Iconic', 'Simple', 'SALTy', 'SALTy (Blended)', 'SALTy (Blue)', 'SALTy (Frog)', 'SALTy (Green)', 'SALTy (Macaw)', 'SALTier (Green)', 'SALTier (Orange)', 'SALTier (Red)', 'IGDB', 'Simply Elegant', 'IGDB Redux', 'NaCl'] THEME = THEME_LIST[int(kodi.get_setting('theme') or 0)] if kodi.has_addon('script.salts.themepak'): themepak_path = xbmcaddon.Addon('script.salts.themepak').getAddonInfo('path') else: themepak_path = kodi.get_path() THEME_PATH = os.path.join(themepak_path, 'art', 'themes', THEME) translations = kodi.Translations(strings.STRINGS) SORT_FIELDS = [ (SORT_LIST[int(kodi.get_setting('sort1_field'))], SORT_SIGNS[kodi.get_setting('sort1_order')]), (SORT_LIST[int(kodi.get_setting('sort2_field'))], SORT_SIGNS[kodi.get_setting('sort2_order')]), (SORT_LIST[int(kodi.get_setting('sort3_field'))], SORT_SIGNS[kodi.get_setting('sort3_order')]), (SORT_LIST[int(kodi.get_setting('sort4_field'))], SORT_SIGNS[kodi.get_setting('sort4_order')]), (SORT_LIST[int(kodi.get_setting('sort5_field'))], SORT_SIGNS[kodi.get_setting('sort5_order')]), (SORT_LIST[int(kodi.get_setting('sort6_field'))], SORT_SIGNS[kodi.get_setting('sort6_order')])] def art(name):
import json import zipfile import StringIO import time import utils import log_utils import kodi import utils2 from db_utils import DB_Connection from constants import VIDEO_TYPES import xml.etree.ElementTree as ET logger = log_utils.Logger.get_logger(__name__) logger.disable() CACHE_INSTALLED = kodi.has_addon('script.module.image_cache') if CACHE_INSTALLED: import image_cache db_connection = DB_Connection() PLACE_POSTER = os.path.join(kodi.get_path(), 'resources', 'place_poster.png') DEFAULT_FANART = utils2.art('fanart.jpg') OMDB_ENABLED = kodi.get_setting('omdb_enable') == 'true' TVMAZE_ENABLED = kodi.get_setting('tvmaze_enable') == 'true' FANARTTV_ENABLED = kodi.get_setting('fanart_enable') == 'true' BG_ENABLED = kodi.get_setting('bg_enable') == 'true' POSTER_ENABLED = kodi.get_setting('poster_enable') == 'true' BANNER_ENABLED = kodi.get_setting('banner_enable') == 'true' CLEARART_ENABLED = kodi.get_setting('clearart_enable') == 'true' THUMB_ENABLED = kodi.get_setting('thumb_enable') == 'true' GIF_ENABLED = False
import log_utils import utils import xbmc import xbmcaddon import xbmcvfs import kodi import pyaes from constants import * # @UnusedWildImport from dsrd_lib import strings logger = log_utils.Logger.get_logger() THEME_LIST = ['4Horsemen', 'Charon', 'Deadly Elegant', 'Death', 'DOA', 'Famine', 'Hades', 'Heinous', 'Pepper Shaker', 'Pestilence', 'Purgatory', 'Rock Salt', 'Seasoned', 'The Underworld', 'Toxic Death', 'Unsalted', 'War'] THEME = THEME_LIST[int(kodi.get_setting('theme') or 0)] if kodi.has_addon('script.deaths.themepak'): themepak_path = xbmcaddon.Addon('script.deaths.themepak').getAddonInfo('path') else: themepak_path = kodi.get_path() THEME_PATH = os.path.join(themepak_path, 'art', 'themes', THEME) translations = kodi.Translations(strings.STRINGS) SORT_FIELDS = [ (SORT_LIST[int(kodi.get_setting('sort1_field'))], SORT_SIGNS[kodi.get_setting('sort1_order')]), (SORT_LIST[int(kodi.get_setting('sort2_field'))], SORT_SIGNS[kodi.get_setting('sort2_order')]), (SORT_LIST[int(kodi.get_setting('sort3_field'))], SORT_SIGNS[kodi.get_setting('sort3_order')]), (SORT_LIST[int(kodi.get_setting('sort4_field'))], SORT_SIGNS[kodi.get_setting('sort4_order')]), (SORT_LIST[int(kodi.get_setting('sort5_field'))], SORT_SIGNS[kodi.get_setting('sort5_order')]), (SORT_LIST[int(kodi.get_setting('sort6_field'))], SORT_SIGNS[kodi.get_setting('sort6_order')])] def art(name):
import xbmcaddon import xbmcvfs import kodi import pyaes from constants import * # @UnusedWildImport from transistortv_lib import strings logger = log_utils.Logger.get_logger() THEME_LIST = [ '4Horsemen', 'Charon', 'Deadly Elegant', 'Death', 'DOA', 'Famine', 'Hades', 'Heinous', 'Pepper Shaker', 'Pestilence', 'Purgatory', 'Rock Salt', 'Seasoned', 'The Underworld', 'Toxic Death', 'Unsalted', 'War' ] THEME = THEME_LIST[int(kodi.get_setting('theme') or 0)] if kodi.has_addon('script.transistortv.themepak'): themepak_path = xbmcaddon.Addon( 'script.transistortv.themepak').getAddonInfo('path') else: themepak_path = kodi.get_path() THEME_PATH = os.path.join(themepak_path, 'art', 'themes', THEME) translations = kodi.Translations(strings.STRINGS) SORT_FIELDS = [(SORT_LIST[int(kodi.get_setting('sort1_field'))], SORT_SIGNS[kodi.get_setting('sort1_order')]), (SORT_LIST[int(kodi.get_setting('sort2_field'))], SORT_SIGNS[kodi.get_setting('sort2_order')]), (SORT_LIST[int(kodi.get_setting('sort3_field'))], SORT_SIGNS[kodi.get_setting('sort3_order')]), (SORT_LIST[int(kodi.get_setting('sort4_field'))], SORT_SIGNS[kodi.get_setting('sort4_order')]),