• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.logMsg函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utils.logMsg函数的典型用法代码示例。如果您正苦于以下问题:Python logMsg函数的具体用法?Python logMsg怎么用?Python logMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了logMsg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: GetPlexMetadata

def GetPlexMetadata(key):
    """
    Returns raw API metadata for key as an etree XML.

    Can be called with either Plex key '/library/metadata/xxxx'metadata
    OR with the digits 'xxxx' only.

    Returns None if something went wrong
    """
    key = str(key)
    if '/library/metadata/' in key:
        url = "{server}" + key
    else:
        url = "{server}/library/metadata/" + key
    arguments = {
        'checkFiles': 1,            # No idea
        'includeExtras': 1,         # Trailers and Extras => Extras
        # 'includeRelated': 1,        # Similar movies => Video -> Related
        # 'includeRelatedCount': 5,
        # 'includeOnDeck': 1,
        'includeChapters': 1,
        'includePopularLeaves': 1,
        'includeConcerts': 1
    }
    url = url + '?' + urlencode(arguments)
    xml = downloadutils.DownloadUtils().downloadUrl(url)
    # Did we receive a valid XML?
    try:
        xml.attrib
    # Nope we did not receive a valid XML
    except AttributeError:
        logMsg(title, "Error retrieving metadata for %s" % url, -1)
        xml = None
    return xml
开发者ID:gdachs,项目名称:PlexKodiConnect,代码行数:34,代码来源:PlexFunctions.py


示例2: refreshPlaylist

def refreshPlaylist():

    lib = librarysync.LibrarySync()
    dialog = xbmcgui.Dialog()
    try:
        # First remove playlists
        utils.deletePlaylists()
        # Remove video nodes
        utils.deleteNodes()
        # Refresh views
        lib.refreshViews()
        dialog.notification(
                heading="Emby for Kodi",
                message="Emby playlists/nodes refreshed",
                icon="special://home/addons/plugin.video.emby/icon.png",
                time=1000,
                sound=False)

    except Exception as e:
        utils.logMsg("EMBY", "Refresh playlists/nodes failed: %s" % e, 1)
        dialog.notification(
            heading="Emby for Kodi",
            message="Emby playlists/nodes refresh failed",
            icon=xbmcgui.NOTIFICATION_ERROR,
            time=1000,
            sound=False)
开发者ID:angelblue05,项目名称:Embytest.Kodi,代码行数:26,代码来源:entrypoint.py


示例3: GetPlexPlaylist

def GetPlexPlaylist(itemid, librarySectionUUID, mediatype='movie'):
    """
    Returns raw API metadata XML dump for a playlist with e.g. trailers.
   """
    trailerNumber = settings('trailerNumber')
    if not trailerNumber:
        trailerNumber = '3'
    url = "{server}/playQueues"
    args = {
        'type': mediatype,
        'uri': 'library://' + librarySectionUUID +
                    '/item/%2Flibrary%2Fmetadata%2F' + itemid,
        'includeChapters': '1',
        'extrasPrefixCount': trailerNumber,
        'shuffle': '0',
        'repeat': '0'
    }
    xml = downloadutils.DownloadUtils().downloadUrl(
        url + '?' + urlencode(args), action_type="POST")
    try:
        xml[0].tag
    except (IndexError, TypeError, AttributeError):
        logMsg(title, "Error retrieving metadata for %s" % url, -1)
        return None
    return xml
开发者ID:4everGhost,项目名称:PlexKodiConnect,代码行数:25,代码来源:PlexFunctions.py


示例4: PMSHttpsEnabled

