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

Python dev.log函数代码示例

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

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



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

示例1: playlist_add_episode

def playlist_add_episode(playlist, season, id, season_tag='season', type=''):
    dev.log('playlist_add_episode('+season+','+id+', type='+type+')')
    #Check if this playlist isnt in the xml file yet
    #if xml_get_elem('season', 'episode', {'id' : id}, playlist=playlist) is None:
    #Build the playlist
    #doc = playlist_xml_get(playlist)
    
    #s = doc.find("season[@number='"+season+"']")
    s = xml_get_elem(season_tag, season_tag, {'number': season}, playlist=playlist, type=type)
    if s is None:
        playlist_add_season(playlist, season, type=type)
        #doc = playlist_xml_get(playlist)
        #s = doc.find("season[@number='"+season+"']")
        s = xml_get_elem(season_tag, season_tag, {'number': season}, playlist=playlist, type=type)
        
    #doc = playlist_xml_get(playlist)
    global playlistdocument
    attr = { 'id' : id}
    elem = Element('episode', attr)
    
    s.insert(0, elem)
    root = playlistdocument.getroot()
    
    write_xml(root, dir=dev.typeEpnr(type), output=playlist+'.xml')
    dev.log('Added the episode '+id+' to '+season_tag+': '+season+' in '+dev.typeEpnr(type)+'/'+playlist+'.xml')
    #else:
        #dev.log('playlist_add_episode: not added episode '+id+' since the episode already exists')    
开发者ID:csabakeszegh,项目名称:repo.plugin.video.youtubelibrary,代码行数:27,代码来源:m_xml.py


示例2: playYoutubeVid

def playYoutubeVid(id, meta=None, poster=None):
    '''
    from resources.lib import pafy
    pafy.set_api_key(vars.API_KEY)
    #Resolve the youtube video url for ourselves
    v = pafy.new(id)
    stream_url = v.getbest().url
    '''
    if meta is None:
        #Create an empty meta, so we can fill it with the information grabbed from youtube
        meta = {}
    if 'title' not in meta:
        meta['title'] = v.title #Store the youtube title in the meta  
    if poster is None:
        poster = 'Default.png'
    
    
    #YDStreamExtractor.disableDASHVideo(True) #Kodi (XBMC) only plays the video for DASH streams, so you don't want these normally. Of course these are the only 1080p streams on YouTube
    try:
        #url = id #a youtube ID will work as well and of course you could pass the url of another site
        vid = YDStreamExtractor.getVideoInfo(id,quality=1) #quality is 0=SD, 1=720p, 2=1080p and is a maximum
        stream_url = vid.streamURL() #This is what Kodi (XBMC) will play
    except:
        dev.log('Failed to get a valid stream_url!')
        return False #Failed to grab a video title
    
    
    #xbmc.Player().play(v.getbest().url) #Play this video
    liz = xbmcgui.ListItem(meta['title'], iconImage=poster, thumbnailImage=poster)
    liz.setInfo( type="Video", infoLabels=meta )
    liz.setPath(stream_url)
    return xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:32,代码来源:play.py


示例3: number_of_episodes

def number_of_episodes(playlist, season, season_tag='season', type=''):
    s = xml_get_elem(season_tag, season_tag, {'number': season}, playlist=playlist, type=type)
    if s == None:
        dev.log('number_of_episodes('+type+'): Could not find '+season_tag+' '+season+' in playlist '+playlist)
        return None
    dev.log('number_of_episodes('+type+'): Found '+str(len(s))+' episodes in '+season_tag+' '+season)
    return len(s)
开发者ID:csabakeszegh,项目名称:repo.plugin.video.youtubelibrary,代码行数:7,代码来源:m_xml.py


示例4: delete_playlist

