Python xbmc.LOGERROR Examples

The following are 30 code examples of xbmc.LOGERROR(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module xbmc , or try the search function .
Example #1
Source File: default.py    From script.artwork.beef with MIT License 6 votes vote down vote up
def make_local():
    fileman = FileManager()
    def downloadforitem(mediaitem):
        try:
            fileman.downloadfor(mediaitem)
            newart = dict((k, v) for k, v in mediaitem.downloadedart.iteritems()
                if not v or not v.startswith('http'))
            for arttype in newart:
                # remove old URL from texture cache
                if mediaitem.art.get(arttype, '').startswith('http'):
                    quickjson.remove_texture_byurl(mediaitem.art[arttype])
            return newart
        except FileError as ex:
            mediaitem.error = ex.message
            log(ex.message, xbmc.LOGERROR)
            xbmcgui.Dialog().notification("Artwork Beef", ex.message, xbmcgui.NOTIFICATION_ERROR)
            return {}
    downloaded = runon_medialist(downloadforitem, L(M.MAKE_LOCAL), fg=True)
    xbmcgui.Dialog().ok("Artwork Beef", L(M.DOWNLOAD_COUNT).format(downloaded)
        + ' - {0:0.2f}MB'.format(fileman.size / 1000000.00)) 
Example #2
Source File: vpnapi.py    From script.tvguide.fullscreen with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
        # Class initialisation.  Fails with a RuntimeError exception if VPN Manager add-on is not available, or too old
        self.filtered_addons = []
        self.filtered_windows = []
        self.primary_vpns = []
        self.last_updated = 0
        self.refreshLists()
        self.default = self.getConnected()
        xbmc.log("VPN Mgr API : Default is " + self.default, level=xbmc.LOGDEBUG)
        self.timeout = 30
        if not xbmc.getCondVisibility("System.HasAddon(service.vpn.manager)"):
            xbmc.log("VPN Mgr API : VPN Manager is not installed, cannot use filtering", level=xbmc.LOGERROR)
            raise RuntimeError("VPN Manager is not installed")
        else:
            v = int((xbmcaddon.Addon("service.vpn.manager").getAddonInfo("version").strip()).replace(".",""))
            if v < 310:
                raise RuntimeError("VPN Manager " + str(v) + " installed, but needs to be v3.1.0 or later") 
Example #3
Source File: test.py    From plugin.program.openwizard with GNU General Public License v3.0 6 votes vote down vote up
def test_notify():
    from resources.libs.common import logging
    from resources.libs.common import tools
    from resources.libs.gui import window

    response = tools.open_url(CONFIG.NOTIFICATION, check=True)

    if response:
        try:
            id, msg = window.split_notify(CONFIG.NOTIFICATION)
            if not id:
                logging.log_notify(CONFIG.ADDONTITLE,
                                   "[COLOR {0}]Notification: Not Formatted Correctly[/COLOR]".format(CONFIG.COLOR2))
                return
            window.show_notification(msg, test=True)
        except Exception as e:
            logging.log("Error on Notifications Window: {0}".format(str(e)), level=xbmc.LOGERROR)
    else:
        logging.log_notify(CONFIG.ADDONTITLE,
                           "[COLOR {0}]Invalid URL for Notification[/COLOR]".format(CONFIG.COLOR2)) 
Example #4
Source File: debridit.py    From plugin.program.openwizard with GNU General Public License v3.0 6 votes vote down vote up
def debrid_it(do, who):
    if not os.path.exists(CONFIG.ADDON_DATA):
        os.makedirs(CONFIG.ADDON_DATA)
    if not os.path.exists(CONFIG.DEBRIDFOLD):
        os.makedirs(CONFIG.DEBRIDFOLD)
    if who == 'all':
        for log in ORDER:
            if os.path.exists(DEBRIDID[log]['path']):
                try:
                    addonid = tools.get_addon_by_id(DEBRIDID[log]['plugin'])
                    default = DEBRIDID[log]['default']
                    user = addonid.getSetting(default)
                    
                    update_debrid(do, log)
                except:
                    pass
            else:
                logging.log('[Debrid Info] {0}({1}) is not installed'.format(DEBRIDID[log]['name'], DEBRIDID[log]['plugin']), level=xbmc.LOGERROR)
        CONFIG.set_setting('debridnextsave', tools.get_date(days=3, formatted=True))
    else:
        if DEBRIDID[who]:
            if os.path.exists(DEBRIDID[who]['path']):
                update_debrid(do, who)
        else:
            logging.log('[Debrid Info] Invalid Entry: {0}'.format(who), level=xbmc.LOGERROR) 
Example #5
Source File: debug.py    From plugin.audio.tidal2 with GNU General Public License v3.0 6 votes vote down vote up
def emit(self, record):
        if record.levelno < logging.WARNING and self._modules and not record.name in self._modules:
            # Log INFO and DEBUG only with enabled modules
            return
        levels = {
            logging.CRITICAL: xbmc.LOGFATAL,
            logging.ERROR: xbmc.LOGERROR,
            logging.WARNING: xbmc.LOGWARNING,
            logging.INFO: xbmc.LOGNOTICE,
            logging.DEBUG: xbmc.LOGSEVERE,
            logging.NOTSET: xbmc.LOGNONE,
        }
        try:
            xbmc.log(self.format(record), levels[record.levelno])
        except:
            try:
                xbmc.log(self.format(record).encode('utf-8', 'ignore'), levels[record.levelno])
            except:
                xbmc.log(b"[%s] Unicode Error in message text" % self.pluginName, levels[record.levelno]) 
Example #6
Source File: config.py    From plugin.program.openwizard with GNU General Public License v3.0 6 votes vote down vote up
def open_settings(self, id=None, cat=None, set=None, activate=False):
        offset = [(100,  200), (-100, -80)]
        if not id:
            id = self.ADDON_ID

        try:
            xbmcaddon.Addon(id).openSettings()
        except:
            import logging
            logging.log('Cannot open settings for {}'.format(id), level=xbmc.LOGERROR)
        
        if int(self.KODIV) < 18:
            use = 0
        else:
            use = 1

        if cat is not None:
            category_id = cat + offset[use][0]
            xbmc.executebuiltin('SetFocus({})'.format(category_id))
            if set is not None:
                setting_id = set + offset[use][1]
                xbmc.executebuiltin('SetFocus({})'.format(setting_id))
                
                if activate:
                    xbmc.executebuiltin('SendClick({})'.format(setting_id)) 
Example #7
Source File: debug.py    From plugin.audio.tidal2 with GNU General Public License v3.0 6 votes vote down vote up
def log(self, txt = '', level=xbmc.LOGDEBUG):
        ''' Log a text into the Kodi-Logfile '''
        try:
            if self.detailLevel > 0 or level == xbmc.LOGERROR:
                if self.detailLevel == 2 and level == xbmc.LOGDEBUG:
                    # More Logging
                    level = xbmc.LOGNOTICE
                elif self.detailLevel == 3 and (level == xbmc.LOGDEBUG or level == xbmc.LOGSEVERE):
                    # Complex Logging
                    level = xbmc.LOGNOTICE
                if level != xbmc.LOGSEVERE:
                    if isinstance(txt, unicode):
                        txt = unidecode(txt)
                    xbmc.log(b"[%s] %s" % (self.pluginName, txt), level) 
        except:
            xbmc.log(b"[%s] Unicode Error in message text" % self.pluginName, xbmc.LOGERROR) 
Example #8
Source File: loginit.py    From plugin.program.openwizard with GNU General Public License v3.0 6 votes vote down vote up
def login_it(do, who):
    if not os.path.exists(CONFIG.ADDON_DATA):
        os.makedirs(CONFIG.ADDON_DATA)
    if not os.path.exists(CONFIG.LOGINFOLD):
        os.makedirs(CONFIG.LOGINFOLD)
    if who == 'all':
        for log in ORDER:
            if os.path.exists(LOGINID[log]['path']):
                try:
                    addonid = tools.get_addon_by_id(LOGINID[log]['plugin'])
                    default = LOGINID[log]['default']
                    user = addonid.getSetting(default)
                    
                    update_login(do, log)
                except:
                    pass
            else:
                logging.log('[Login Info] {0}({1}) is not installed'.format(LOGINID[log]['name'], LOGINID[log]['plugin']), level=xbmc.LOGERROR)
        CONFIG.set_setting('loginnextsave', tools.get_date(days=3, formatted=True))
    else:
        if LOGINID[who]:
            if os.path.exists(LOGINID[who]['path']):
                update_login(do, who)
        else:
            logging.log('[Login Info] Invalid Entry: {0}'.format(who), level=xbmc.LOGERROR) 
Example #9
Source File: koditidal2.py    From plugin.audio.tidal2 with GNU General Public License v3.0 6 votes vote down vote up
def get_album_json_thread(self):
        try:
            while not xbmc.Monitor().waitForAbort(timeout=0.01) and not self.abortAlbumThreads:
                try:
                    album_id = self.albumQueue.get_nowait()
                except:
                    break
                try:
                    self.get_album(album_id, withCache=False)
                except requests.HTTPError as e:
                    r = e.response
                    msg = _T(30505)
                    try:
                        msg = r.reason
                        msg = r.json().get('userMessage')
                    except:
                        pass
                    log('Error getting Album ID %s' % album_id, xbmc.LOGERROR)
                    if r.status_code == 429 and not self.abortAlbumThreads:
                        self.abortAlbumThreads = True
                        log('Too many requests. Aborting Workers ...', xbmc.LOGERROR)
                        self.albumQueue._init(9999)
                        xbmcgui.Dialog().notification(plugin.name, msg, xbmcgui.NOTIFICATION_ERROR)
        except Exception, e:
            traceback.print_exc() 
Example #10
Source File: logging.py    From plugin.program.openwizard with GNU General Public License v3.0 6 votes vote down vote up
def post_log(data, name):
    params = {'poster': CONFIG.BUILDERNAME, 'content': data, 'syntax': 'text', 'expiration': 'week'}
    params = urlencode(params)

    try:
        page = LogURLopener().open(URL, params)
    except Exception as e:
        a = 'failed to connect to the server'
        log("{0}: {1}".format(a, str(e)), level=xbmc.LOGERROR)
        return False, a

    try:
        page_url = page.url.strip()
        # copy_to_clipboard(page_url)
        log("URL for {0}: {1}".format(name, page_url))
        return True, page_url
    except Exception as e:
        a = 'unable to retrieve the paste url'
        log("{0}: {1}".format(a, str(e)), level=xbmc.LOGERROR)
        return False, a


# CURRENTLY NOT IN USE 
Example #11
Source File: service.py    From xbmc-betaseries with GNU General Public License v2.0 6 votes vote down vote up
def get_url(url, referer=self_host):
    req_headers = {
    'User-Agent': self_user_agent,
    'Cache-Control': 'no-store, no-cache, must-revalidate',
    'Pragma': 'no-cache',
    'Referer': referer}
    request = urllib2.Request(url, headers=req_headers)
    opener = urllib2.build_opener()
    try:
        response = opener.open(request)
        contents = response.read()
        return contents
    except urllib2.HTTPError, e:
        log('HTTPError = ' + str(e.code), xbmc.LOGERROR)
        if e.code == 400:
            return False 
Example #12
Source File: traktit.py    From plugin.program.openwizard with GNU General Public License v3.0 6 votes vote down vote up
def trakt_it(do, who):
    if not os.path.exists(CONFIG.ADDON_DATA):
        os.makedirs(CONFIG.ADDON_DATA)
    if not os.path.exists(CONFIG.TRAKTFOLD):
        os.makedirs(CONFIG.TRAKTFOLD)
    if who == 'all':
        for log in ORDER:
            if os.path.exists(TRAKTID[log]['path']):
                try:
                    addonid = tools.get_addon_by_id(TRAKTID[log]['plugin'])
                    default = TRAKTID[log]['default']
                    user = addonid.getSetting(default)
                    
                    update_trakt(do, log)
                except:
                    pass
            else:
                logging.log('[Trakt Data] {0}({1}) is not installed'.format(TRAKTID[log]['name'], TRAKTID[log]['plugin']), level=xbmc.LOGERROR)
        CONFIG.set_setting('traktnextsave', tools.get_date(days=3, formatted=True))
    else:
        if TRAKTID[who]:
            if os.path.exists(TRAKTID[who]['path']):
                update_trakt(do, who)
        else:
            logging.log('[Trakt Data] Invalid Entry: {0}'.format(who), level=xbmc.LOGERROR) 
Example #13
Source File: plugin_content.py    From plugin.audio.spotify with GNU General Public License v3.0 6 votes vote down vote up
def play_connect(self):
        '''start local connect playback - called from webservice when local connect player starts playback'''
        playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
        trackdetails = None
        count = 0
        while not trackdetails and count < 10:
            try:
                cur_playback = self.sp.current_playback()
                trackdetails = cur_playback["item"]
            except:
                count += 1
                xbmc.sleep(500)
        if not trackdetails:
            log_msg("Could not retrieve trackdetails from api, connect playback aborted", xbmc.LOGERROR)
        else:
            url, li = parse_spotify_track(trackdetails, silenced=False, is_connect=True)
            playlist.clear()
            playlist.add(url, li)
            playlist.add("http://localhost:%s/nexttrack" % PROXY_PORT)
            player = xbmc.Player()
            player.play(playlist)
            del playlist
            del player 
Example #14
Source File: vpnapi.py    From service.vpn.manager with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self):
        # Class initialisation.  Fails with a RuntimeError exception if add-on is not available, or too old
        self.filtered_addons = []
        self.filtered_windows = []
        self.primary_vpns = []
        self.last_updated = 0
        self.addon_name = ""        
        self.timeout = 30
        if xbmc.getCondVisibility("System.HasAddon(service.vpn.manager)"):
            self.addon_name = "service.vpn.manager"
        elif xbmc.getCondVisibility("System.HasAddon(service.nord.vpn)"):
            self.addon_name = "service.nord.vpn"
        if self.addon_name == "":
            xbmc.log("VPN API : A VPN add-on is not installed, cannot use filtering", level=xbmc.LOGERROR)
            raise RuntimeError("VPN add-on is not installed")
        else:
            v = int((xbmcaddon.Addon(self.addon_name).getAddonInfo("version").strip()).replace(".",""))
            if v < 310:
                raise RuntimeError("VPN add-on version " + str(v) + " installed, but needs to be v3.1.0 or later")
        self.refreshLists()
        self.default = self.getConnected()
        xbmc.log("VPN API : Default is " + self.default, level=xbmc.LOGDEBUG) 