def PMSHttpsEnabled(url):
    """
    Returns True if the PMS can talk https, False otherwise.
    None if error occured, e.g. the connection timed out

    Call with e.g. url='192.168.0.1:32400' (NO http/https)

    This is done by GET /identity (returns an error if https is enabled and we
    are trying to use http)

    Prefers HTTPS over HTTP
    """
    doUtils = downloadutils.DownloadUtils().downloadUrl
    res = doUtils('https://%s/identity' % url,
                  authenticate=False,
                  verifySSL=False)
    try:
        res.attrib
    except AttributeError:
        # Might have SSL deactivated. Try with http
        res = doUtils('http://%s/identity' % url,
                      authenticate=False,
                      verifySSL=False)
        try:
            res.attrib
        except AttributeError:
            logMsg(title, "Could not contact PMS %s" % url, -1)
            return None
        else:
            # Received a valid XML. Server wants to talk HTTP
            return False
    else:
        # Received a valid XML. Server wants to talk HTTPS
        return True
开发者ID:4everGhost,项目名称:PlexKodiConnect,代码行数:34,代码来源:PlexFunctions.py


示例5: getSongTags

def getSongTags(file):
    # Get the actual ID3 tags for music songs as the server is lacking that info
    rating = 0
    comment = ""
    hasEmbeddedCover = False
    
    isTemp,filename = getRealFileName(file)
    logMsg( "getting song ID3 tags for " + filename)
    
    try:
        ###### FLAC FILES #############
        if filename.lower().endswith(".flac"):
            audio = FLAC(filename)
            if audio.get("comment"):
                comment = audio.get("comment")[0]
            for pic in audio.pictures:
                if pic.type == 3 and pic.data:
                    #the file has an embedded cover
                    hasEmbeddedCover = True
                    break
            if audio.get("rating"):
                rating = float(audio.get("rating")[0])
                #flac rating is 0-100 and needs to be converted to 0-5 range
                if rating > 5: rating = (rating / 100) * 5
        
        ###### MP3 FILES #############
        elif filename.lower().endswith(".mp3"):
            audio = ID3(filename)
            
            if audio.get("APIC:Front Cover"):
                if audio.get("APIC:Front Cover").data:
                    hasEmbeddedCover = True
            
            if audio.get("comment"):
                comment = audio.get("comment")[0]
            if audio.get("POPM:Windows Media Player 9 Series"):
                if audio.get("POPM:Windows Media Player 9 Series").rating:
                    rating = float(audio.get("POPM:Windows Media Player 9 Series").rating)
                    #POPM rating is 0-255 and needs to be converted to 0-5 range
                    if rating > 5: rating = (rating / 255) * 5
        else:
            logMsg( "Not supported fileformat or unable to access file: %s" %(filename))
        
        #the rating must be a round value
        rating = int(round(rating,0))
    
    except Exception as e:
        #file in use ?
        utils.logMsg("Exception in getSongTags", str(e),0)
        rating = None
    
    #remove tempfile if needed....
    if isTemp: xbmcvfs.delete(filename)
        
    return (rating, comment, hasEmbeddedCover)
开发者ID:mattsch,项目名称:PlexKodiConnect,代码行数:55,代码来源:musicutils.py


示例6: resetAuth

def resetAuth():
    # User tried login and failed too many times
    resp = xbmcgui.Dialog().yesno(
                heading="Warning",
                line1=(
                    "Emby might lock your account if you fail to log in too many times. "
                    "Proceed anyway?"))
    if resp == 1:
        utils.logMsg("EMBY", "Reset login attempts.", 1)
        utils.window('emby_serverStatus', value="Auth")
    else:
        xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
开发者ID:angelblue05,项目名称:Embytest.Kodi,代码行数:12,代码来源:entrypoint.py


示例7: __init__

    def __init__(self):

        self.enableTextureCache = utils.settings('enableTextureCache') == "true"
        self.imageCacheLimitThreads = int(utils.settings("imageCacheLimit"))
        self.imageCacheLimitThreads = int(self.imageCacheLimitThreads * 5);
        utils.logMsg("Using Image Cache Thread Count: " + str(self.imageCacheLimitThreads), 1)
        
        if not self.xbmc_port and self.enableTextureCache:
            self.setKodiWebServerDetails()

        self.userId = utils.window('currUserId')
        self.server = utils.window('pms_server')
开发者ID:aglv,项目名称:PlexKodiConnect,代码行数:12,代码来源:artwork.py