def delete_playlist(id, type=''):
    #Grab the settings from this playlist
    settings = m_xml.xml_get_elem('playlists/playlist', 'playlist', {'id': id}, type=type) #Grab the xml settings for this playlist
    if settings is None:
        dev.log('deletePlaylist: Could not find playlist '+id+' in the '+dev.typeXml(type)+' file', True)
        return False
    else:         
        i = xbmcgui.Dialog().yesno("Delete Playlist", "Are you sure you want to delete this playlist?")
        if i == 0:
            editPlaylist(id, type=type)
        else:
            if m_xml.xml_remove_playlist(id, type=type) is True:
                #Remove the episodenr xml file to
                file = os.path.join(vars.settingsPath+dev.typeEpnr(type), id+'.xml' )
                if os.path.isfile(file):
                    success = os.remove(file) #Remove the episodenr xml file
                
                xbmcgui.Dialog().ok('Removed Playlist', 'Succesfully removed playlist '+id)
                i = xbmcgui.Dialog().yesno('Delete from library', 'Do you also want to delete the videos from your library?')
                if i != 0:
                    #Check in which folder the show resides
                    folder = settings.find('overwritefolder').text
                    if folder is None or folder == '':
                        folder = dev.legal_filename(settings.find('title').text) #Overwrite folder is not set in settings.xml, so set the folder to the title of the show
                    else:
                        folder = dev.legal_filename(folder)
                    movieLibrary = vars.tv_folder #Use the directory from the addon settings
                    if type == 'musicvideo':
                        movieLibrary = vars.musicvideo_folder
                    elif type == 'movies':
                        movieLibrary = vars.movies_folder
                    dir = os.path.join(movieLibrary, folder) #Set the folder to the maindir/dir
                    
                    success = shutil.rmtree(dir, ignore_errors=True) #Remove the directory
                    xbmcgui.Dialog().ok('Removed from library', 'Deleted the videos from your library (You should clean your library, otherwise they will still show in your library)')
开发者ID:csabakeszegh,项目名称:repo.plugin.video.youtubelibrary,代码行数:35,代码来源:playlists.py


示例5: update_playlist

def update_playlist(id, type=''):
    settings = m_xml.xml_get_elem('playlists/playlist', 'playlist', {'id': id}, type=type) #Grab the xml settings for this playlist
    if settings is None:
        dev.log('Could not find playlist '+id+' in the '+dev.typeXml(type)+' file', True)
        return False
    else:
        dev.log('Updating playlist %s (Id: %s)' % (settings.find('title').text.encode('utf-8'), id))
        #Check in which folder the show should be added
        folder = settings.find('overwritefolder').text
        if folder is None or folder == '':
            folder = dev.legal_filename(settings.find('title').text) #Overwrite folder is not set in settings.xml, so set the folder to the title of the show
        else:
            folder = dev.legal_filename(folder)
        
        #Create the tvshow.nfo
        writenfo = settings.find('writenfo').text
        if writenfo != 'no':
            if type == '' or type == 'tv':
                generators.write_tvshow_nfo(folder, settings)
        
        update_playlist_vids(id, folder, settings, type=type)
        
        #Save the time this playlist got updated in the xml
        import datetime
        d=datetime.datetime.now()
        m_xml.xml_update_playlist_attr(id, 'scansince', d.strftime("%d/%m/%Y %H:%M:%S"), type=type)
    
        return True
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:28,代码来源:service.py


示例6: write_xml

def write_xml(elem, dir='', output='', type=''):
    if output == '':
        output = dev.typeXml(type)
    dev.log('write_xml('+type+','+output+').')
    
    
    xbmcvfs.mkdir(vars.settingsPath) #Create the settings dir if it does not exist already
    if dir is not '': xbmcvfs.mkdir(vars.settingsPath+dir) #Create the settings dir if it does not exist already
    #Write these settings to a .xml file in the addonfolder
    output_file = os.path.join(vars.settingsPath+dir, output) #Set the outputfile to settings.xml
    
    #Creating a backup of the .xml file (in case it gets corrupted)
    backupfile = os.path.join(vars.settingsPath+dir, output+'.backup')
    if xbmcvfs.exists(output_file):
        if xbmcvfs.copy(output_file, backupfile):
            dev.log('Created a backup of the xml file at: '+backupfile)
        else:
            dev.log('Failed to create a backup of the xml file at: '+backupfile)
    else:
        dev.log(output_file+' could not be found, so not able to create a backup')
    
    
    indent( elem ) #Prettify the xml so its not on one line
    tree = ElementTree.ElementTree( elem ) #Convert the xml back to an element
    tree.write(output_file) #Save the XML in the settings file
    
    #For backup purposes, check if the xml got corrupted by writing just now
    if xml_get(type) is False:
        dev.log('corrupt .xml file')
开发者ID:csabakeszegh,项目名称:repo.plugin.video.youtubelibrary,代码行数:29,代码来源:m_xml.py


示例7: write_strm