Example #15
Source File: default.py    From xbmc-addons-chinese with GNU General Public License v2.0 5 votes vote down vote up
def GetHttpData(url):
    print "getHttpData: " + url
    req = urllib2.Request(url)
    req.add_header('User-Agent', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)')
    try:
        response = urllib2.urlopen(req)
        httpdata = response.read()
        if response.headers.get('content-encoding', None) == 'gzip':
            httpdata = zlib.decompress(httpdata, zlib.MAX_WBITS|32)
        charset = response.headers.getparam('charset')
        response.close()
    except:
        xbmc.log( "%s: %s (%d) [%s]" % (
            __addonname__,
            sys.exc_info()[ 2 ].tb_frame.f_code.co_name,
            sys.exc_info()[ 2 ].tb_lineno,
            sys.exc_info()[ 1 ]
            ), level=xbmc.LOGERROR)
        return ''
    match = re.compile('<meta http-equiv=["]?[Cc]ontent-[Tt]ype["]? content="text/html;[\s]?charset=(.+?)"').findall(httpdata)
    if len(match)>0:
        charset = match[0]
    if charset:
        charset = charset.lower()
        if (charset != 'utf-8') and (charset != 'utf8'):
            httpdata = httpdata.decode(charset, 'ignore').encode('utf8', 'ignore')
    return httpdata 