示例8: __init__

    def __init__(self):
        self.clientinfo = clientinfo.ClientInfo()
        self.addonName = self.clientinfo.getAddonName()

        self.enableTextureCache = utils.settings('enableTextureCache') == "true"
        self.imageCacheLimitThreads = int(utils.settings("imageCacheLimit"))
        self.imageCacheLimitThreads = int(self.imageCacheLimitThreads * 5);
        utils.logMsg("Using Image Cache Thread Count: " + str(self.imageCacheLimitThreads), 1)
        
        if not self.xbmc_port and self.enableTextureCache:
            self.setKodiWebServerDetails()

        self.userId = utils.window('emby_currUser')
        self.server = utils.window('emby_server%s' % self.userId)
开发者ID:fagensden,项目名称:plugin.video.emby,代码行数:14,代码来源:artwork.py


示例9: scrobble

def scrobble(ratingKey, state):
    """
    Tells the PMS to set an item's watched state to state="watched" or
    state="unwatched"
    """
    args = {
        'key': ratingKey,
        'identifier': 'com.plexapp.plugins.library'
    }
    if state == "watched":
        url = "{server}/:/scrobble?" + urlencode(args)
    elif state == "unwatched":
        url = "{server}/:/unscrobble?" + urlencode(args)
    else:
        return
    downloadutils.DownloadUtils().downloadUrl(url)
    logMsg(title, "Toggled watched state for Plex item %s" % ratingKey, 1)
开发者ID:4everGhost,项目名称:PlexKodiConnect,代码行数:17,代码来源:PlexFunctions.py


示例10: GetMachineIdentifier

def GetMachineIdentifier(url):
    """
    Returns the unique PMS machine identifier of url

    Returns None if something went wrong
    """
    xml = downloadutils.DownloadUtils().downloadUrl(url + '/identity')
    try:
        xml.attrib
    except:
        logMsg(title, 'Could not get the PMS machineIdentifier for %s'
               % url, -1)
        return None
    machineIdentifier = xml.attrib.get('machineIdentifier')
    logMsg(title, 'Found machineIdentifier %s for %s'
           % (machineIdentifier, url), 1)
    return machineIdentifier
开发者ID:mattsch,项目名称:PlexKodiConnect,代码行数:17,代码来源:PlexFunctions.py


示例11: GetMachineIdentifier

def GetMachineIdentifier(url):
    """
    Returns the unique PMS machine identifier of url

    Returns None if something went wrong
    """
    xml = downloadutils.DownloadUtils().downloadUrl('%s/identity' % url,
                                                    authenticate=False,
                                                    verifySSL=False,
                                                    timeout=4)
    try:
        machineIdentifier = xml.attrib['machineIdentifier']
    except (AttributeError, KeyError):
        logMsg(title, 'Could not get the PMS machineIdentifier for %s'
               % url, -1)
        return None
    logMsg(title, 'Found machineIdentifier %s for the PMS %s'
           % (machineIdentifier, url), 1)
    return machineIdentifier
开发者ID:4everGhost,项目名称:PlexKodiConnect,代码行数:19,代码来源:PlexFunctions.py


示例12: resetDeviceId

def resetDeviceId():

    dialog = xbmcgui.Dialog()
    language = utils.language

    deviceId_old = utils.window('emby_deviceId')
    try:
        utils.window('emby_deviceId', clear=True)
        deviceId = clientinfo.ClientInfo().getDeviceId(reset=True)
    except Exception as e:
        utils.logMsg("EMBY", "Failed to generate a new device Id: %s" % e, 1)
        dialog.ok(
            heading="Emby for Kodi",
            line1=language(33032))
    else:
        utils.logMsg("EMBY", "Successfully removed old deviceId: %s New deviceId: %s"
                    % (deviceId_old, deviceId), 1)
        dialog.ok(
            heading="Emby for Kodi",
            line1=language(33033))
        xbmc.executebuiltin('RestartApp')
开发者ID:angelblue05,项目名称:Embytest.Kodi,代码行数:21,代码来源:entrypoint.py


