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


Python DownloadUtils.downloadUrl方法代码示例

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


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

示例1: getViewCollections

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
    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,代码行数:35,代码来源:ReadEmbyDB.py

示例2: userPreferences

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
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,代码行数:18,代码来源:Entrypoint.py

示例3: getMusicVideos

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
    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,代码行数:30,代码来源:ReadEmbyDB.py

示例4: getMusicAlbums

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
    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,代码行数:35,代码来源:ReadEmbyDB.py

示例5: getMusicVideos

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
    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,代码行数:27,代码来源:ReadEmbyDB.py

示例6: getLatestEpisodes

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
 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,代码行数:29,代码来源:ReadEmbyDB.py

示例7: getMovies

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
    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,代码行数:37,代码来源:ReadEmbyDB.py

示例8: updatePlayCountFromKodi

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
    def updatePlayCountFromKodi(self, id, type, playcount=0):
        #when user marks item watched from kodi interface update this in Emby
        
        utils.logMsg("Emby", "updatePlayCountFromKodi Called")
        connection = utils.KodiSQL()
        cursor = connection.cursor()
        cursor.execute("SELECT emby_id FROM emby WHERE media_type=? AND kodi_id=?",(type,id))
        
        emby_id = cursor.fetchone()[0]
        cursor.close

        if(emby_id != None):
            addon = xbmcaddon.Addon(id='plugin.video.emby')   
            downloadUtils = DownloadUtils()       
            watchedurl = "{server}/mediabrowser/Users/{UserId}/PlayedItems/%s" % emby_id
            if playcount != 0:
                downloadUtils.downloadUrl(watchedurl, type="POST")
            else:
                downloadUtils.downloadUrl(watchedurl, type="DELETE")
开发者ID:SupDor,项目名称:Emby.Kodi,代码行数:21,代码来源:WriteKodiMusicDB.py

示例9: getCollections

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
 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,代码行数:13,代码来源:ReadEmbyDB.py

示例10: getItem

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
    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,代码行数:14,代码来源:ReadEmbyDB.py

示例11: getFullItem

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
    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,代码行数:14,代码来源:ReadEmbyDB.py

示例12: getMoviesInBoxSet

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
    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,代码行数:17,代码来源:ReadEmbyDB.py

示例13: getBoxSets

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
    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,代码行数:17,代码来源:ReadEmbyDB.py

示例14: getCollections

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
 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,代码行数:17,代码来源:ReadEmbyDB.py

示例15: getTVShowSeasons

# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import downloadUrl [as 别名]
    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,代码行数:17,代码来源:ReadEmbyDB.py


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