Example #16
Source File: common.py    From xbmc.service.pushbullet with GNU General Public License v3.0 5 votes vote down vote up
def traceError():
    import traceback
    xbmc.log(traceback.format_exc(), level=xbmc.LOGERROR) 
Example #17
Source File: koditidal.py    From plugin.audio.tidal2 with GNU General Public License v3.0 5 votes vote down vote up
def selectPlaylistDialog(self, headline=None, allowNew=False):
        if not self._session.is_logged_in:
            return None
        try:
            if not headline:
                headline = _T(30238)
            items = self.playlists()
            dialog = xbmcgui.Dialog()
            item_list = [item.title for item in items]
            if allowNew:
                item_list.append(_T(30237))
        except Exception, e:
            log(str(e), level=xbmc.LOGERROR)
            return None 
Example #18
Source File: debug.py    From plugin.audio.tidal2 with GNU General Public License v3.0 5 votes vote down vote up
def logException(self, e, txt=''):
        ''' Logs an Exception as Error Message '''
        try:
            if txt:
                if isinstance(txt, unicode):
                    txt = unidecode(txt)
                xbmc.log(b"[%s] %s\n%s" % (self.pluginName, txt, str(e)), level=xbmc.LOGERROR) 
            logging.exception(str(e))
        except:
            pass 