示例13: DownloadChunks

def DownloadChunks(url, containerSize):
    """
    Downloads PMS url in chunks of containerSize (int).
    If containerSize is None: ONE xml is fetched directly

    url MUST end with '?' (if no other url encoded args are present) or '&'

    Returns a stitched-together xml or None.
    """
    if containerSize is None:
        # Get rid of '?' or '&' at the end of url
        xml = downloadutils.DownloadUtils().downloadUrl(url[:-1])
        try:
            xml.attrib
        except AttributeError:
            # Nope, not an XML, abort
            logMsg(title, "Error getting url %s" % url[:-1], -1)
            return None
        else:
            return xml

    xml = None
    pos = 0
    errorCounter = 0
    while errorCounter < 10:
        args = {
            'X-Plex-Container-Size': containerSize,
            'X-Plex-Container-Start': pos
        }
        xmlpart = downloadutils.DownloadUtils().downloadUrl(
            url + urlencode(args))
        # If something went wrong - skip in the hope that it works next time
        try:
            xmlpart.attrib
        except AttributeError:
            logMsg(title, 'Error while downloading chunks: %s'
                   % (url + urlencode(args)), -1)
            pos += containerSize
            errorCounter += 1
            continue

        # Very first run: starting xml (to retain data in xml's root!)
        if xml is None:
            xml = deepcopy(xmlpart)
            if len(xmlpart) < containerSize:
                break
            else:
                pos += containerSize
                continue
        # Build answer xml - containing the entire library
        for child in xmlpart:
            xml.append(child)
        # Done as soon as we don't receive a full complement of items
        if len(xmlpart) < containerSize:
            break
        pos += containerSize
    if errorCounter == 10:
        logMsg(title, 'Fatal error while downloading chunks for %s' % url, -1)
        return None
    return xml
开发者ID:gdachs,项目名称:PlexKodiConnect,代码行数:60,代码来源:PlexFunctions.py


示例14: getExtraFanArt

def getExtraFanArt(embyId,embyPath):
    
    emby = embyserver.Read_EmbyServer()
    art = artwork.Artwork()
    
    # Get extrafanart for listitem 
    # will be called by skinhelper script to get the extrafanart
    try:
        # for tvshows we get the embyid just from the path
        if not embyId:
            if "plugin.video.emby" in embyPath:
                embyId = embyPath.split("/")[-2]
        
        if embyId:
            #only proceed if we actually have a emby id
            utils.logMsg("EMBY", "Requesting extrafanart for Id: %s" % embyId, 0)

            # We need to store the images locally for this to work
            # because of the caching system in xbmc
            fanartDir = xbmc.translatePath("special://thumbnails/emby/%s/" % embyId).decode('utf-8')
            
            if not xbmcvfs.exists(fanartDir):
                # Download the images to the cache directory
                xbmcvfs.mkdirs(fanartDir)
                item = emby.getItem(embyId)
                if item:
                    backdrops = art.getAllArtwork(item)['Backdrop']
                    tags = item['BackdropImageTags']
                    count = 0
                    for backdrop in backdrops:
                        # Same ordering as in artwork
                        tag = tags[count]
                        if os.path.supports_unicode_filenames:
                            fanartFile = os.path.join(fanartDir, "fanart%s.jpg" % tag)
                        else:
                            fanartFile = os.path.join(fanartDir.encode("utf-8"), "fanart%s.jpg" % tag.encode("utf-8"))
                        li = xbmcgui.ListItem(tag, path=fanartFile)
                        xbmcplugin.addDirectoryItem(
                                            handle=int(sys.argv[1]),
                                            url=fanartFile,
                                            listitem=li)
                        xbmcvfs.copy(backdrop, fanartFile) 
                        count += 1               
            else:
                utils.logMsg("EMBY", "Found cached backdrop.", 2)
                # Use existing cached images
                dirs, files = xbmcvfs.listdir(fanartDir)
                for file in files:
                    fanartFile = os.path.join(fanartDir, file.decode('utf-8'))
                    li = xbmcgui.ListItem(file, path=fanartFile)
                    xbmcplugin.addDirectoryItem(
                                            handle=int(sys.argv[1]),
                                            url=fanartFile,
                                            listitem=li)
    except Exception as e:
        utils.logMsg("EMBY", "Error getting extrafanart: %s" % e, 0)
    
    # Always do endofdirectory to prevent errors in the logs
    xbmcplugin.endOfDirectory(int(sys.argv[1]))
