コード例 #1
0
 def get_image_list(self, media_id):
     xml_url = self.url % (self.api_key,media_id)
     log('API: %s ' % xml_url)
     image_list = []
     data = get_xml(xml_url)
     tree = ET.fromstring(data)
     for imagetype in self.imagetypes:
         imageroot = imagetype + 's'
         for images in tree.findall(imageroot):
             for image in images:
                 info = {}
                 info['id'] = image.get('id')
                 info['url'] = urllib.quote(image.get('url'), ':/')
                 info['preview'] = urllib.quote(image.get('preview'), ':/')
                 info['type'] = imagetype
                 info['language'] = image.get('lang')
                 info['likes'] = image.get('likes')
                 # Create Gui string to display
                 info['generalinfo'] = '%s: %s  |  %s: %s   ' %( __localize__(32141), info['language'], __localize__(32143), info['likes'] )
                 if info:            
                     image_list.append(info)
     if image_list == []:
         raise NoFanartError(media_id)
     else:
         return image_list
コード例 #2
0
def fetch_vids(filters={}, reset=False):
  post_data = {
    'serviceClassName': 'org.sesameworkshop.service.UmpServiceUtil',
    'serviceMethodName': 'getMediaItems',
    'serviceParameters': ['criteria','capabilities','resultsBiasingPolicy','context'],
    'criteria': {
      'qty': settings.listsVideonum,
      'reset': reset,
      'type': 'video',
      'filters': filters
    },
    'capabilities': {},
    'resultsBiasingPolicy': '',
    'context': {}
  }
  
  # check for age restriction
  if settings.filterAgegroup > 0:
    post_data['criteria']['filters']['age'] = settings.filterAgegroup
  
  utils.log(post_data)
  headers = {'Content-Type': 'application/x-www-form-urlencoded', 'Cookie': session.getCookie()}
  req = urllib2.Request(common.sesame_base_url + '/c/portal/json_service', urllib.urlencode(post_data), headers)
  res = urllib2.urlopen(req)
  session.parseCookieHeaders(res)
  data = json.load(res)
  if len(data['content']) == 0:
    return False
  return data['content']
コード例 #3
0
def getHtml(url):
    
    """
    Retrieve and return remote resource as string
    
    Arguments:
    url -- A string containing the url of a remote page to retrieve
    
    Returns:
    data -- A string containing the contents to the remote page
    """
    
    log('Retrieving url: %s' % url)

    # set default timeout
    socket.setdefaulttimeout(__defaultTimeout__)

    # connect to url using urlopen
    client = urlopen(url)
    
    # read data from page
    data = client.read()
    
    # close connection to url
    client.close()

    log('Retrieved url: %s' % url)

    # return the retrieved data
    return data
コード例 #4
0
 def get_image_list(self, media_id):
     data = get_json(self.url %(media_id, self.api_key))
     image_list = []
     # Get fanart
     try:
         for item in data['backdrops']:
             info = {}
             info['url'] = self.imageurl + 'original' + item['file_path']    # Original image url
             info['preview'] = self.imageurl + 'w300' + item['file_path']    # Create a preview url for later use
             info['id'] = item['file_path'].lstrip('/').replace('.jpg', '')  # Strip filename to get an ID
             info['type'] = ['fanart','extrafanart']                         # Set standard to 'fanart'
             info['height'] = item['height']
             info['width'] = item['width']
             #info['aspect_ratio'] = item['aspect_ratio']                    # Who knows when we may need it
             # Convert the 'None' value to default 'n/a'
             if item['iso_639_1']:
                 info['language'] = item['iso_639_1']
             else:
                 info['language'] = 'n/a'
             info['rating'] = 'n/a'                                          # Rating may be integrated at later time
             # Create Gui string to display
             info['generalinfo'] = 'Language: %s  |  Rating: %s  |  Size: %sx%s   ' %(info['language'], info['rating'], info['width'],info['height'])
             if info:
                 image_list.append(info)
     except Exception, e:
         log( str( e ), xbmc.LOGNOTICE )