Example #19
Source File: debug.py    From plugin.audio.tidal2 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, pluginName, detailLevel=0, enableTidalApiLog=False):
        ''' Initialize Error Logging with a given Log Level
            detailLevel = 0 : xbmc.LOGERROR and xbmc.LOGNOTICE
            detailLevel = 1 : as level 0 plus xbmc.LOGWARNING
            detailLevel = 2 : as level 1 plus xbmc.LOGDEBUG
            detailLevel = 3 : as level 2 plus xbmc.LOGSEVERE
        '''
        self.pluginName = pluginName
        self.detailLevel = detailLevel
        self.debugServer = 'localhost'
        # Set Log Handler for tidalapi
        self.addTidalapiLogger(pluginName, enableDebug=enableTidalApiLog) 
Example #20
Source File: addon.py    From plugin.audio.tidal2 with GNU General Public License v3.0 5 votes vote down vote up
def user_playlist_clear(playlist_id):
    dialog = xbmcgui.Dialog()
    playlist = session.get_playlist(playlist_id)
    ok = dialog.yesno(_T(30258), _T(30259).format(name=playlist.title, count=playlist.numberOfItems))
    if ok:
        session.show_busydialog(_T(30258), playlist.name)
        try:
            session.user.remove_all_playlist_entries(playlist_id)
        except Exception, e:
            log(str(e), level=xbmc.LOGERROR)
            traceback.print_exc()
        session.hide_busydialog()
        xbmc.executebuiltin('Container.Refresh()') 