开发者ID:angelblue05,项目名称:Embytest.Kodi,代码行数:59,代码来源:entrypoint.py


示例15: deleteItem

def deleteItem():

    # Serves as a keymap action
    if xbmc.getInfoLabel('ListItem.Property(embyid)'): # If we already have the embyid
        embyid = xbmc.getInfoLabel('ListItem.Property(embyid)')
    else:
        dbid = xbmc.getInfoLabel('ListItem.DBID')
        itemtype = xbmc.getInfoLabel('ListItem.DBTYPE')

        if not itemtype:

            if xbmc.getCondVisibility('Container.Content(albums)'):
                itemtype = "album"
            elif xbmc.getCondVisibility('Container.Content(artists)'):
                itemtype = "artist"
            elif xbmc.getCondVisibility('Container.Content(songs)'):
                itemtype = "song"
            elif xbmc.getCondVisibility('Container.Content(pictures)'):
                itemtype = "picture"
            else:
                utils.logMsg("EMBY delete", "Unknown type, unable to proceed.", 1)
                return

        embyconn = utils.kodiSQL('emby')
        embycursor = embyconn.cursor()
        emby_db = embydb.Embydb_Functions(embycursor)
        item = emby_db.getItem_byKodiId(dbid, itemtype)
        embycursor.close()

        try:
            embyid = item[0]
        except TypeError:
            utils.logMsg("EMBY delete", "Unknown embyId, unable to proceed.", 1)
            return

    if utils.settings('skipContextMenu') != "true":
        resp = xbmcgui.Dialog().yesno(
                                heading="Confirm delete",
                                line1=("Delete file from Emby Server? This will "
                                        "also delete the file(s) from disk!"))
        if not resp:
            utils.logMsg("EMBY delete", "User skipped deletion for: %s." % embyid, 1)
            return
    
    doUtils = downloadutils.DownloadUtils()
    url = "{server}/emby/Items/%s?format=json" % embyid
    utils.logMsg("EMBY delete", "Deleting request: %s" % embyid, 0)
    doUtils.downloadUrl(url, type="DELETE")
开发者ID:angelblue05,项目名称:Embytest.Kodi,代码行数:48,代码来源:entrypoint.py


示例16: GetPlexCollections

def GetPlexCollections(mediatype):
    """
    Input:
        mediatype           String or list of strings with possible values
                            'movie', 'show', 'artist', 'photo'
    Output:
        List with an entry of the form:
        {
        'name': xxx         Plex title for the media section
        'type': xxx         Plex type: 'movie', 'show', 'artist', 'photo'
        'id': xxx           Plex unique key for the section (1, 2, 3...)
        'uuid': xxx         Other unique Plex key, e.g.
                            74aec9f2-a312-4723-9436-de2ea43843c1
        }
    Returns an empty list if nothing is found.
    """
    collections = []
    url = "{server}/library/sections"
    xml = downloadutils.DownloadUtils().downloadUrl(url)
    try:
        xml.attrib
    except AttributeError:
        logMsg(title, 'Could not download PMS sections for %s' % url, -1)
        return {}
    for item in xml:
        contentType = item['type']
        if contentType in mediatype:
            name = item['title']
            contentId = item['key']
            uuid = item['uuid']
            collections.append({
                'name': name,
                'type': contentType,
                'id': str(contentId),
                'uuid': uuid
            })
    return collections
开发者ID:4everGhost,项目名称:PlexKodiConnect,代码行数:37,代码来源:PlexFunctions.py


示例17: PMSHttpsEnabled