コード例 #5
0
def getEventsByPromotion(promotion):
    log('Retrieving details of all events from database for promotion: %s' % promotion)
    with storageDB:
        cur = storageDB.cursor()
        cur.execute("SELECT eventID, title, promotion, date, venue, city FROM events WHERE promotion='%s' ORDER BY date" % promotion)
        result = cur.fetchall()
    return result
コード例 #6
0
def getAllFighters():
    log('Retrieving details of all fighters from database')
    with storageDB:
        cur = storageDB.cursor()
        cur.execute("SELECT DISTINCT fighters.*, COUNT(*) AS cnt FROM fighters INNER JOIN fights ON (fights.fighter1=fighters.fighterID OR fights.fighter2=fighters.fighterID) GROUP BY fighters.fighterID ORDER BY fighters.name")
        result = cur.fetchall()
    return result
コード例 #7
0
ファイル: authorizers.py プロジェクト: robweber/xbmcbackup
    def authorize(self):
        result = True

        if(not self.setup()):
            return False
        
        if(self.isAuthorized()):
            #delete the token to start over
            self._deleteToken()

        #copied flow from http://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.oauth.DropboxOAuth2FlowNoRedirect
        flow = dropbox.oauth.DropboxOAuth2FlowNoRedirect(self.APP_KEY,self.APP_SECRET)

        url = flow.start()

        #print url in log
        utils.log("Authorize URL: " + url)
        xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30056),utils.getString(30057),tinyurl.shorten(url))

        #get the auth code
        code = xbmcgui.Dialog().input(utils.getString(30027) + ' ' + utils.getString(30103))
        
        #if user authorized this will work

        try:
            user_token = flow.finish(code)
            self._setToken(user_token.access_token)
        except Exception,e:
            utils.log("Error: %s" % (e,))
            result = False
コード例 #8
0
ファイル: scheduler.py プロジェクト: robweber/xbmcbackup
    def __init__(self):
        self.monitor = UpdateMonitor(update_method = self.settingsChanged)
        self.enabled = utils.getSetting("enable_scheduler")
        self.next_run_path = xbmc.translatePath(utils.data_dir()) + 'next_run.txt'

        if(self.enabled == "true"):

            nr = 0
            if(xbmcvfs.exists(self.next_run_path)):

                fh = xbmcvfs.File(self.next_run_path)
                try:
                    #check if we saved a run time from the last run
                    nr = float(fh.read())
                except ValueError:
                    nr = 0

                fh.close()

            #if we missed and the user wants to play catch-up
            if(0 < nr <= time.time() and utils.getSetting('schedule_miss') == 'true'):
                utils.log("scheduled backup was missed, doing it now...")
                progress_mode = int(utils.getSetting('progress_mode'))
                
                if(progress_mode == 0):
                    progress_mode = 1 # Kodi just started, don't block it with a foreground progress bar

                self.doScheduledBackup(progress_mode)
                
            self.setup()
コード例 #9
0
def getAllEventsAndPromotions():
    log('Retrieving details of all eventIDs from database')
    with storageDB:
        cur = storageDB.cursor()
        cur.execute("SELECT DISTINCT eventID FROM events UNION SELECT DISTINCT promotion FROM events")
        result = cur.fetchall()
    return result
コード例 #10
0
def getAllEvents():
    log('Retrieving details of all events from database')
    with storageDB:
        cur = storageDB.cursor()
        cur.execute("SELECT DISTINCT eventID, title, promotion, date, venue, city FROM events ORDER BY date")
        result = cur.fetchall()
    return result