Example #21
Source File: koditidal.py    From plugin.audio.tidal2 with GNU General Public License v3.0 5 votes vote down vote up
def add_list_items(self, items, content=None, end=True, withNextPage=False):
        if content:
            xbmcplugin.setContent(plugin.handle, content)
        list_items = []
        for item in items:
            if isinstance(item, Category):
                category_items = item.getListItems()
                for url, li, isFolder in category_items:
                    if url and li:
                        list_items.append(('%s/' % url if isFolder else url, li, isFolder))
            elif isinstance(item, BrowsableMedia):
                url, li, isFolder = item.getListItem()
                if url and li:
                    list_items.append(('%s/' % url if isFolder else url, li, isFolder))
        if withNextPage and len(items) > 0:
            # Add folder for next page
            try:
                totalNumberOfItems = items[0]._totalNumberOfItems
                nextOffset = items[0]._offset + self._config.pageSize
                if nextOffset < totalNumberOfItems and len(items) >= self._config.pageSize:
                    path = urlsplit(sys.argv[0]).path or '/'
                    path = path.split('/')[:-1]
                    path.append(str(nextOffset))
                    url = '/'.join(path)
                    self.add_directory_item(_T(30244).format(pos1=nextOffset, pos2=min(nextOffset+self._config.pageSize, totalNumberOfItems)), plugin.url_for_path(url))
            except:
                log('Next Page for URL %s not set' % sys.argv[0], xbmc.LOGERROR)
        if len(list_items) > 0:
            xbmcplugin.addDirectoryItems(plugin.handle, list_items)
        if end:
            xbmcplugin.endOfDirectory(plugin.handle) 
Example #22
Source File: utils.py    From xbmc-addons-chinese with GNU General Public License v2.0 5 votes vote down vote up
def log(message,loglevel=xbmc.LOGNOTICE):
    """"save message to kodi.log.
    
    Args:
        message: has to be unicode, http://wiki.xbmc.org/index.php?title=Add-on_unicode_paths#Logging
        loglevel: xbmc.LOGDEBUG, xbmc.LOGINFO, xbmc.LOGNOTICE, xbmc.LOGWARNING, xbmc.LOGERROR, xbmc.LOGFATAL
    """
    xbmc.log(encode(__addon_id__ + u": " + message), level=loglevel) 
Example #23
Source File: net.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def fetch(self, request, **kwargs):
        self.con, self.fd, self.progress, self.cookies, self.request = None, None, None, None, request

        if not isinstance(self.request, HTTPRequest):
            self.request = HTTPRequest(url=self.request, **kwargs)

        self.response = HTTPResponse(self.request)

        xbmc.log('XBMCup: HTTP: request: ' + str(self.request), xbmc.LOGDEBUG)

        try:
            self._opener()
            self._fetch()
        except Exception as e:
            xbmc.log('XBMCup: HTTP: ' + str(e), xbmc.LOGERROR)
            if isinstance(e, urllib.error.HTTPError):
                self.response.code = e.code
            self.response.error = e
        else:
            self.response.code = 200

        if self.fd:
            self.fd.close()
            self.fd = None

        if self.con:
            self.con.close()
            self.con = None

        if self.progress:
            self.progress.close()
            self.progress = None

        self.response.time = time.time() - self.response.time

        xbmc.log('XBMCup: HTTP: response: ' + str(self.response), xbmc.LOGDEBUG)

        return self.response 