def PMSHttpsEnabled(url):
    """
    Returns True if the PMS wants to talk https, False otherwise. None if error
    occured, e.g. the connection timed out

    With with e.g. url=192.168.0.1:32400 (NO http/https)

    This is done by GET /identity (returns an error if https is enabled and we
    are trying to use http)

    Prefers HTTPS over HTTP
    """
    # True if https, False if http
    answer = True
    try:
        # Don't use downloadutils here, otherwise we may get un-authorized!
        res = requests.get('https://%s/identity' % url,
                           headers={},
                           verify=False,
                           timeout=(3, 10))
        # Don't verify SSL since we can connect for sure then!
    except requests.exceptions.ConnectionError as e:
        # Might have SSL deactivated. Try with http
        try:
            res = requests.get('http://%s/identity' % url,
                               headers={},
                               timeout=(3, 10))
        except requests.exceptions.ConnectionError as e:
            logMsg(title, "Server is offline or cannot be reached. Url: %s"
                   ", Error message: %s" % (url, e), -1)
            return None
        except requests.exceptions.ReadTimeout:
            logMsg(title, "Server timeout reached for Url %s" % url, -1)
            return None
        else:
            answer = False
    except requests.exceptions.ReadTimeout:
        logMsg(title, "Server timeout reached for Url %s" % url, -1)
        return None
    if res.status_code == requests.codes.ok:
        return answer
    else:
        return None
开发者ID:gdachs,项目名称:PlexKodiConnect,代码行数:43,代码来源:PlexFunctions.py


示例18: __init__

    def __init__(self):

        # Parse parameters
        base_url = sys.argv[0]
        params = urlparse.parse_qs(sys.argv[2][1:])
        xbmc.log("Parameter string: %s" % sys.argv[2])
        try:
            mode = params["mode"][0]
            itemid = params.get("id")
            if itemid:
                itemid = itemid[0]
        except:
            params = {}
            mode = ""

        modes = {
            "reset": utils.reset,
            "resetauth": entrypoint.resetAuth,
            "extrafanart": entrypoint.getExtraFanArt,
            "play": entrypoint.doPlayback,
            "passwords": utils.passwordsXML,
            "adduser": entrypoint.addUser,
            "thememedia": entrypoint.getThemeMedia,
            "channels": entrypoint.BrowseChannels,
            "channelsfolder": entrypoint.BrowseChannels,
            "browsecontent": entrypoint.BrowseContent,
            "getsubfolders": entrypoint.GetSubFolders,
            "nextup": entrypoint.getNextUpEpisodes,
            "inprogressepisodes": entrypoint.getInProgressEpisodes,
            "recentepisodes": entrypoint.getRecentEpisodes,
            "refreshplaylist": entrypoint.refreshPlaylist,
        }

        if "extrafanart" in sys.argv[0]:
            entrypoint.getExtraFanArt()

        if modes.get(mode):
            # Simple functions
            if mode == "play":
                dbid = params.get("dbid")
                modes[mode](itemid, dbid)

            elif mode in ("nextup", "inprogressepisodes", "recentepisodes"):
                limit = int(params["limit"][0])
                modes[mode](itemid, limit)

            elif mode in ["channels", "getsubfolders"]:
                modes[mode](itemid)

            elif mode == "browsecontent":
                modes[mode](itemid, params.get("type", [""])[0], params.get("folderid", [""])[0])

            elif mode == "channelsfolder":
                folderid = params["folderid"][0]
                modes[mode](itemid, folderid)

            else:
                modes[mode]()
        else:
            # Other functions
            if mode == "settings":
                xbmc.executebuiltin("Addon.OpenSettings(plugin.video.emby)")
            elif mode in ("manualsync", "repair"):
                if utils.window("emby_dbScan") != "true":
                    import librarysync

                    lib = librarysync.LibrarySync()
                    if mode == "manualsync":
                        librarysync.ManualSync()
                    else:
                        lib.fullSync(repair=True)
                else:
                    utils.logMsg("EMBY", "Database scan is already running.", 1)

            elif mode == "texturecache":
                import artwork

                artwork.Artwork().FullTextureCacheSync()
            else:
                entrypoint.doMainListing()