def write_strm(name, fold, videoid, show=None, season=None, episode=None, startpoint = None, endpoint = None, artist='', album='', song='', year='', type=''):
    #dev.log('strm('+name+', '+fold+', '+videoid+')')
    movieLibrary = vars.tv_folder #The path we should save in is the vars.tv_folder setting from the addon settings
    if type=='musicvideo':
        movieLibrary = vars.musicvideo_folder
    sysname = urllib.quote_plus(videoid) #Escape strings in the videoid if needed
    enc_name = dev.legal_filename(name) #Encode the filename to a legal filename
    
    if vars.__settings__.getSetting("strm_link") == "Youtube Library":
        if type == 'musicvideo':
            content = 'plugin://plugin.video.youtubelibrary/?mode=playmusicvideo'
            if startpoint != None:
                content += '&startpoint='+startpoint
            if endpoint != None:
                content += '&endpoint='+endpoint
            content += '&id=%s&artist=%s&song=%s&album=%s&year=%s&filename=%s' % (sysname, artist, song, album, year, enc_name) #Set the content of the strm file with a link back to this addon for playing the video 
        else:
            content = 'plugin://plugin.video.youtubelibrary/?mode=play&id=%s&show=%s&season=%s&episode=%s&filename=%s' % (sysname, show, season, episode, enc_name) #Set the content of the strm file with a link back to this addon for playing the video
    else:
        content = vars.KODI_ADDONLINK+'%s' % ( sysname) #Set the content of the strm file with a link to the official Kodi Youtube Addon

    xbmcvfs.mkdir(movieLibrary) #Create the maindirectory if it does not exists yet
    
    folder = os.path.join(movieLibrary, fold) #Set the folder to the maindir/dir
    xbmcvfs.mkdir(folder) #Create this subfolder if it does not exist yet

    stream = os.path.join(folder, enc_name + '.strm') #Set the file to maindir/name/name.strm
    file = xbmcvfs.File(stream, 'w') #Open / create this file for writing
    file.write(str(content.encode('UTF-8'))) #Write the content in the file
    file.close() #Close the file
    dev.log('write_strm: Written strm file: '+fold+'/'+enc_name+'.strm')
    return enc_name
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:32,代码来源:generators.py


示例8: refresh_artwork

def refresh_artwork(id, type=''):
    response = ytube.yt_get_playlist_info(id)
    res = response['items'][0]['snippet']
    
    thumbnail = dev.best_thumbnail(res)
    #Grab the channel information 
    response = ytube.yt_get_channel_info(res['channelId'])
    snippet = response['items'][0]['snippet']
    brand = response['items'][0]['brandingSettings']
    
    #Check if we can do a better thumbnail
    better_thumbnail = dev.best_thumbnail(snippet)
    if(better_thumbnail != False):
        thumbnail = better_thumbnail
    if thumbnail == False:
        thumbnail = ''
        
    dev.log('The thumbnail now: '+thumbnail)
    
    bannerTv = brand['image']['bannerImageUrl']
    if 'bannerTvImageUrl' in brand['image']:
        bannerTv = brand['image']['bannerTvImageUrl']
    
    m_xml.xml_update_playlist_setting(id, 'thumb', thumbnail, type=type) #Save the new setting
    m_xml.xml_update_playlist_setting(id, 'banner', brand['image']['bannerImageUrl'], type=type) #Save the new setting
    m_xml.xml_update_playlist_setting(id, 'fanart', bannerTv, type=type) #Save the new setting
    
    settings = m_xml.xml_get_elem('playlists/playlist', 'playlist', {'id': id}, type=type) #Grab the xml settings for this playlist

    id = vars.args['id'][0]
    update_playlist(id, type=type)
开发者ID:Sleuteltje,项目名称:plugin.video.youtubelibrary,代码行数:31,代码来源:playlists.py


示例9: hms_to_sec

