def __init__(self): from resources.lib.common import Settings from resources.lib.proxy import ProxyTCPD from resources.lib.configs import writeConfig self._s = Settings() self.lastExport = float(getConfig('last_wl_export', '0')) self.proxy = ProxyTCPD(self._s) writeConfig('proxyaddress', '127.0.0.1:{}'.format(self.proxy.port)) Log('Service: Proxy bound to {}'.format(self._s.proxyaddress)) self.proxy_thread = threading.Thread(target=self.proxy.serve_forever)
# -*- coding: utf-8 -*- from __future__ import unicode_literals from kodi_six.utils import py2_decode from json import dumps, loads import os from re import search from time import ctime, mktime, strftime, strptime, time import xbmc import xbmcvfs from resources.lib.common import Globals, Settings, sleep from resources.lib.kodiDB import initDatabase, updateDatabase globals = Globals() settings = Settings() def setDBs(files, path): dbtypes = ['video', 'music'] for dbtype in dbtypes: dbname = None for file in files: if file.lower().startswith('my{0}'.format(dbtype)): if dbname is None: dbname = file elif search('(\d+)', dbname) and search('(\d+)', file): dbnumber = int(search('(\d+)', dbname).group(1)) filedbnumber = int(search('(\d+)', file).group(1)) if filedbnumber > dbnumber:
tutWin = ['Adding content to your library', 'Search for your Movie, TV-Show or Music.\n' +'Mark/select content, do not play a Movie or enter a TV-Show.\n' +'Open context menu on the selected and select *create strms*.'] globals.dialog.ok(tutWin[0], tutWin[1]) elif mode == 102: favs = jsonrpc('Favourites.GetFavourites', dict(properties=['path', 'window', 'windowparameter', 'thumbnail'])).get('favourites', {}) if favs: for fav in favs: if params.get('type') == 'video' and fav.get('window') == 'videos': addDir(fav.get('title'), fav.get('windowparameter'), 101, {'thumb': fav.get('thumbnail')}, type=type) xbmcplugin.endOfDirectory(int(sys.argv[1])) elif mode == 103: addons = searchAddons(['video']) list = [addon.get('name') for addon in addons] ignore_addons = Settings().PLAYBACK_IGNORE_ADDON_STRING.split('|') preselects = [i for i, addon in enumerate(addons) if addon.get('addonid') in ignore_addons] selects = selectDialog(getString(33005, globals.addon), list, multiselect=True, preselect=preselects) playback_ignore_addon_string = '|'.join([addons[select].get('addonid') for select in selects]) if selects else '' globals.addon.setSetting('playback_ignore_addon_string', playback_ignore_addon_string) elif mode == 104: addons = searchAddons(['video', 'audio']) list = ['{0} ({1})'.format(addon.get('name'), addon.get('provides')) for addon in addons] infolabel_addons = Settings().INFOLABELS_ADD_ADDON_STRING.split('|') preselects = [i for i, addon in enumerate(addons) if addon.get('addonid') in infolabel_addons] selects = selectDialog(getString(33006, globals.addon), list, multiselect=True, preselect=preselects) infolabels_add_addon_string = '|'.join([addons[select].get('addonid') for select in selects]) if selects else '' globals.addon.setSetting('infolabels_add_addon_string', infolabels_add_addon_string) elif mode == 200: addon_log('write multi strms') addToMedialist(params)
from __future__ import unicode_literals import xbmc from resources.lib.common import Settings from resources.lib.logging import Log from resources.lib.configs import * if __name__ == '__main__': _s = Settings() monitor = xbmc.Monitor() Log('Service: Start') check_freq = 60 export_freq = 24 * 60 * 60 if _s.wl_export: while not monitor.abortRequested(): import time last_export = float(getConfig('last_wl_export', '0')) cur_time = time.time() if cur_time >= last_export + export_freq: Log('Service: Starting Export of Watchlist') writeConfig('last_wl_export', cur_time) xbmc.executebuiltin( 'XBMC.RunPlugin(plugin://plugin.video.amazon-test/?mode=getListMenu&url=watchlist&export=2)' ) if monitor.waitForAbort(check_freq): break Log('Service: End')