Example #24
Source File: logger.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def error(texto="", force=False):
    texto = "    [" + get_caller() + "] " + encode_log(texto)

    xbmc.log("######## ERROR #########", xbmc.LOGERROR)
    xbmc.log(texto, xbmc.LOGERROR) 
Example #25
Source File: kodilogger.py    From plugin.video.mediathekview with MIT License 5 votes vote down vote up
def error(self, message, *args):
        """ Outputs an error message """
        self._log(xbmc.LOGERROR, message, *args) 
Example #26
Source File: default.py    From plugin.video.iptv.recorder with GNU General Public License v3.0 5 votes vote down vote up
def log(x):
    xbmc.log(repr(x),xbmc.LOGERROR) 
Example #27
Source File: common.py    From xbmc.service.pushbullet with GNU General Public License v3.0 5 votes vote down vote up
def log(txt, level=xbmc.LOGDEBUG):
    if getSetting('debug_logging',False) and not xbmc.getCondVisibility('System.GetBool(debug.showloginfo)'):
        if not level == xbmc.LOGERROR:
            level = xbmc.LOGNOTICE

    if isinstance(txt, str):
        txt = txt.decode("utf-8")
    message = u'[%s]: %s' % (__addonname__, txt)
    xbmc.log(msg=message.encode("utf-8"), level=level) 
Example #28
Source File: push2Notification.py    From xbmc.service.pushbullet with GNU General Public License v3.0 5 votes vote down vote up
def onError(self, error):
        common.log(error, xbmc.LOGERROR)
        common.showNotification(common.localise(30101), error, self.notificationTime, self.notificationIcon) 
Example #29
Source File: push2Notification.py    From xbmc.service.pushbullet with GNU General Public License v3.0 5 votes vote down vote up
def onMessage(self, message):
        try:
            from json import dumps
            common.log('New push (%s) received: %s' % (message['type'], dumps(message)))

            if message['type'] == 'mirror':
                return self._onMirrorPush(message)

            # kodi action (pause, stop, skip) on push dismiss (from devices)
            elif message['type'] == 'dismissal':
                return self._onDismissPush(message, self.cmdOnDismissPush)

            elif message['type'] == 'link':
                return self._onMessageLink(message)

            elif message['type'] == 'file':
                return self._onMessageFile(message)

            elif message['type'] == 'note':
                return self._onMessageNote(message)

            elif message['type'] == 'address':
                return self._onMessageAddress(message)

            elif message['type'] == 'list':
                return self._onMessageList(message)


        except Exception as ex:
            common.traceError()
            common.log(' '.join(str(arg) for arg in ex.args), xbmc.LOGERROR) 
Example #30
Source File: artworkprocessor.py    From script.artwork.beef with MIT License 5 votes vote down vote up
def _process_chunk(self, medialist, singleitemlist, singleitem):
        artcount = 0
        currentitem = 0
        aborted = False
        for mediaitem in medialist:
            if is_excluded(mediaitem):
                continue
            if mediaitem.mediatype in mediatypes.audiotypes and get_kodi_version() < 18:
                continue
            self.update_progress(currentitem * 100 // len(medialist), mediaitem.label)
            info.add_additional_iteminfo(mediaitem, self.processed, None if self.localmode else search)
            currentitem += 1
            try:
                services_hit = self._process_item(mediaitem, singleitem)
            except FileError as ex:
                services_hit = True
                mediaitem.error = ex.message
                log(ex.message, xbmc.LOGERROR)
                self.notify_warning(ex.message, None, True)
            reporting.report_item(mediaitem, singleitemlist or mediaitem.error)
            artcount += len(mediaitem.updatedart)

            if not services_hit:
                if self.monitor.abortRequested():
                    aborted = True
                    break
            elif self.monitor.waitForAbort(THROTTLE_TIME):
                aborted = True
                break
        return aborted, currentitem, artcount