def hms_to_sec(hms):
    hms = hms.strip(' \t\n\r')
    #dev.log('hms_to_sec('+hms+')')
    m = re.search(r'(?i)((\d+)h)?((\d+)m)?((\d+)s)?', hms)
    if m:
        if m.group(2) is None and m.group(4) is None and m.group(6) == None:
            #if hms.count(':') == 2:
            m = re.search(r'(?i)((\d)+:)?((\d+))?(:(\d)+)?', hms)
            #else:
            #m = re.search(r'(?i)((\d)+:)?((\d+))?(:(\d)+)?', hms)
        hours = m.group(2)
        minutes = m.group(4)
        seconds = m.group(6)
        #dev.log(str(hours)+', '+str(minutes)+', '+str(seconds))
        if seconds is None:
            seconds = '0' #Seconds was not set in the setting, so we start with 0 seconds
        seconds = int(seconds)
        #dev.log('Seconds is '+str(seconds))
        if minutes is not None: #If minutes are specified
            #dev.log('minutes is '+minutes)
            sm = int(minutes) * 60
            seconds = seconds + sm
        if hours is not None:
            #dev.log('hours is '+hours)
            sh = int(hours) * 60 * 60
            seconds = seconds + sh
        return seconds
    else:
        dev.log('Could not extract seconds from hms format: '+hms, True)
        return None
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:30,代码来源:ytube.py


示例10: playlist_xml_get

def playlist_xml_get(playlist, type=''):
    dev.log('playlist_XML_get('+type+')')
    if xbmcvfs.exists(os.path.join(vars.settingsPath,dev.typeEpnr(type)+"/"+playlist+".xml")) == False: #If the episodes.xml file can't be found, we should create this file
        playlist_create_xml(playlist, type=type)
    
    global playlistdocument #Set the document variable as global, so every function can reach it
    playlistdocument = ElementTree.parse( vars.settingsPath+dev.typeEpnr(type)+'/'+playlist+'.xml' )
    return playlistdocument
开发者ID:csabakeszegh,项目名称:repo.plugin.video.youtubelibrary,代码行数:8,代码来源:m_xml.py


示例11: downloadYoutubeVid

def downloadYoutubeVid(name, fold, videoid, settings, type='', season=None):
    #youtube-dl command to download best quality: -f bestvideo[ext!=webm]‌​+bestaudio[ext!=webm]‌​/best[ext!=webm]
    #YDStreamExtractor.disableDASHVideo(True)
    
    movieLibrary = vars.tv_folder #The path we should save in is the vars.tv_folder setting from the addon settings
    if type=='musicvideo':
        movieLibrary = vars.musicvideo_folder
    if type=='movies':
        movieLibrary = vars.movies_folder
    
    folder = os.path.join(movieLibrary, fold) #Set the folder to the maindir/dir
    enc_name = dev.legal_filename(name) #Encode the filename to a legal filename
    
    xbmcvfs.mkdir(movieLibrary) #Create the maindirectory if it does not exist yet
    xbmcvfs.mkdir(folder) #Create this subfolder if it does not exist yet
    
    xbmcvfs.mkdir(folder) #Create this subfolder if it does not exist yet
    if type == '' or type == 'tv':
        folder = os.path.join(folder, 'Season '+season) #Set the folder to the maindir/dir
        xbmcvfs.mkdir(folder) #Create this subfolder if it does not exist yet

    full_file_path = os.path.join(folder, enc_name) #Set the file to maindir/name/name
    
    dev.log('Downloading '+videoid, 1)
    #vid = YDStreamExtractor.getVideoInfo(videoid,quality=1)
    path = os.path.join(movieLibrary, fold) #Set the folder to the maindir/dir
    
    
    #url = "https://www.youtube.com/watch?v=YKSU82afy1w" #ducktales intro to test
    url = "https://www.youtube.com/watch?v="+videoid
    vid = YDStreamExtractor.getVideoInfo(url,quality=1)
    
    if vid == None:
        dev.log('Failed to retrieve video from url: '+url)
        return False
    
    if settings.find('download_videos').text  == '720p':
        dev.log('%%%%%%% QUALITY: 720p quality selected')
        format = 'bestvideo[height<=?720]+bestaudio/best[height<=?720]'
    elif settings.find('download_videos').text == '1080p':
        dev.log('%%%%%%% QUALITY: 1080p quality selected')
        format = 'bestvideo[height<=?1080]+bestaudio/best[height<=?1080]'
    else:
        dev.log('%%%%%%% QUALITY: best quality selected')
        format = 'bestvideo+bestaudio/best'
    
    ydl_opts = {
    'format': format,
    'logger': MyLogger(),
    'progress_hooks': [my_hook],
    'outtmpl' : full_file_path+'.%(ext)s',
    #'-o' : enc_name+'.%(ext)s',
    }
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        return ydl.download(['https://www.youtube.com/watch?v='+videoid])
    
    """
开发者ID:Sleuteltje,项目名称:plugin.video.youtubelibrary,代码行数:57,代码来源:play.py


示例12: find_year

def find_year(text):
    regex = "(\(?()c(opyright)?\)?)?\s*(\d{4})"
    m = re.search(regex, text, re.IGNORECASE)
    if m:
        if len(m.group(4)) == 4:
            #Found a year!
            dev.log(u'Found a year!: '+m.group(4)+ ' Whole match: '+m.group(0))
            text = text.replace(m.group(0), '') #Remove the copyright / year notice from the title
            return m.group(4), text
    return False, text
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:10,代码来源:generators.py


示例13: xml_get

def xml_get(type=''):
    file=dev.typeXml(type)
    dev.log('XML_get('+type+','+file+')')
    global document #Set the document variable as global, so every function can reach it
    try:
        document = ElementTree.parse( vars.settingsPath+file )
    except Exception:
        xbmcgui.Dialog().ok("ERROR: "+file+" got corrupted", "ERROR!: "+file+" got corrupted. Please report this error to the addon developer on youtubelibrary.nl or the kodi forums. Luckily a backup has been created automatically before.")
        dev.log('ERROR: '+file+' got corrupted.', 1)
        raise ValueError(output_file+' got corrupted! Best to quit here')
        return False
    return document
开发者ID:csabakeszegh,项目名称:repo.plugin.video.youtubelibrary,代码行数:12,代码来源:m_xml.py


示例14: update_playlist

def update_playlist(type=''):
    id = vars.args['id'][0]
    xbmcgui.Dialog().notification(vars.__addonname__, 'Updating '+dev.typeName(type)+' Playlist '+id, vars.__icon__, 3000)
    service.update_playlist(id, type=type)
    xbmcgui.Dialog().notification(vars.__addonname__, 'Done updating '+dev.typeName(type)+' Playlist '+id, vars.__icon__, 3000)
    #Should we also update the video library?
    if vars.update_videolibrary == "true":
        update_dir = vars.tv_folder_path
        if type == 'musicvideo':
            update_dir = vars.musicvideo_folder_path
        dev.log('Updating video library is enabled. Updating librarys directory %s' % update_dir, True)
        xbmc.executebuiltin('xbmc.updatelibrary(Video,'+update_dir+')')
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:12,代码来源:routes.py


示例15: playlist_add_season

def playlist_add_season(playlist, season, season_tag='season', type=''):
    dev.log('playlist_add_season('+season+')')
    #Check if this playlist isnt in the xml file yet
    #if xml_get_elem('season', 'episode', {'id' : id}, playlist=playlist) is None:
    #Build the playlist
    doc = playlist_xml_get(playlist, type=type)
    
    attr = { 'number' : season}
    elem = Element(season_tag, attr)
    root = doc.getroot()
    root.insert(0, elem)
    write_xml(root, dir=dev.typeEpnr(type), output=playlist+'.xml')
    dev.log('Added '+season_tag+': '+season+' in '+dev.typeEpnr(type)+'/'+playlist+'.xml')
开发者ID:csabakeszegh,项目名称:repo.plugin.video.youtubelibrary,代码行数:13,代码来源:m_xml.py


示例16: yt_get_channel_info

def yt_get_channel_info(Channelid):
    #Connect to youtube API
    youtube = build_youtube()
    dev.log('GET yt_get_channel_info: https://www.googleapis.com/youtube/v3/channels?part=snippet%2C+contentDetails%2C+brandingSettings&maxResults=50&id='+Channelid+'&key='+vars.API_KEY)

    #Search for the channels with the following parameters
    search_response = youtube.channels().list(
      part="brandingSettings,snippet,contentDetails",
      id=Channelid,
      maxResults=50
    ).execute()
    
    return search_response
开发者ID:Sleuteltje,项目名称:plugin.video.youtubelibrary,代码行数:13,代码来源:ytube.py


示例17: create_xml

def create_xml(file='settings.xml'):
    dev.log('Create_xml')
    
    #<playlists>
    root = Element('config')
    newxml = SubElement(root, 'playlists')
    
    example = {
        'id'    : 'PUTPLAYLISTIDHERE',
        'enabled'      : 'no',
        'settings'      : {
            'type'                  : 'TV',
            'title'                   : 'Exampleplaylist',
            
            'description'        : 'This is an example of a youtube playlist xml config for use with Youtube Library',
            'genre'                : 'Action/Comedy',
            'published'          : '2010',
            #Art
            'thumb'               : 'thumbimgurl',
            'fanart'                : 'fanarturl',
            'banner'              : 'bannerurl',
            'epsownfanart'    : 'No',
            # STRM & NFO Settings
            'writenfo'             : 'Yes',
            'delete'                : '168',
            'keepvideos'        : '500',
            'overwritefolder'   : 'Z:/MEDIA/TV Shows/Example show',
            #Filters
            'minlength'         : '12:00',
            'maxlength'         : '25:00',
            'excludewords'    : 'trailer|commercial',
            'onlyinclude'       : 'review',
            #Strip Stuff from NFO information
            'striptitle'            : 'Brought to you by',
            'removetitle'       : 'Example Youtube Channels|Always annoying part of title',
            'stripdescription' : 'See our other channels|Subscribe to our channel',
            'removedescription' : 'Brought to you by our sponsors',
            #Scan Settings
            'lastvideoId'       : 'Wixi28loswo',
            'scansince'        : '29 jun 2015 18:23:21'
        }
    }

    
    playlist = xml_create_playlist(example)
    #Append this playlist to the new created xml file
    #newxml.append(playlist)
    #Write this new xml to the settings.xml file
    write_xml(root, output=file)
    dev.log('Create_xml: Created new '+file+' file')
开发者ID:csabakeszegh,项目名称:repo.plugin.video.youtubelibrary,代码行数:50,代码来源:m_xml.py


示例18: yt_get_playlist_info

def yt_get_playlist_info(id):
    #Connect to youtube API
    youtube = build_youtube()
    #Retrieve the information from the youtube API
    dev.log('GET yt_get_playlist_info: https://www.googleapis.com/youtube/v3/playlists?part=snippet%2C+id%2C+contentDetails&maxResults=50&channelId='+id+'&key='+vars.API_KEY)

    response = youtube.playlists().list(
      part="contentDetails,id,snippet",
      id=id,
      maxResults=50
    ).execute()
    
    return response
    '''
开发者ID:Sleuteltje,项目名称:plugin.video.youtubelibrary,代码行数:14,代码来源:ytube.py


示例19: vids_by_playlist

def vids_by_playlist(id, nextpage = False):
    youtube = build_youtube()
    if nextpage == False:
        dev.log('GET vids_by_playlist: https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2C+contentDetails&maxResults=50&playlistId='+id+'&key='+vars.API_KEY)
        try:
            search_response = youtube.playlistItems().list(
              part="snippet,contentDetails",
              maxResults=50,
              playlistId=id
            ).execute()
        except KeyboardInterrupt:
            raise
        except:
            dev.log('Playlist '+id+' could not be retrieved!')
            return False
    else:
        dev.log('GET vids_by_playlist: https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2C+contentDetails&maxResults=50&playlistId='+id+'&pageToken='+nextpage+'&key='+vars.API_KEY)
        try:
            search_response = youtube.playlistItems().list(
              part="snippet,contentDetails",
              maxResults=50,
              playlistId=id,
              pageToken=nextpage
            ).execute()
        except KeyboardInterrupt:
            raise
        except:
            dev.log('Playlist '+id+' could not be retrieved!')
            return False
    return search_response
开发者ID:Sleuteltje,项目名称:plugin.video.youtubelibrary,代码行数:30,代码来源:ytube.py


示例20: find_artist_song

def find_artist_song(text, hardcoded_artist):
    regex = "^([^-\n]+)(-|by|\|)\s*([^-:\n]+)$"
    m = re.search(regex, text, re.IGNORECASE)
    if m:
        dev.log('find_artist_song() Found Artist - Song: '+str(m.group(1).encode('UTF-8'))+' - '+str(m.group(3).encode('UTF-8')))
        artist = remove_extra_spaces(m.group(1))
        song = remove_extra_spaces(m.group(3))
        if m.group(2) == 'by' or artist.lower() == hardcoded_artist.lower():
            #Turn artist and song around
            artist = m.group(3)
            song = m.group(1)
        if '(' in artist and ')' not in artist or ')' in artist and '(' not in artist:
            return False, False
        return artist, song
    return False, False
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:15,代码来源:generators.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python field.FieldSet类代码示例发布时间:2022-05-26
下一篇:
Python db.cDb函数代码示例发布时间: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