开发者ID:Alwin-Hummels,项目名称:plugin.video.emby,代码行数:80,代码来源:default.py


示例19: BrowseContent

def BrowseContent(viewname, type="", folderid=""):
    
    emby = embyserver.Read_EmbyServer()
    art = artwork.Artwork()
    doUtils = downloadutils.DownloadUtils()
    
    #folderid used as filter ?
    if folderid in ["recent","recentepisodes","inprogress","inprogressepisodes","unwatched","nextepisodes","sets","genres","random","recommended"]:
        filter = folderid
        folderid = ""
    else:
        filter = ""
    
    xbmcplugin.setPluginCategory(int(sys.argv[1]), viewname)
    #get views for root level
    if not folderid:
        views = emby.getViews(type)
        for view in views:
            if view.get("name") == viewname.decode('utf-8'):
                folderid = view.get("id")
    
    utils.logMsg("BrowseContent","viewname: %s - type: %s - folderid: %s - filter: %s" %(viewname.decode('utf-8'), type.decode('utf-8'), folderid.decode('utf-8'), filter.decode('utf-8')))
    #set the correct params for the content type
    #only proceed if we have a folderid
    if folderid:
        if type.lower() == "homevideos":
            xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
            itemtype = "Video,Folder,PhotoAlbum"
        elif type.lower() == "photos":
            xbmcplugin.setContent(int(sys.argv[1]), 'files')
            itemtype = "Photo,PhotoAlbum,Folder"
        else:
            itemtype = ""
        
        #get the actual listing
        if type == "recordings":
            listing = emby.getTvRecordings(folderid)
        elif type == "tvchannels":
            listing = emby.getTvChannels()
        elif filter == "recent":
            listing = emby.getFilteredSection(folderid, itemtype=itemtype.split(",")[0], sortby="DateCreated", recursive=True, limit=25, sortorder="Descending")
        elif filter == "random":
            listing = emby.getFilteredSection(folderid, itemtype=itemtype.split(",")[0], sortby="Random", recursive=True, limit=150, sortorder="Descending")
        elif filter == "recommended":
            listing = emby.getFilteredSection(folderid, itemtype=itemtype.split(",")[0], sortby="SortName", recursive=True, limit=25, sortorder="Ascending", filter="IsFavorite")
        elif filter == "sets":
            listing = emby.getFilteredSection(folderid, itemtype=itemtype.split(",")[1], sortby="SortName", recursive=True, limit=25, sortorder="Ascending", filter="IsFavorite")
        else:
            listing = emby.getFilteredSection(folderid, itemtype=itemtype, recursive=False)
        
        #process the listing
        if listing:
            for item in listing.get("Items"):
                li = createListItemFromEmbyItem(item,art,doUtils)
                if item.get("IsFolder") == True:
                    #for folders we add an additional browse request, passing the folderId
                    path = "%s?id=%s&mode=browsecontent&type=%s&folderid=%s" % (sys.argv[0].decode('utf-8'), viewname.decode('utf-8'), type.decode('utf-8'), item.get("Id").decode('utf-8'))
                    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=path, listitem=li, isFolder=True)
                else:
                    #playable item, set plugin path and mediastreams
                    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=li.getProperty("path"), listitem=li)


    if filter == "recent":
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
    else:
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_TITLE)
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RATING)
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RUNTIME)

    xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
开发者ID:angelblue05,项目名称:Embytest.Kodi,代码行数:72,代码来源:entrypoint.py


示例20: logMsg

def logMsg(msg, lvl=1):
    utils.logMsg("%s %s" % ("PlexKodiConnect", "Contextmenu"), msg, lvl)
开发者ID:4everGhost,项目名称:PlexKodiConnect,代码行数:2,代码来源:contextmenu.py



注:本文中的utils.logMsg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.log_api_action函数代码示例发布时间:2022-05-26
下一篇:
Python utils.logMessage函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap