当前位置: 首页>>代码示例>>Python>>正文


Python DownloadUtils.DownloadUtils类代码示例

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


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

示例1: getViewCollections

    def getViewCollections(self, type):
        #Build a list of the user views
        doUtils = DownloadUtils()

        viewsUrl = "{server}/mediabrowser/Users/{UserId}/Views?format=json&ImageTypeLimit=1"
        jsonData = doUtils.downloadUrl(viewsUrl)
        collections=[]
        
        if (jsonData != ""):
            views = views[u'Items']

            for view in views:
                if (view[u'Type'] == 'UserView'): # Need to grab the real main node
                    newViewsUrl = "{server}/mediabrowser/Users/{UserId}/items?ParentId=%s&SortBy=SortName&SortOrder=Ascending&format=json&ImageTypeLimit=1" % view[u'Id']
                    jsonData = doUtils.downloadUrl(newViewsUrl)
                    if (jsonData != ""):
                        newViews = newViews[u'Items']
                        for newView in newViews:
                            # There are multiple nodes in here like 'Latest', 'NextUp' - below we grab the full node.
                            if newView[u'CollectionType'] == "MovieMovies" or newView[u'CollectionType'] == "TvShowSeries":
                                view=newView
                if (view[u'ChildCount'] != 0):
                    Name = view[u'Name'] 
                    
                total = str(view[u'ChildCount'])
                type = view[u'CollectionType']
                if type == None:
                    type = "None" # User may not have declared the type
                if type == type:
                    collections.append( {'title'      : Name,
                            'type'           : type,
                            'id'             : view[u'Id']})
        return collections
开发者ID:freddy36,项目名称:Emby.Kodi,代码行数:33,代码来源:ReadEmbyDB.py

示例2: getMusicVideos

    def getMusicVideos(self, itemList = []):
        
        result = []
        doUtils = DownloadUtils()

        #only get basic info for our sync-compares
        sortstring = "&SortBy=SortName"
        url = "{server}/mediabrowser/Users/{UserId}/items?%s&Fields=CumulativeRunTimeTicks,Etag&Recursive=true&SortOrder=Descending&IncludeItemTypes=MusicVideo&CollapseBoxSetItems=false&format=json&ImageTypeLimit=1" % sortstring
        
        jsonData = doUtils.downloadUrl(url)
        if (jsonData == ""):
            return result

        if (jsonData[u'Items'] != ""):
            result = jsonData[u'Items']
            
        # Work around to only return items from the given list
        if (result != None and len(result) > 0 and len(itemList) > 0):
            newResult = []
            for item in result:
                if (item[u'Id'] in itemList):
                    newResult.append(item)
            result = newResult

        return result
开发者ID:SupDor,项目名称:Emby.Kodi,代码行数:25,代码来源:ReadEmbyDB.py

示例3: getMovies

    def getMovies(self, id, fullinfo = False, fullSync = True, itemList = []):
        
        result = None
        doUtils = DownloadUtils()

        if fullSync:
            sortstring = "&SortBy=SortName"
        else:
            if(len(itemList) > 0): # if we want a certain list specify it
                #sortstring = "&Ids=" + ",".join(itemList)
                sortstring = "" # work around for now until ParetnId and Id work together
            else: # just get the last 20 created items
                sortstring = "&Limit=20&SortBy=DateCreated"
            
        if fullinfo:
            url = "{server}/mediabrowser/Users/{UserId}/items?ParentId=%s%s&Fields=Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&SortOrder=Descending&IncludeItemTypes=Movie&CollapseBoxSetItems=false&format=json&ImageTypeLimit=1" % (id, sortstring)
        else:
            url = "{server}/mediabrowser/Users/{UserId}/items?ParentId=%s%s&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=Movie&CollapseBoxSetItems=false&format=json&ImageTypeLimit=1" % (id, sortstring)

        jsonData = doUtils.downloadUrl(url)
        if (jsonData == ""):
            return result

        if (jsonData[u'Items'] != ""):
            result = jsonData[u'Items']

        # work around for now until ParetnId and Id work together
        if (result != None and len(result) > 0 and len(itemList) > 0):
            newResult = []
            for item in result:
                if (item[u'Id'] in itemList):
                    newResult.append(item)
            result = newResult
            
        return result
开发者ID:freddy36,项目名称:Emby.Kodi,代码行数:35,代码来源:ReadEmbyDB.py

示例4: getMusicVideos

    def getMusicVideos(self, fullinfo = False, fullSync = True):
        result = None
        
        addon = xbmcaddon.Addon(id='plugin.video.emby')
        port = addon.getSetting('port')
        host = addon.getSetting('ipaddress')
        server = host + ":" + port
        
        downloadUtils = DownloadUtils()
        userid = downloadUtils.getUserId()

        if not fullSync:
            sortstring = "&Limit=20&SortBy=DateCreated"
        else:
            sortstring = "&SortBy=SortName"
        
        if fullinfo:
            url = server + '/mediabrowser/Users/' + userid + '/items?' + sortstring + '&Fields=Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&SortOrder=Descending&IncludeItemTypes=MusicVideo&format=json&ImageTypeLimit=1'
        else:
            url = server + '/mediabrowser/Users/' + userid + '/items?' + sortstring + '&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=MusicVideo&CollapseBoxSetItems=false&format=json&ImageTypeLimit=1'
        
        jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
        if jsonData != None and jsonData != "":
            result = json.loads(jsonData)
            if(result.has_key('Items')):
                result = result['Items']

        return result
开发者ID:070499,项目名称:Emby.Kodi,代码行数:28,代码来源:ReadEmbyDB.py

示例5: getLatestEpisodes

 def getLatestEpisodes(self, fullinfo = False, itemList = []):
     result = None
     
     addon = xbmcaddon.Addon(id='plugin.video.emby')
     port = addon.getSetting('port')
     host = addon.getSetting('ipaddress')
     server = host + ":" + port
     
     downloadUtils = DownloadUtils()
     userid = downloadUtils.getUserId()   
     
     limitString = "Limit=20&SortBy=DateCreated&"
     if(len(itemList) > 0): # if we want a certain list specify it
         limitString = "Ids=" + ",".join(itemList) + "&"
     
     if fullinfo:
         url = server + '/mediabrowser/Users/' + userid + '/Items?' + limitString + 'IsVirtualUnaired=false&IsMissing=False&Fields=ParentId,Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&SortOrder=Descending&IncludeItemTypes=Episode&format=json&ImageTypeLimit=1'
     else:
         url = server + '/mediabrowser/Users/' + userid + '/Items?' + limitString + 'IsVirtualUnaired=false&IsMissing=False&Fields=ParentId,Name,SortName,CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=Episode&format=json&ImageTypeLimit=1'
     
     jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
     
     if jsonData != None and jsonData != "":
         result = json.loads(jsonData)
         if(result.has_key('Items')):
             result = result['Items']
     return result
开发者ID:070499,项目名称:Emby.Kodi,代码行数:27,代码来源:ReadEmbyDB.py

示例6: getMusicAlbums

    def getMusicAlbums(self, itemList = []):
        
        result = []
        doUtils = DownloadUtils()

        #only get basic info for our sync-compares
        url = "{server}/mediabrowser/Users/{UserId}/Items?Fields=Etag,Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&IncludeItemTypes=MusicAlbum&format=json"
        
        jsonData = doUtils.downloadUrl(url)
        if (jsonData == ""):
            return result

        if (jsonData[u'Items'] != ""):
            result = jsonData[u'Items']
            
            #only return valid albums - which have artists
            tempresult = []
            for item in result:
                if item["AlbumArtists"]:
                    tempresult.append(item)
            
            result = tempresult

            
        # Work around to only return items from the given list
        if (result != None and len(result) > 0 and len(itemList) > 0):
            newResult = []
            for item in result:
                if (item[u'Id'] in itemList):
                    newResult.append(item)
            result = newResult

        return result
开发者ID:jurmb84,项目名称:Emby.Kodi,代码行数:33,代码来源:ReadEmbyDB.py

示例7: ServiceEntryPoint

    def ServiceEntryPoint(self):

        xbmcgui.Window(10000).setProperty("XBMB3C_Service_Timestamp", str(int(time.time())))
        
        # auth the service
        try:
            downloadUtils = DownloadUtils()
            downloadUtils.authenticate()
        except Exception, e:
            pass
开发者ID:MediaBrowser,项目名称:MediaBrowser.Kodi,代码行数:10,代码来源:ServiceModule.py

示例8: getCollections

 def getCollections(self, type):
     #Build a list of the user views
     doUtils = DownloadUtils()
     
     try:
         url = "{server}/mediabrowser/Users/{UserId}/Items/Root?format=json"
         result = doUtils.downloadUrl(url)
     except Exception, msg:
         error = "Can't connect: %s" % msg
         xbmc.log(error)
         return []
开发者ID:SupDor,项目名称:Emby.Kodi,代码行数:11,代码来源:ReadEmbyDB.py

示例9: getFullItem

    def getFullItem(self, id):
        
        result = None
        doUtils = DownloadUtils()

        url = "{server}/mediabrowser/Users/{UserId}/Items/%s?format=json&Fields=Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview" % id
        
        jsonData = doUtils.downloadUrl(url)     
        if (jsonData != ""):
            result = jsonData

        return result
开发者ID:SupDor,项目名称:Emby.Kodi,代码行数:12,代码来源:ReadEmbyDB.py

示例10: getItem

    def getItem(self, id):
        
        result = None
        doUtils = DownloadUtils()

        url = "{server}/mediabrowser/Users/{UserId}/Items/%s?format=json&ImageTypeLimit=1&Fields=Etag" % id
        
        jsonData = doUtils.downloadUrl(url)     
        if (jsonData != ""):
            result = jsonData

        return result
开发者ID:SupDor,项目名称:Emby.Kodi,代码行数:12,代码来源:ReadEmbyDB.py

示例11: getTVShowSeasons

    def getTVShowSeasons(self, tvShowId):
        
        result = []
        doUtils = DownloadUtils()

        url = "{server}/Shows/%s/Seasons?UserId={UserId}&format=json&ImageTypeLimit=1" % tvShowId
        
        jsonData = doUtils.downloadUrl(url)
        if (jsonData == ""):
            return result

        if (jsonData[u'Items'] != ""):
            result = jsonData[u'Items']

        return result
开发者ID:SupDor,项目名称:Emby.Kodi,代码行数:15,代码来源:ReadEmbyDB.py

示例12: getCollections

 def getCollections(self, type):
     #Build a list of the user views
     userid = DownloadUtils().getUserId()  
     addon = xbmcaddon.Addon(id='plugin.video.emby')
     port = addon.getSetting('port')
     host = addon.getSetting('ipaddress')
     server = host + ":" + port
     downloadUtils = DownloadUtils()
     
     try:
         jsonData = downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items/Root?format=json")
     except Exception, msg:
         error = "Get connect : " + str(msg)
         xbmc.log (error)
         return []
开发者ID:070499,项目名称:Emby.Kodi,代码行数:15,代码来源:ReadEmbyDB.py

示例13: getMoviesInBoxSet

    def getMoviesInBoxSet(self,boxsetId):
        
        result = []
        doUtils = DownloadUtils()
        
        url = "{server}/mediabrowser/Users/{UserId}/Items?ParentId=%s&Fields=ItemCounts,Etag&format=json&ImageTypeLimit=1" % boxsetId
        
        jsonData = doUtils.downloadUrl(url)
        if (jsonData == ""):
            return result

        if (jsonData[u'Items'] != ""):
            result = jsonData[u'Items']

        return result
开发者ID:SupDor,项目名称:Emby.Kodi,代码行数:15,代码来源:ReadEmbyDB.py

示例14: getBoxSets

    def getBoxSets(self):
        
        result = []
        doUtils = DownloadUtils()  
        
        url = "{server}/mediabrowser/Users/{UserId}/Items?SortBy=SortName&IsVirtualUnaired=false&IsMissing=False&Fields=Name,SortName,CumulativeRunTimeTicks,Etag&Recursive=true&SortOrder=Ascending&IncludeItemTypes=BoxSet&format=json&ImageTypeLimit=1"
        
        jsonData = doUtils.downloadUrl(url)
        if (jsonData == ""):
            return result

        if (jsonData[u'Items'] != ""):
            result = jsonData[u'Items']

        return result
开发者ID:SupDor,项目名称:Emby.Kodi,代码行数:15,代码来源:ReadEmbyDB.py

示例15: userPreferences

def userPreferences():
    doUtils = DownloadUtils()
    addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
    userPreferencesPage = UserPreferences("script-emby-kodi-UserPreferences.xml", addonSettings.getAddonInfo('path'), "default", "1080i")
    url = "{server}/mediabrowser/Users/{UserId}" 
    result = doUtils.downloadUrl(url)
    configuration = result[u'Configuration']
    userPreferencesPage.setConfiguration(configuration)
    userPreferencesPage.setName(result[u'Name'])
    userPreferencesPage.setImage(API().getUserArtwork(result,"Primary"))
    
    userPreferencesPage.doModal()
    if userPreferencesPage.isSave():
        url = "{server}/mediabrowser/Users/{UserId}/Configuration"
        postdata = userPreferencesPage.getConfiguration()
        doUtils.downloadUrl(url, postBody=postdata, type="POST")
开发者ID:goofwear,项目名称:Emby.Kodi,代码行数:16,代码来源:Entrypoint.py


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