コード例 #11
0
 def md5sum_verified(self, md5sum_compare, path):
     if self.background:
         verify_progress = progress.ProgressBG()
     else:
         verify_progress = progress.Progress()
         
     verify_progress.create("Verifying", line2=path)
 
     BLOCK_SIZE = 8192
     
     hasher = hashlib.md5()
     f = open(path)
     
     done = 0
     size = os.path.getsize(path)
     while done < size:
         if verify_progress.iscanceled():
             verify_progress.close()
             return True
         data = f.read(BLOCK_SIZE)
         done += len(data)
         hasher.update(data)
         percent = int(done * 100 / size)
         verify_progress.update(percent)
     verify_progress.close()
         
     md5sum = hasher.hexdigest()
     utils.log("{} md5 hash = {}".format(path, md5sum))
     return md5sum == md5sum_compare
コード例 #12
0
def searchFighters(searchStr):
    log("Searching database for fighters: %s" % searchStr)
    with storageDB:
        cur = storageDB.cursor()
        cur.execute("SELECT DISTINCT fighters.*, COUNT(*) AS cnt FROM fighters INNER JOIN fights ON (fights.fighter1=fighters.fighterID OR fights.fighter2=fighters.fighterID) WHERE (fighters.fighterID LIKE '%s' OR fighters.name LIKE '%s' OR fighters.nickname LIKE '%s' OR fighters.association LIKE '%s' OR fighters.city LIKE '%s' OR fighters.country LIKE '%s') GROUP BY fighters.fighterID ORDER BY fighters.name" % ("%" + searchStr + "%", "%" + searchStr + "%", "%" + searchStr + "%", "%" + searchStr + "%", "%" + searchStr + "%", "%" + searchStr + "%"))
        result = cur.fetchall()
    return result
コード例 #13
0
def getAllPromotions():
    log('Retrieving list of all promotions from database')
    with storageDB:
        cur = storageDB.cursor()
        cur.execute("SELECT DISTINCT promotion FROM events ORDER BY promotion")
        result = cur.fetchall()
    return result
コード例 #14
0
 def get_image_list(self, media_id):
     xml_url = self.url % (self.api_key, media_id)
     log('API: %s ' % xml_url)
     image_list = []
     data = self.get_xml(xml_url)
     tree = ET.fromstring(data)
     for image in tree.findall('Banner'):
         info = {}
         if image.findtext('BannerType') == 'fanart' and image.findtext('BannerPath'):
             info['url'] = self.url_prefix + image.findtext('BannerPath')
             info['language'] = image.findtext('Language')
             if image.findtext('BannerType2'):
                 x,y = image.findtext('BannerType2').split('x')
                 info['height'] = int(x)
                 info['width'] = int(y)
             info['series_name'] = image.findtext('SeriesName') == 'true'
             if image.findtext('RatingCount') and int(image.findtext('RatingCount')) >= 1:
                 info['rating'] = float(image.findtext('Rating'))
             else:
                 info['rating'] = 0
         if info:            
             image_list.append(info) 
     if image_list == []:
         raise NoFanartError(media_id)
     else:
         return image_list
コード例 #15
0
def getEventCount(promotion):
    log('Retrieving count of events in database for promotion: %s' % promotion)
    with storageDB:
        cur = storageDB.cursor()
        cur.execute("SELECT COUNT(DISTINCT eventID) FROM events WHERE promotion='%s'" % promotion)
        result = cur.fetchone()
    return result[0]
コード例 #16
0
def getEvent(eventID):
    log('Retrieving details of event from database: %s' % eventID)
    with storageDB:
        cur = storageDB.cursor()
        cur.execute("SELECT * FROM events WHERE eventID='%s'" % eventID)
        result = cur.fetchone()
    return result
コード例 #17
0
def searchEvents(searchStr):
    log("Searching database for events: %s" % searchStr)
    with storageDB:
        cur = storageDB.cursor()
        cur.execute("SELECT DISTINCT eventID, title, promotion, date, venue, city FROM events WHERE (eventID LIKE '%s' OR title LIKE '%s' OR promotion LIKE '%s' OR date LIKE '%s' OR venue LIKE '%s' OR city LIKE '%s') ORDER BY date" % ("%" + searchStr + "%", "%" + searchStr + "%", "%" + searchStr + "%", "%" + searchStr + "%", "%" + searchStr + "%", "%" + searchStr + "%"))
        result = cur.fetchall()
    return result
コード例 #18
0
def getEventsByFighter(fighterID):
    log('Retrieving details of all events from database for fighter: %s' % fighterID)
    with storageDB:
        cur = storageDB.cursor()
        cur.execute("SELECT DISTINCT events.eventID, events.title, events.promotion, events.date, events.venue, events.city FROM events INNER JOIN fights ON events.eventID=fights.eventID WHERE (fighter1='%s' OR fighter2='%s') ORDER BY date" % (fighterID, fighterID))
        result = cur.fetchall()
    return result
コード例 #19
0
ファイル: service.py プロジェクト: Giftie/service.makemkv.rip
def _daemon():
    previous_getDVDState = 4 # this should insure only on rip is done
    while ( not xbmc.abortRequested ):
        xbmc.sleep( 250 )
        if xbmc.getDVDState() == 4 and previous_getDVDState != 4:
            utils.log( "Disc Detected, Checking for Movie Disc(s)", xbmc.LOGNOTICE )
            xbmc.sleep( 3000 )
            previous_getDVDState = xbmc.getDVDState()
            disc = makemkv.makeMKV( general_settings ).findDisc( general_settings[ "temp_folder" ] )
            if disc:
                utils.log( "Movie Disc Detected", xbmc.LOGNOTICE )
                if general_settings[ "movie_disc_insertion" ] == "Rip":
                    makeMKV().rip( disc )
                elif general_settings[ "movie_disc_insertion" ] == "Notify":
                    pass
                elif general_settings[ "movie_disc_insertion" ] == "Stream":
                    pass
                elif general_settings[ "movie_disc_insertion" ] == "Ask":
                    pass
                elif general_settings[ "movie_disc_insertion" ] == "Backup":
                    pass
                else: #do nothing
                    pass
        elif xbmc.getDVDState() !=4:
            previous_getDVDState = xbmc.getDVDState()
コード例 #20
0
 def _gui_imagelist(self, art_type):
     log('- Retrieving image list for GUI')
     filteredlist = []
     #retrieve list
     for artwork in self.image_list:
         if  art_type in artwork['type']:
             filteredlist.append(artwork)
     return filteredlist
コード例 #21
0
def cd_tmp_dir():
    # Move to the download directory.
    try:
        os.makedirs(__dir__)
    except OSError:
        pass
    os.chdir(__dir__)
    utils.log("chdir to " + __dir__)
コード例 #22
0
ファイル: gui.py プロジェクト: robweber/service.history
    def run(self):
        action = int(params['action'])

        utils.log("action " + str(action))
        if(action == 0):
            self._showHistory()
        elif(action == 1001):
            self._delete(params['id'])
コード例 #23
0
 def _choose_image(self, imagelist):
     # Some debuglog output
     for item in imagelist:
         log( "### image list: %s" % item)
     self.image_item = self.MyDialog(imagelist)
     if self.image_item:
         return True
     else:
         return False
コード例 #24
0
 def _copyfile(self, sourcepath, targetpath, media_name = ''):
     targetdir = os.path.dirname(targetpath)
     if not self._exists(targetdir):
         if not self._mkdir(targetdir):
             raise CreateDirectoryError(targetdir)
     if not self._copy(sourcepath, targetpath):
         raise CopyError(targetpath)
     else:
         log("[%s] Copied successfully: %s" % (media_name, targetpath) )
コード例 #25
0
    def _networkUp(self):
        utils.log("Starting network check")
        try:
            response = urllib2.urlopen('http://www.google.com',timeout=1)
            return True
        except:
            pass

        return False
コード例 #26
0
ファイル: scheduler.py プロジェクト: khaledlfc/xbmcbackup
    def findNextRun(self,now):
        #find the cron expression and get the next run time
        cron_exp = self.parseSchedule()

        cron_ob = croniter(cron_exp,datetime.datetime.fromtimestamp(now))
        new_run_time = cron_ob.get_next(float)

        if(new_run_time != self.next_run):
            self.next_run = new_run_time
            utils.log("scheduler will run again on " + datetime.datetime.fromtimestamp(self.next_run).strftime('%m-%d-%Y %H:%M'))
コード例 #27
0
ファイル: service.py プロジェクト: Giftie/service.makemkv.rip
def update_settings( original_settings ):
    utils.log( "service.py - Settings loaded" )
    new_settings = settings.read_settings_xml()
    if not original_settings == new_settings:
        settings.store_settings()
        original_settings = new_settings
        settings.settings_to_log()
        settings.start()
        general_settings = _settings.general_settings
    return original_settings
コード例 #28
0
 def _delete_file_in_dirs(self, filename, targetdirs, reason, media_name = '' ):
     isdeleted = False
     for targetdir in targetdirs:
         path = os.path.join(targetdir, filename)
         if self._exists(path):
             self._delete(path)
             log("[%s] Deleted (%s): %s" % (media_name, reason, path), xbmc.LOGNOTICE)
             isdeleted = True
     if not isdeleted:
         log("[%s] Ignoring (%s): %s" % (media_name, reason, filename))
コード例 #29
0
    def getJSON(self,method,params):
        json_response = xbmc.executeJSONRPC('{ "jsonrpc" : "2.0" , "method" : "' + method + '" , "params" : ' + params + ' , "id":1 }')

        jsonobject = json.loads(json_response.decode('utf-8','replace'))
       
        if(jsonobject.has_key('result')):
            return jsonobject['result']
        else:
            utils.log("no result " + str(jsonobject),xbmc.LOGDEBUG)
            return None
コード例 #30
0
ファイル: service.py プロジェクト: krazinabox/UFO-IPTV
 def findNextRun(self,now):
     #find the cron expression and get the next run time
     cron_exp = self.parseSchedule()
     cron_ob = croniter(cron_exp,datetime.datetime.fromtimestamp(now))
     new_run_time = cron_ob.get_next(float)
     # utils.log('new run time' +  str(new_run_time))
     # utils.log('next run time' + str(self.next_run))
     if(new_run_time != self.next_run):
         self.next_run = new_run_time
         utils.showNotification('EPG Updater', 'Next Update: ' + datetime.datetime.fromtimestamp(self.next_run).strftime('%m-%d-%Y %H:%M'))
         utils.log("scheduler will run again on " + datetime.datetime.fromtimestamp(self.next_run).strftime('%m-%d-%Y %H:%M'))
コード例 #31
0
ファイル: engine.py プロジェクト: Arias800/script.simkl
 def onPlayBackStopped(self):
     log("Stop clear")
     self._stop_tracker()
コード例 #32
0
ファイル: engine.py プロジェクト: Arias800/script.simkl
    def _detect_item(self):
        self._item = {}
        active_players = json.loads(xbmc.executeJSONRPC(json.dumps({"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1})))["result"]
        playerId = 1
        if active_players: playerId = int(active_players[0]['playerid'])
        _data = json.loads(xbmc.executeJSONRPC(json.dumps({
            "jsonrpc": "2.0", "method": "Player.GetItem",
            "params": {
               "playerid": playerId,
               "properties": ["showtitle", "title", "season", "episode", "file", "tvshowid", "imdbnumber","genre" ,"year","uniqueid"]
            },
            "id": 1})))["result"]["item"]
        is_tv = _data["season"] > 0 and _data["episode"] > 0
        _data["ids"] = {}

        if 'id' not in _data:
            season = xbmc.getInfoLabel('VideoPlayer.Season')
            episode = xbmc.getInfoLabel('VideoPlayer.Episode')
            showtitle = xbmc.getInfoLabel('VideoPlayer.TVShowTitle')
            title = xbmc.getInfoLabel('VideoPlayer.Title')
            year = xbmc.getInfoLabel('VideoPlayer.Year')
            if season: _data["season"] = season
            if episode: _data["episode"] = episode
            if showtitle: _data["showtitle"] = showtitle
            if year: _data["year"] = year
            if title: _data["title"] = title
        else:
            if is_tv:
                _tmp = json.loads(xbmc.executeJSONRPC(json.dumps({
                    "jsonrpc": "2.0", "method": "VideoLibrary.GetTVShowDetails",
                    "params": {"tvshowid": _data["tvshowid"], "properties": ["uniqueid"]},
                    "id": 1
                })))["result"]["tvshowdetails"]
                if _tmp["uniqueid"].get("tvdb"): _data["ids"]["tvdb"] = _tmp["uniqueid"]["tvdb"]
                if _tmp["uniqueid"].get("tmdb"): _data["ids"]["tmdb"] = _tmp["uniqueid"]["tmdb"]
            elif "uniqueid" in _data:
                if _data["uniqueid"].get("tmdb"): _data["ids"]["tmdb"] = _data["uniqueid"]["tmdb"]
                if _data["uniqueid"].get("imdb"): _data["ids"]["imdb"] = _data["uniqueid"]["imdb"]

        log("Full: {0}".format(_data))
        if not _data["ids"] and _data['title']:
            _r = self._api.detect_by_file(filename=_data['title'])
            if isinstance(_r, dict) and "type" in _r:
                if _r["type"] == "episode":
                    # TESTED
                    if "episode" in _r:
                        self._item = {
                            "type": "episodes",
                            "title": _r["show"]["title"],
                            "simkl": _r["episode"]["ids"]["simkl"],
                            "season": _r["episode"]["season"],
                            "episode": _r["episode"]["episode"]
                        }
                elif _r["type"] == "movie" and "movie" in _r:
                    # TESTED
                    self._item = {
                        "type": "movies",
                        "title": _r["movie"]["title"],
                        "year": _r["movie"]["year"],
                        "simkl": _r["movie"]["ids"]["simkl"]
                    }

        if not self._item and (_data["title"] or _data["showtitle"]):
            if is_tv:
                # TESTED
                self._item = {
                    "type": "shows",
                    "title": _data["showtitle"],
                    "season": _data["season"],
                    "episode": _data["episode"]
                }
            else:
                # TESTED
                self._item = {
                    "type": "movies",
                    "title": _data["title"],
                    "year": _data["year"]
                }
            self._item["ids"] = _data['ids']

        if self._item:
            self._run_tracker()
コード例 #33
0
NOT LICENSED YET
Creator: David Davó <*****@*****.**>
'''

import sys
import xbmc
import xbmcvfs

from resources.lib.utils import log
from resources.lib.utils import system_lock

from resources.lib import engine
from resources.lib import api_simkl
from resources.lib import events

if __name__ == "__main__":
    system_lock("SimklTrackerRun", 5)
    log("dir = " + str(xbmcvfs.translatePath("special://home")))
    log("Python Version = " + str(sys.version))
    log("args = " + str(sys.argv))

    api = api_simkl.Simkl()
    monitor = events.Monitor(api=api)
    player = engine.Player(api=api)

    while not monitor.abortRequested():
        if monitor.waitForAbort(90):
            break

sys.exit(0)
コード例 #34
0
 def log(self, msg, lvl=2):
     class_name = self.__class__.__name__
     utils.log("%s %s" % (utils.addon_name(), class_name), msg, int(lvl))
コード例 #35
0
    def get_image_list(self, media_id):
        xml_url = self.url % (self.api_key, media_id)
        log('API:               %s ' % xml_url)
        image_list = []
        data = get_xml(xml_url)
        tree = ET.fromstring(data)
        for image in tree.findall('Banner'):
            info = {}
            if image.findtext('BannerPath'):
                info['url'] = self.url_prefix + image.findtext('BannerPath')
                if image.findtext('ThumbnailPath'):
                    info['preview'] = self.url_prefix + image.findtext('ThumbnailPath')
                else:
                    info['preview'] = self.url_prefix + image.findtext('BannerPath')
                info['language'] = image.findtext('Language')
                info['id'] = image.findtext('id')
                # process fanarts
                if image.findtext('BannerType') == 'fanart':
                    info['type'] = ['fanart','extrafanart']
                # process posters
                elif image.findtext('BannerType') == 'poster':
                    info['type'] = ['poster']
                # process banners
                elif image.findtext('BannerType') == 'series' and image.findtext('BannerType2') == 'graphical':
                    info['type'] = ['banner']
                # process seasonposters
                elif image.findtext('BannerType') == 'season' and image.findtext('BannerType2') == 'season':
                    info['type'] = ['seasonposter']
                # process seasonbanners
                elif image.findtext('BannerType') == 'season' and image.findtext('BannerType2') == 'seasonwide':
                    info['type'] = ['seasonbanner']
                else:
                    info['type'] = ['']
                # convert image size ...x... in Bannertype2
                if image.findtext('BannerType2'):
                    try:
                        x,y = image.findtext('BannerType2').split('x')
                        info['width'] = int(x)
                        info['height'] = int(y)
                    except:
                        info['type2'] = image.findtext('BannerType2')

                # check if fanart has text
                info['series_name'] = image.findtext('SeriesName') == 'true'

                # find image ratings
                if image.findtext('RatingCount') and int(image.findtext('RatingCount')) >= 1:
                    info['rating'] = float( "%.1f" % float( image.findtext('Rating')) ) #output string with one decimal
                else:
                    info['rating'] = 'n/a'

                # find season info
                if image.findtext('Season') != '':
                    info['season'] = image.findtext('Season')
                # Create Gui string to display
                info['generalinfo'] = 'Language: %s  |  Rating: %s  |  ' %( info['language'], info['rating'] )
                if 'season'in info:
                    info['generalinfo'] += 'Season: %s  |  ' %( info['season'] )
                    #info['generalinfo'] += 'Season: %s  |  ' %( info['season'].replace('-','') )
                if 'height' in info:
                    info['generalinfo'] += 'Size: %sx%s  |  ' %( info['height'], info['width'] )
            if info:
                image_list.append(info)
        if image_list == []:
            raise NoFanartError(media_id)
        else:
            return image_list
コード例 #36
0
def main():
    kodi_helper = KodiHelper(plugin_handle=int(sys.argv[1]),
                             args=sys.argv[2][1:],
                             base_url=sys.argv[0])
    storage = MemStorage('plugin.video.tipsport.elh_' + kodi_helper.version)
    tipsport_storage_id = 'tsg'
    mode = kodi_helper.get_arg('mode')
    try:
        if mode is None:
            if tipsport_storage_id not in storage:
                storage[tipsport_storage_id] = get_tipsport(kodi_helper)
            show_available_competitions(kodi_helper)

        elif mode == 'folder':
            if tipsport_storage_id not in storage:
                storage[tipsport_storage_id] = get_tipsport(kodi_helper)
            tipsport = storage[tipsport_storage_id]
            show_available_elh_matches(kodi_helper, tipsport, kodi_helper.get_arg('foldername'))
            storage[tipsport_storage_id] = tipsport

        elif mode == 'play':
            if tipsport_storage_id not in storage:
                storage[tipsport_storage_id] = get_tipsport(kodi_helper)
            tipsport = storage[tipsport_storage_id]
            stream = tipsport.get_stream(kodi_helper.get_arg('url'))
            title = '{name} ({time})'.format(name=kodi_helper.get_arg('name'), time=kodi_helper.get_arg('start_time'))
            play_video(title, kodi_helper.icon, stream.get_link())
            storage[tipsport_storage_id] = tipsport

        elif mode == 'notification':
            show_notification(kodi_helper.get_arg('title'), kodi_helper.get_arg('message'), xbmcgui.NOTIFICATION_INFO)

        elif mode == 'check_login':
            tipsport = get_tipsport(kodi_helper)
            tipsport.check_login()
            storage[tipsport_storage_id] = tipsport
            show_localized_notification(kodi_helper, 30000, 30001, xbmcgui.NOTIFICATION_INFO)

    except (NoInternetConnectionsException, requests.ConnectionError, requests.ConnectTimeout, requests.exceptions.ChunkedEncodingError):
        show_localized_notification(kodi_helper, 32000, 32001)
    except LoginFailedException:
        show_localized_notification(kodi_helper, 32000, 32002)
    except UnableGetStreamMetadataException:
        show_localized_notification(kodi_helper, 32000, 32003)
    except UnableParseStreamMetadataException:
        show_localized_notification(kodi_helper, 32000, 32004)
    except UnsupportedFormatStreamMetadataException:
        show_localized_notification(kodi_helper, 32000, 32005)
    except UnableDetectScriptSessionIdException:
        show_localized_notification(kodi_helper, 32000, 32006)
    except UnableGetStreamNumberException:
        show_localized_notification(kodi_helper, 32000, 32007)
    except UnableGetStreamListException:
        show_localized_notification(kodi_helper, 32000, 32010)
    except StreamHasNotStarted:
        show_localized_notification(kodi_helper, 30004, 30008, xbmcgui.NOTIFICATION_INFO)
    except TipsportMsg as e:
        xbmcgui.Dialog().ok(kodi_helper.get_local_string(32000), e.message)
    except Exception as e:
        if send_crash_report(kodi_helper, e):
            show_localized_notification(kodi_helper, 32000, 32009)
        else:
            log(traceback.format_exc(e))
            show_localized_notification(kodi_helper, 32000, 32008)
コード例 #37
0
ファイル: default.py プロジェクト: micahg/plugin.video.cbc
def logout():
    """Remove authorization stuff."""
    log('Logging out...', True)
    os.remove(getAuthorizationFile())
    os.remove(get_cookie_file())
コード例 #38
0
 def onScreensaverActivated(self):
     utils.log('Screensaver Activated')
コード例 #39
0
 def __init__(self, *args, **kwargs):
     self.exit_monitor = self.ExitMonitor(self.exit)
     self.path = utils.get_setting_string('screensaver.arctic.mirage.path')
     utils.log(self.path)
コード例 #40
0
 def detect_by_file(self, filename):
     values = json.dumps({"file": filename})
     r = self._http("/search/file/", headers=self.headers, body=values)
     if r:
         log("Response: {0}".format(r))
     return r
コード例 #41
0
from resources.lib.service import AutoUpdater

autoUpdate = AutoUpdater()
runUpdate = False

if (not utils.getSettingBool('disable_manual_prompt')):
    nextRun = autoUpdate.showNotify(False)
    # check if we should run updates
    runUpdate = xbmcgui.Dialog().yesno(utils.getString(30000),
                                       utils.getString(30060) + nextRun,
                                       line2=utils.getString(30061),
                                       autoclose=6000)
else:
    # the user has elected to skip the prompt
    runUpdate = True

if (runUpdate):
    # run the program
    utils.log("Update Library Manual Run...")

    # trick the auto updater into resetting the last_run time
    autoUpdate.last_run = 0
    autoUpdate.writeLastRun()

    # update the schedules and evaluate them in manual override mode
    autoUpdate.createSchedules(True)
    autoUpdate.evalSchedules(True)

    # delete the monitor before exiting
    del autoUpdate.monitor
コード例 #42
0
ファイル: engine.py プロジェクト: Arias800/script.simkl
 def onPlayBackEnded(self):
     log("End clear")
     self._stop_tracker()