Пример #1
0
import xbmc
import xbmcgui
import xbmcaddon
import xbmcplugin
import xbmcvfs
try: 
	import simplejson as json
except ImportError: 
	import json
from metahandler import metahandlers
from donnie.settings import Settings
from donnie.databaseconnector import DataConnector
reg = Settings(['plugin.video.theroyalwe', 'script.module.donnie'])

if reg.getBoolSetting('tv_show_custom_directory'):
	TV_SHOWS_PATH = reg.getSetting('tv_show_directory')
else:
	DATA_PATH = os.path.join(xbmc.translatePath('special://profile/addon_data/plugin.video.theroyalwe'), '')
	TV_SHOWS_PATH = os.path.join(xbmc.translatePath(DATA_PATH + 'tvshows'), '')


def xbmcpath(path,filename):
	path = path.replace('/', os.sep)
     	translatedpath = os.path.join(xbmc.translatePath( path ), ''+filename+'')
     	return translatedpath

def formatStrPath(showname, season, episode):
	strpath = xbmcpath(TV_SHOWS_PATH, showname)
	strpath = xbmcpath(strpath, 'Season %s' % season)
	strfile = '%sx%s Episode.strm' % (season, str(episode).zfill(2))
	strpath = xbmcpath(strpath, strfile)
Пример #2
0
ROOT_PATH = SELF.getAddonInfo('path')
sys.path.append( os.path.join( ROOT_PATH, 'lib', 'walter' ) )

from donnie.settings import Settings
reg = Settings(['plugin.video.theroyalwe', 'script.module.walter'])

from databaseconnector import DatabaseClass
from caching import CachingClass

try: 
	import simplejson as json
                                                                                                                                                                                                                                                        
except ImportError: 
	import json  
table = [10,20,30,45,60]
POLLING_DELAY = table[int(reg.getSetting('polling-delay'))]

class StoppableThread(Thread):
    """Thread class with a stop() method. The thread itself has to check
    regularly for the stopped() condition."""

    def __init__(self):
        super(StoppableThread, self).__init__()
        self._stop = threading.Event()

    def stop(self):
        self._stop.set()

    def stopped(self):
        return self._stop.isSet()