def refresh_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( 'refreshPlaylist: Could not find playlist ' + id + ' in the ' + typeXml(type) + ' file', True) return False else: i = xbmcgui.Dialog().yesno( "Refresh Playlist", "Are you sure you want to refresh this playlist?") if i != 0: m_xml.xml_update_playlist_setting(id, 'lastvideoId', '', type=type) #Delete the .xml containing all scanned videoId's as well file = os.path.join(vars.settingsPath, dev.typeEpnr(type)) file = os.path.join(file, id + '.xml') if os.path.isfile(file): success = os.remove(file) #Remove the episodenr xml file xbmcgui.Dialog().ok('Refreshed Playlist', 'Succesfully refreshed playlist ' + id) i = xbmcgui.Dialog().yesno( 'Delete from library', 'Do you also want to delete the previous 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 #if vars.update_videolibrary == "true" and type=='': # update_dir = vars.tv_folder_path # if type == 'musicvideo': # update_dir = vars.musicvideo_folder_path # dev.log('Updating video library is enabled. Cleaning librarys directory %s' % update_dir, True) # xbmc.executebuiltin('xbmc.updatelibrary(Video,'+update_dir+')') xbmcgui.Dialog().ok( 'Removed from library', 'Deleted the previous videos from your library (You should clean your library, otherwise they will still show in your library)' ) editPlaylist(id, type=type) #Load the editplaylist view
def refresh_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('refreshPlaylist: Could not find playlist '+id+' in the '+typeXml(type)+' file', True) return False else: i = xbmcgui.Dialog().yesno("Refresh Playlist", "Are you sure you want to refresh this playlist?") if i != 0: m_xml.xml_update_playlist_setting(id, 'lastvideoId', '', type=type) #Delete the .xml containing all scanned videoId's as well file = os.path.join(vars.settingsPath, dev.typeEpnr(type)) file = os.path.join(file, id+'.xml') if os.path.isfile(file): success = os.remove(file) #Remove the episodenr xml file xbmcgui.Dialog().ok('Refreshed Playlist', 'Succesfully refreshed playlist '+id) i = xbmcgui.Dialog().yesno('Delete from library', 'Do you also want to delete the previous 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 #if vars.update_videolibrary == "true" and type=='': # update_dir = vars.tv_folder_path # if type == 'musicvideo': # update_dir = vars.musicvideo_folder_path # dev.log('Updating video library is enabled. Cleaning librarys directory %s' % update_dir, True) # xbmc.executebuiltin('xbmc.updatelibrary(Video,'+update_dir+')') xbmcgui.Dialog().ok('Removed from library', 'Deleted the previous videos from your library (You should clean your library, otherwise they will still show in your library)') editPlaylist(id, type=type) #Load the editplaylist view
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)
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)
def setEditPlaylist(id, set, type=''): if set == 'enable': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Enable", "Would you like to enable this playlist?") if i == 0: m_xml.xml_update_playlist_attr(id, 'enabled', 'no', type=type) return #dialog.ok("Set to disabled", "Playlist is disabled.") else: m_xml.xml_update_playlist_attr(id, 'enabled', 'yes', type=type) return #dialog.ok("Set to enabled", "Playlist will now be picked up by the scanner") elif set == 'writenfo': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("WriteNFO", "Write NFO files for this playlist?") if i == 0: i = 'no' else: i = 'Yes' elif set == 'skip_audio': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Skip Audio Only Videos", "Skip Audio Only Videos?") if i == 0: i = 'false' else: i = 'true' elif set == 'download_videos': i = xbmcgui.Dialog().select('Download Videos?', ['off', '720p', '1080p', 'best']) if i == 0: i = 'off' elif i == 1: i = '720p' elif i == 2: i = '1080p' elif i == 3: i = 'best' elif set == 'skip_lyrics': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Skip Lyrics", "Skip Lyric Videos?") if i == 0: i = 'false' else: i = 'true' elif set == 'skip_live': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Skip Live", "Skip Live Videos?") if i == 0: i = 'false' else: i = 'true' elif set == 'skip_albums': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Skip Albums", "Skip Album Videos?") if i == 0: i = 'false' else: i = 'true' elif set == 'published': elem = m_xml.xml_get_elem('playlists/playlist', 'playlist', {'id': id}, type=type) #Find this playlist so we can grab the value of the settings setting = str(elem.find(set).text) #Convert the setting to a string so we can input it safely if setting == None or setting == 'None': setting = '01/01/1901' d = ytube.convert_published(setting) prev_setting = d['day']+'/'+d['month']+'/'+d['year'] i = xbmcgui.Dialog().input('Change Published Date', prev_setting, 2) if i == '': i = prev_setting else: d = ytube.convert_published(i) i = d['day']+'-'+d['month']+'-'+d['year'] elif set == 'season': i = xbmcgui.Dialog().select('Choose Season Numbering', ['year', 's02e12', '02x12', 'number', 'regex']) if i == 0: i = 'year' elif i == 1: i = 's02e12' m_xml.xml_update_playlist_setting(id, 'episode', i, type=type) #Set this for episode as well elif i == 2: i = '02x12' m_xml.xml_update_playlist_setting(id, 'episode', i, type=type) #Set this for episode as well elif i == 3: i = xbmcgui.Dialog().numeric(0, 'Set a hardcoded episode number') elif i == 4: i = dev.user_input('', 'Set a regular expression') #m_xml.xml_update_playlist_setting(id, set, i) #Save the new setting elif set == 'episode': i = xbmcgui.Dialog().select('Choose Episode Numbering', ['Default', 's02e12', '02x12', 'monthday', 'pos', 'number', 'regex']) if i == 0: i = 'default' elif i == 1: i = 's02e12' m_xml.xml_update_playlist_setting(id, 'season', i, type=type) #Set this for season as well elif i == 2: i = '02x12' m_xml.xml_update_playlist_setting(id, 'season', i, type=type) #Set this for season as well elif i == 3: i = 'monthday' elif i == 4: i = 'pos' elif i == 5: i = xbmcgui.Dialog().numeric(0, 'Set a hardcoded episode number') elif i == 6: i = dev.user_input('', 'Set a regular expression') #m_xml.xml_update_playlist_setting(id, set, i) #Save the new setting elif set == 'onlygrab': options = ['0', '50', '100', '250', '500', '1000', '5000', '10000'] i = xbmcgui.Dialog().select('Choose max old videos to grab', options) i = options[i] #m_xml.xml_update_playlist_setting(id, set, i) #Save the new setting elif set == 'updateevery': options = ['every 4 hours', 'every 8 hours', 'every 12 hours', 'every 24 hours', 'every 168 hours', 'every day', 'every sunday', 'every monday', 'every tuesday', 'every wednesday', 'every thursday', 'every friday', 'every saturday'] i = xbmcgui.Dialog().select('Choose when to update this playlist', options) i = options[i] elif set == 'update_gmt': options = dev.timezones() i = xbmcgui.Dialog().select('In which timezone should this list be updated?', options) i = options[i] #m_xml.xml_update_playlist_setting(id, set, i) #Save the new setting elif set == 'minlength': i = xbmcgui.Dialog().numeric(2, 'Set a minimum length for videos') elif set == 'maxlength': i = xbmcgui.Dialog().numeric(2, 'Set a maximum length for videos') elif set == 'updateat': i = xbmcgui.Dialog().numeric(2, 'Update this playlist on this time of the day') elif set == 'reverse': i = xbmcgui.Dialog().yesno("Reverse Playlist", "Reverse this playlist? \n\r (Only use this if the playlist is sorted oldest->newest and you cant find a playlist sorted newest->oldest)") i = str(i) ###MOVIES elif set == 'search_imdb': i = xbmcgui.Dialog().select(dev.lang(30504), ['Yes, fallback on addon settings', 'Yes, dont add if imdb fails', 'No, just use addon settings']) i = str(i) elif set == 'imdb_match_cutoff': options = ['25', '40', '50', '60', '70', '75', '80', '85', '90', '95', '99', '100'] i = xbmcgui.Dialog().select(dev.lang(30505), options) i = options[i] elif set == 'use_ytimage': options = ['Only if no image found on IMDB', 'Always', 'Dont add if no image is found on IMDB', 'Never'] i = xbmcgui.Dialog().select(dev.lang(30520), options) i = str(i) elif set == 'smart_search': i = xbmcgui.Dialog().yesno("Smart Search", "Enable Smart Search?") i = str(i) ###MUSIC VIDEOS #genre elif set == 'genre' and type == 'musicvideo': i = xbmcgui.Dialog().select('Choose genre Recognizition', ['hardcoded']) if i == 0: i = 'hardcoded' elif set == 'genre_fallback' and type == 'musicvideo': i = xbmcgui.Dialog().select('Choose genre Recognizition Fallback', ['hardcoded', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'do not add' #Song Fallback elif set == 'song_fallback' and type == 'musicvideo': i = xbmcgui.Dialog().select('Choose Song Recognizition Fallback', ['video title', 'video title (original)', 'do not add']) if i == 0: i = 'video title' elif i == 1: i = 'video title (original)' elif i == 2: i = 'do not add' #Artist elif set == 'artist': i = xbmcgui.Dialog().select('Choose Artist Recognizition', ['video title and description', 'playlist channelname', 'video channelname', 'hardcoded']) if i == 0: i = 'video title and description' elif i == 1: i = 'playlist channelname' elif i == 2: i = 'video channelname' elif i == 3: i = 'hardcoded' elif set == 'artist_fallback': i = xbmcgui.Dialog().select('Choose Artist Recognizition Fallback', ['hardcoded', 'playlist channelname', 'video channelname', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'playlist channelname' elif i == 2: i = 'video channelname' elif i == 3: i = 'do not add' #album elif set == 'album': i = xbmcgui.Dialog().select('Choose album Recognizition', ['video title and description', 'artist + published year', 'hardcoded']) if i == 0: i = 'video title and description' elif i == 1: i = 'artist + published year' elif i == 2: i = 'hardcoded' elif set == 'album_fallback': i = xbmcgui.Dialog().select('Choose album Recognizition Fallback', ['hardcoded', 'published year', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'published year' elif i == 2: i = 'do not add' #plot elif set == 'plot': i = xbmcgui.Dialog().select('Choose plot Recognizition', ['lyrics in video description', 'video description', 'playlist description', 'hardcoded']) if i == 0: i = 'lyrics in video description' elif i == 1: i = 'video description' elif i == 2: i = 'playlist description' elif i == 3: i = 'hardcoded' elif set == 'plot_fallback': i = xbmcgui.Dialog().select('Choose plot Recognizition Fallback', ['hardcoded', 'video description', 'playlist description', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'video description' elif i == 2: i = 'playlist description' elif i == 3: i = 'do not add' #year elif set == 'year': i = xbmcgui.Dialog().select('Choose year Recognizition', ['video title and description', 'published year', 'hardcoded']) if i == 0: i = 'video title and description' elif i == 1: i = 'published year' elif i == 2: i = 'hardcoded' elif set == 'year_fallback': i = xbmcgui.Dialog().select('Choose year Recognizition Fallback', ['hardcoded', 'published year', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'published year' elif i == 2: i = 'do not add' ### NORMAL SETTING else: #Its another setting, so its normal text elem = m_xml.xml_get_elem('playlists/playlist', 'playlist', {'id': id}, type=type) #Find this playlist so we can grab the value of the settings setting = None if elem.find(set) != None: setting = str(elem.find(set).text) #Convert the setting to a string so we can input it safely if setting == None or setting == 'None': setting = '' i = dev.user_input(setting, 'Change setting '+set) #Ask the user to put in the new setting m_xml.xml_update_playlist_setting(id, set, i, type=type) #Save the new setting
def setEditPlaylist(id, set, type=''): if set == 'enable': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Enable", "Would you like to enable this playlist?") if i == 0: m_xml.xml_update_playlist_attr(id, 'enabled', 'no', type=type) return #dialog.ok("Set to disabled", "Playlist is disabled.") else: m_xml.xml_update_playlist_attr(id, 'enabled', 'yes', type=type) return #dialog.ok("Set to enabled", "Playlist will now be picked up by the scanner") elif set == 'writenfo': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("WriteNFO", "Write NFO files for this playlist?") if i == 0: i = 'no' else: i = 'Yes' elif set == 'skip_audio': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Skip Audio Only Videos", "Skip Audio Only Videos?") if i == 0: i = 'false' else: i = 'true' elif set == 'skip_lyrics': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Skip Lyrics", "Skip Lyric Videos?") if i == 0: i = 'false' else: i = 'true' elif set == 'skip_live': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Skip Live", "Skip Live Videos?") if i == 0: i = 'false' else: i = 'true' elif set == 'skip_albums': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Skip Albums", "Skip Album Videos?") if i == 0: i = 'false' else: i = 'true' elif set == 'published': elem = m_xml.xml_get_elem('playlists/playlist', 'playlist', {'id': id}, type=type) #Find this playlist so we can grab the value of the settings setting = str(elem.find(set).text) #Convert the setting to a string so we can input it safely if setting == None or setting == 'None': setting = '01/01/1901' d = ytube.convert_published(setting) prev_setting = d['day']+'/'+d['month']+'/'+d['year'] i = xbmcgui.Dialog().input('Change Published Date', prev_setting, 2) if i == '': i = prev_setting else: d = ytube.convert_published(i) i = d['day']+'-'+d['month']+'-'+d['year'] elif set == 'season': i = xbmcgui.Dialog().select('Choose Season Numbering', ['year', 's02e12', '02x12', 'number', 'regex']) if i == 0: i = 'year' elif i == 1: i = 's02e12' m_xml.xml_update_playlist_setting(id, 'episode', i, type=type) #Set this for episode as well elif i == 2: i = '02x12' m_xml.xml_update_playlist_setting(id, 'episode', i, type=type) #Set this for episode as well elif i == 3: i = xbmcgui.Dialog().numeric(0, 'Set a hardcoded episode number') elif i == 4: i = dev.user_input('', 'Set a regular expression') #m_xml.xml_update_playlist_setting(id, set, i) #Save the new setting elif set == 'episode': i = xbmcgui.Dialog().select('Choose Episode Numbering', ['Default', 's02e12', '02x12', 'monthday', 'pos', 'number', 'regex']) if i == 0: i = 'default' elif i == 1: i = 's02e12' m_xml.xml_update_playlist_setting(id, 'season', i, type=type) #Set this for season as well elif i == 2: i = '02x12' m_xml.xml_update_playlist_setting(id, 'season', i, type=type) #Set this for season as well elif i == 3: i = 'monthday' elif i == 4: i = 'pos' elif i == 5: i = xbmcgui.Dialog().numeric(0, 'Set a hardcoded episode number') elif i == 6: i = dev.user_input('', 'Set a regular expression') #m_xml.xml_update_playlist_setting(id, set, i) #Save the new setting elif set == 'onlygrab': options = ['0', '50', '100', '250', '500', '1000', '5000', '10000'] i = xbmcgui.Dialog().select('Choose max old videos to grab', options) i = options[i] #m_xml.xml_update_playlist_setting(id, set, i) #Save the new setting elif set == 'updateevery': options = ['every 4 hours', 'every 8 hours', 'every 12 hours', 'every 24 hours', 'every 168 hours', 'every day', 'every sunday', 'every monday', 'every tuesday', 'every wednesday', 'every thursday', 'every friday', 'every saturday'] i = xbmcgui.Dialog().select('Choose when to update this playlist', options) i = options[i] elif set == 'update_gmt': options = dev.timezones() i = xbmcgui.Dialog().select('In which timezone should this list be updated?', options) i = options[i] #m_xml.xml_update_playlist_setting(id, set, i) #Save the new setting elif set == 'minlength': i = xbmcgui.Dialog().numeric(2, 'Set a minimum length for videos') elif set == 'maxlength': i = xbmcgui.Dialog().numeric(2, 'Set a maximum length for videos') elif set == 'updateat': i = xbmcgui.Dialog().numeric(2, 'Update this playlist on this time of the day') elif set == 'reverse': i = xbmcgui.Dialog().yesno("Reverse Playlist", "Reverse this playlist? \n\r (Only use this if the playlist is sorted oldest->newest and you cant find a playlist sorted newest->oldest)") i = str(i) ###MOVIES elif set == 'search_imdb': i = xbmcgui.Dialog().select(dev.lang(30504), ['Yes, fallback on addon settings', 'Yes, dont add if imdb fails', 'No, just use addon settings']) i = str(i) elif set == 'imdb_match_cutoff': options = ['25', '40', '50', '60', '70', '75', '80', '85', '90', '95', '99', '100'] i = xbmcgui.Dialog().select(dev.lang(30505), options) i = options[i] elif set == 'use_ytimage': options = ['Only if no image found on IMDB', 'Always', 'Dont add if no image is found on IMDB', 'Never'] i = xbmcgui.Dialog().select(dev.lang(30520), options) i = str(i) elif set == 'smart_search': i = xbmcgui.Dialog().yesno("Smart Search", "Enable Smart Search?") i = str(i) ###MUSIC VIDEOS #genre elif set == 'genre' and type == 'musicvideo': i = xbmcgui.Dialog().select('Choose genre Recognizition', ['hardcoded']) if i == 0: i = 'hardcoded' elif set == 'genre_fallback' and type == 'musicvideo': i = xbmcgui.Dialog().select('Choose genre Recognizition Fallback', ['hardcoded', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'do not add' #Song Fallback elif set == 'song_fallback' and type == 'musicvideo': i = xbmcgui.Dialog().select('Choose Song Recognizition Fallback', ['video title', 'video title (original)', 'do not add']) if i == 0: i = 'video title' elif i == 1: i = 'video title (original)' elif i == 2: i = 'do not add' #Artist elif set == 'artist': i = xbmcgui.Dialog().select('Choose Artist Recognizition', ['video title and description', 'playlist channelname', 'video channelname', 'hardcoded']) if i == 0: i = 'video title and description' elif i == 1: i = 'playlist channelname' elif i == 2: i = 'video channelname' elif i == 3: i = 'hardcoded' elif set == 'artist_fallback': i = xbmcgui.Dialog().select('Choose Artist Recognizition Fallback', ['hardcoded', 'playlist channelname', 'video channelname', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'playlist channelname' elif i == 2: i = 'video channelname' elif i == 3: i = 'do not add' #album elif set == 'album': i = xbmcgui.Dialog().select('Choose album Recognizition', ['video title and description', 'artist + published year', 'hardcoded']) if i == 0: i = 'video title and description' elif i == 1: i = 'artist + published year' elif i == 2: i = 'hardcoded' elif set == 'album_fallback': i = xbmcgui.Dialog().select('Choose album Recognizition Fallback', ['hardcoded', 'published year', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'published year' elif i == 2: i = 'do not add' #plot elif set == 'plot': i = xbmcgui.Dialog().select('Choose plot Recognizition', ['lyrics in video description', 'video description', 'playlist description', 'hardcoded']) if i == 0: i = 'lyrics in video description' elif i == 1: i = 'video description' elif i == 2: i = 'playlist description' elif i == 3: i = 'hardcoded' elif set == 'plot_fallback': i = xbmcgui.Dialog().select('Choose plot Recognizition Fallback', ['hardcoded', 'video description', 'playlist description', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'video description' elif i == 2: i = 'playlist description' elif i == 3: i = 'do not add' #year elif set == 'year': i = xbmcgui.Dialog().select('Choose year Recognizition', ['video title and description', 'published year', 'hardcoded']) if i == 0: i = 'video title and description' elif i == 1: i = 'published year' elif i == 2: i = 'hardcoded' elif set == 'year_fallback': i = xbmcgui.Dialog().select('Choose year Recognizition Fallback', ['hardcoded', 'published year', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'published year' elif i == 2: i = 'do not add' ### NORMAL SETTING else: #Its another setting, so its normal text elem = m_xml.xml_get_elem('playlists/playlist', 'playlist', {'id': id}, type=type) #Find this playlist so we can grab the value of the settings setting = None if elem.find(set) != None: setting = str(elem.find(set).text) #Convert the setting to a string so we can input it safely if setting == None or setting == 'None': setting = '' i = dev.user_input(setting, 'Change setting '+set) #Ask the user to put in the new setting m_xml.xml_update_playlist_setting(id, set, i, type=type) #Save the new setting
def update_playlist_vids(id, folder, settings, nextpage=False, firstvid=False, type=type): onlygrab = 100 #grab max 100 pages by default ##Get all Youtube Videos belonging to this playlist #resp = ytube.vids_by_playlist(id, nextpage) #Grab the videos belonging to this playlist #vids = resp.get("items", []) if settings.find('onlygrab') is not None: onlygrab = int( settings.find('onlygrab').text ) / 50 #Get the maximum number of pages we should gather all_vids = [] duration = {} #First we are going to collect all youtube videos until we come across a list containing a videoId we already got uptodate = False times = 0 #keep track how many times we grabbed yt videos reverse = '0' if settings.find('reverse') is not None: reverse = settings.find('reverse').text total_last_time = settings.find('lastvideoId').text if total_last_time == '' or total_last_time == None: total_last_time = '0' total_last_time = int(total_last_time) while uptodate == False: all_vidids = [] resp = ytube.vids_by_playlist( id, nextpage) #Grab the videos belonging to this playlist if resp == False: return False #Something failed while retrieving the playlist amount = int(resp['pageInfo']['totalResults']) vids = resp.get("items", []) if reverse == '1' and times == 0: m_xml.xml_update_playlist_setting( id, 'lastvideoId', str(amount), type=type) #Update the amount of videos to the current one if total_last_time < amount: #There are more videos in the playlist now, so time to update dev.log('Reversed is enabled and there are more videos (' + str(amount) + ' vs ' + str(total_last_time) + ') then last time.') else: dev.log('Reversed is enabled, but there are no more videos (' + str(amount) + ' vs ' + str(total_last_time) + ') then last time.') return amount #No more videos then last time, so leave it at this if amount > 5000: dev.log( 'This playlist is way to big (more then 5000 videos) to be reversed' ) return amount if onlygrab <= times: #We have grabbed as many videos as allowed by the setting onlygrab uptodate = True break #quit updating the list for vid in vids: if m_xml.episode_exists(id, vid['contentDetails']['videoId'], type=type): if reverse != '1': #This list contains a videoId we already got, assume we are up to date uptodate = True continue #continue to the next video in the list if vid['snippet']['title'].lower( ) != 'private video' and vid['snippet']['title'].lower( ) != 'deleted video' and vid['snippet']['description'].lower( ) != 'this video is unavailable.': all_vidids.append( vid['contentDetails'] ['videoId']) #Collect all videoids in one list all_vids.append(vid) #Append this video to the all_vids list ##Grab the duration of the videos. We will need it for the minlength and maxlength filters, and for the duration tag in the .nfo file #We are gonna grab the duration of all 50 videos, saving on youtube api calls. dev.log('Grabbing duration of videos') duration.update(ytube.get_duration_vids( all_vidids)) #Get all the duration of the videos #If there is a nextPagetoken there are more videos to parse, call this function again so it can parse them to if 'nextPageToken' in resp: if uptodate is not True: nextpage = resp['nextPageToken'] else: uptodate = True #Since there are no more pages, we are uptodate #update_playlist_vids(id, folder, settings, resp['nextPageToken'], firstvid) times = times + 1 dev.log('') dev.log('') dev.log('( ._.)~~~~~~~~~~ DONE GRABBING VIDS FROM YOUTUBE FOR :' + settings.find('title').text + ' ~~~~~~~~~~(._. )') dev.log('') dev.log('') ##Grab settings from the settings.xml for this playlist minlength = settings.find('minlength').text maxlength = settings.find('maxlength').text if minlength is not '' and minlength is not None and minlength is not '00:00' and minlength is not '0:00': #Recalculate minlength dev.log('minlength is turned on: ' + minlength) minlength = ytube.hms_to_sec(minlength) dev.log('minlength in seconds: ' + str(minlength)) else: minlength = None if maxlength is not '' and maxlength is not None and maxlength is not '00:00' and maxlength is not '0:00': #Recalculate maxlength dev.log('maxlength is turned on: ' + maxlength) maxlength = ytube.hms_to_sec(maxlength) dev.log('maxlength in seconds: ' + str(maxlength)) else: maxlength = None if reverse == '1': all_vids = list(reversed(all_vids)) ##Loop through all vids and check with filters if we should add it for vid in reversed(all_vids): dev.log('') #Check if we already had this video, if so we should skip it if m_xml.episode_exists(id, vid['contentDetails']['videoId'], type=type): dev.log('Episode ' + vid['contentDetails']['videoId'] + ' is already scanned into the library') continue ##Check if the filters in the settings prevent this video from being added #Check if the word has been found, cause if not, we should not add this video to the library if onlyinclude(vid, settings) == False: continue #Skip this video #Check if the word has been found, cause if so, we should not add this video to the library if excludewords(vid, settings) == False: continue #Skip this video #See if this video is smaller or larger than the min-/maxlength specified in the settings if minlength is not None: if int(minlength) > int( duration[vid['contentDetails']['videoId']]): dev.log('Does not match minlength (' + str(minlength) + '): ' + vid['snippet']['title'] + ' (id: ' + vid['contentDetails']['videoId'] + ')') continue #Skip this video dev.log('Matches minlength: ' + vid['snippet']['title'] + ' (id: ' + vid['contentDetails']['videoId'] + ')') if maxlength is not None: if int(maxlength) < int( duration[vid['contentDetails']['videoId']]): dev.log('Does not match maxlength: ' + vid['snippet']['title'] + ' (id: ' + vid['contentDetails']['videoId'] + ')') continue #Skip this video #dev.log('TEST duration '+str(duration[vid['contentDetails']['videoId']])) if type == '' or type == 'tv': #Grab the correct season and episode number from this vid season, episode, vid = generators.episode_season( vid, settings, resp['pageInfo']['totalResults'], id) filename = 's' + season + 'e' + episode + ' - ' + vid['snippet'][ 'title'] #Create the filename for the .strm & .nfo file generators.write_strm( filename, folder, vid['contentDetails']['videoId'], show=settings.find('title').text, episode=episode, season=season) #Write the strm file for this episode if settings.find('writenfo').text != 'no': generators.write_nfo( filename, folder, vid, settings, season=season, episode=episode, duration=duration[vid['contentDetails']['videoId']] ) #Write the nfo file for this episode ##Musicvideo elif type == 'musicvideo': #Grab the musicvideo information from the generator musicvideo_info = generators.get_songinfo( vid, settings, duration=duration[vid['contentDetails']['videoId']]) if musicvideo_info == False: continue #Skip this video, it did not make it past the musicvideo filters filename = vid['snippet'][ 'title'] #Create the filename for the .strm & .nfo file generators.write_strm( filename, folder, vid['contentDetails']['videoId'], artist=musicvideo_info['artist'], song=musicvideo_info['title'], album=musicvideo_info['album'], year=musicvideo_info['year'], type=type) #Write the strm file for this episode if settings.find('writenfo').text != 'no': generators.write_nfo( filename, folder, vid, settings, musicvideo=musicvideo_info, duration=duration[vid['contentDetails']['videoId']], type=type) #Write the nfo file for this episode season = musicvideo_info['album'] if season == '': season = musicvideo_info['artist'] ##Movies elif type == 'movies': #Prepare the title as best as we can for the imdb search and stuff #title = vid['snippet']['title'] #description = vid['snippet']['description'] #title = removetitle(title, settings.find('removetitle').text) #title = striptitle(title, settings.find('striptitle').text) #if settings.find('smart_search') == '2': #title, description = generators.smart_search(title, description, vid, settings) filename = vid['snippet'][ 'title'] #Create the filename for the .strm & .nfo file if settings.find('writenfo').text != 'no': create_strm = generators.write_nfo( filename, folder, vid, settings, duration=duration[vid['contentDetails']['videoId']], type=type) #Write the nfo file for this episode if create_strm is False: m_xml.playlist_add_episode( id, '1', vid['contentDetails']['videoId'], type=type ) #Add it to the episode list, so it doesnt get picked up again continue #Skip this video, it did not make it past the filters generators.write_strm( filename, folder, vid['contentDetails']['videoId'], type=type) #Write the strm file for this episode season = '1' #Add this episode to the episodenr/playlist.xml file so we can remember we scanned this episode already m_xml.playlist_add_episode(id, season, vid['contentDetails']['videoId'], type=type) #If there is a nextPagetoken there are more videos to parse, call this function again so it can parse them to ''' if 'nextPageToken' in resp and lastvid is not True: #update_playlist_vids(id, folder, settings, resp['nextPageToken'], firstvid) else: if firstvid != False: m_xml.xml_update_playlist_setting(id, 'lastvideoId', firstvid) #Set the lastvideoId to this videoId so the playlist remembers the last video it has. This will save on API calls, since it will quit when it comes across a video that already has been set ''' dev.log('( ._.)========== Done ripping videos from playlist ' + settings.find('title').text + ' (ID: ' + id + ') ==========(._. )') dev.log('\n\n\n\n') return amount
def setEditPlaylist(id, set, type=''): if set == 'enable': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Enable", "Would you like to enable this playlist?") if i == 0: m_xml.xml_update_playlist_attr(id, 'enabled', 'no', type=type) return #dialog.ok("Set to disabled", "Playlist is disabled.") else: m_xml.xml_update_playlist_attr(id, 'enabled', 'yes', type=type) return #dialog.ok("Set to enabled", "Playlist will now be picked up by the scanner") elif set == 'writenfo': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("WriteNFO", "Write NFO files for this playlist?") if i == 0: i = 'no' else: i = 'Yes' elif set == 'skip_audio': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Skip Audio Only Videos", "Skip Audio Only Videos?") if i == 0: i = 'false' else: i = 'true' elif set == 'skip_lyrics': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Skip Lyrics", "Skip Lyric Videos?") if i == 0: i = 'false' else: i = 'true' elif set == 'skip_live': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Skip Live", "Skip Live Videos?") if i == 0: i = 'false' else: i = 'true' elif set == 'skip_albums': #Display a yes/no dialog to enable / disable i = xbmcgui.Dialog().yesno("Skip Albums", "Skip Album Videos?") if i == 0: i = 'false' else: i = 'true' elif set == 'published': elem = m_xml.xml_get_elem('playlists/playlist', 'playlist', {'id': id}, type=type) #Find this playlist so we can grab the value of the settings setting = str(elem.find(set).text) #Convert the setting to a string so we can input it safely if setting == None or setting == 'None': setting = '01/01/1901' d = ytube.convert_published(setting) prev_setting = d['day']+'/'+d['month']+'/'+d['year'] i = xbmcgui.Dialog().input('Change Published Date', prev_setting, 2) if i == '': i = prev_setting else: d = ytube.convert_published(i) i = d['day']+'-'+d['month']+'-'+d['year'] elif set == 'season': i = xbmcgui.Dialog().select('Choose Season Numbering', ['year', 's02e12', '02x12', 'number', 'regex']) if i == 0: i = 'year' elif i == 1: i = 's02e12' m_xml.xml_update_playlist_setting(id, 'episode', i, type=type) #Set this for episode as well elif i == 2: i = '02x12' m_xml.xml_update_playlist_setting(id, 'episode', i, type=type) #Set this for episode as well elif i == 3: i = xbmcgui.Dialog().numeric(0, 'Set a hardcoded episode number') elif i == 4: i = dev.user_input('', 'Set a regular expression') #m_xml.xml_update_playlist_setting(id, set, i) #Save the new setting elif set == 'episode': i = xbmcgui.Dialog().select('Choose Episode Numbering', ['Default', 's02e12', '02x12', 'monthday', 'pos', 'number', 'regex']) if i == 0: i = 'default' elif i == 1: i = 's02e12' m_xml.xml_update_playlist_setting(id, 'season', i, type=type) #Set this for season as well elif i == 2: i = '02x12' m_xml.xml_update_playlist_setting(id, 'season', i, type=type) #Set this for season as well elif i == 3: i = 'monthday' elif i == 4: i = 'pos' elif i == 5: i = xbmcgui.Dialog().numeric(0, 'Set a hardcoded episode number') elif i == 6: i = dev.user_input('', 'Set a regular expression') #m_xml.xml_update_playlist_setting(id, set, i) #Save the new setting elif set == 'minlength': i = xbmcgui.Dialog().numeric(2, 'Set a minimum length for videos') elif set == 'maxlength': i = xbmcgui.Dialog().numeric(2, 'Set a maximum length for videos') ###MUSIC VIDEOS #genre elif set == 'genre' and type == 'musicvideo': i = xbmcgui.Dialog().select('Choose genre Recognizition', ['hardcoded']) if i == 0: i = 'hardcoded' elif set == 'genre_fallback' and type == 'musicvideo': i = xbmcgui.Dialog().select('Choose genre Recognizition Fallback', ['hardcoded', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'do not add' #Song Fallback elif set == 'song_fallback' and type == 'musicvideo': i = xbmcgui.Dialog().select('Choose Song Recognizition Fallback', ['video title', 'do not add']) if i == 0: i = 'video title' elif i == 1: i = 'do not add' #Artist elif set == 'artist': i = xbmcgui.Dialog().select('Choose Artist Recognizition', ['video title and description', 'playlist channelname', 'video channelname', 'hardcoded']) if i == 0: i = 'video title and description' elif i == 1: i = 'playlist channelname' elif i == 2: i = 'video channelname' elif i == 3: i = 'hardcoded' elif set == 'artist_fallback': i = xbmcgui.Dialog().select('Choose Artist Recognizition Fallback', ['hardcoded', 'playlist channelname', 'video channelname', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'playlist channelname' elif i == 2: i = 'video channelname' elif i == 3: i = 'do not add' #album elif set == 'album': i = xbmcgui.Dialog().select('Choose album Recognizition', ['video title and description', 'artist + published year', 'hardcoded']) if i == 0: i = 'video title and description' elif i == 1: i = 'artist + published year' elif i == 2: i = 'hardcoded' elif set == 'album_fallback': i = xbmcgui.Dialog().select('Choose album Recognizition Fallback', ['hardcoded', 'published year', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'published year' elif i == 2: i = 'do not add' #plot elif set == 'plot': i = xbmcgui.Dialog().select('Choose plot Recognizition', ['lyrics in video description', 'video description', 'playlist description', 'hardcoded']) if i == 0: i = 'lyrics in video description' elif i == 1: i = 'video description' elif i == 2: i = 'playlist description' elif i == 3: i = 'hardcoded' elif set == 'plot_fallback': i = xbmcgui.Dialog().select('Choose plot Recognizition Fallback', ['hardcoded', 'video description', 'playlist description', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'video description' elif i == 2: i = 'playlist description' elif i == 3: i = 'do not add' #year elif set == 'year': i = xbmcgui.Dialog().select('Choose year Recognizition', ['video title and description', 'published year', 'hardcoded']) if i == 0: i = 'video title and description' elif i == 1: i = 'published year' elif i == 2: i = 'hardcoded' elif set == 'year_fallback': i = xbmcgui.Dialog().select('Choose year Recognizition Fallback', ['hardcoded', 'published year', 'do not add']) if i == 0: i = 'hardcoded' elif i == 1: i = 'published year' elif i == 2: i = 'do not add' ### NORMAL SETTING else: #Its another setting, so its normal text elem = m_xml.xml_get_elem('playlists/playlist', 'playlist', {'id': id}, type=type) #Find this playlist so we can grab the value of the settings setting = None if elem.find(set) != None: setting = str(elem.find(set).text) #Convert the setting to a string so we can input it safely if setting == None or setting == 'None': setting = '' i = dev.user_input(setting, 'Change setting '+set) #Ask the user to put in the new setting m_xml.xml_update_playlist_setting(id, set, i, type=type) #Save the new setting
def update_playlist_vids(id, folder, settings, nextpage=False, firstvid = False, type=type): onlygrab = 100 #grab max 100 pages by default ##Get all Youtube Videos belonging to this playlist #resp = ytube.vids_by_playlist(id, nextpage) #Grab the videos belonging to this playlist #vids = resp.get("items", []) if settings.find('onlygrab') is not None: onlygrab = int(settings.find('onlygrab').text) / 50 #Get the maximum number of pages we should gather all_vids = [] duration = {} #First we are going to collect all youtube videos until we come across a list containing a videoId we already got uptodate = False times = 0 #keep track how many times we grabbed yt videos reverse = '0' if settings.find('reverse') is not None: reverse = settings.find('reverse').text total_last_time = settings.find('lastvideoId').text if total_last_time == '' or total_last_time == None: total_last_time = '0' total_last_time = int(total_last_time) while uptodate == False: all_vidids = [] resp = ytube.vids_by_playlist(id, nextpage) #Grab the videos belonging to this playlist if resp == False: return False #Something failed while retrieving the playlist amount = int(resp['pageInfo']['totalResults']) vids = resp.get("items", []) if reverse == '1' and times == 0: m_xml.xml_update_playlist_setting(id, 'lastvideoId', str(amount), type=type) #Update the amount of videos to the current one if total_last_time < amount: #There are more videos in the playlist now, so time to update dev.log('Reversed is enabled and there are more videos ('+str(amount)+' vs '+str(total_last_time)+') then last time.') else: dev.log('Reversed is enabled, but there are no more videos ('+str(amount)+' vs '+str(total_last_time)+') then last time.') return amount #No more videos then last time, so leave it at this if amount > 5000: dev.log('This playlist is way to big (more then 5000 videos) to be reversed') return amount if onlygrab <= times: #We have grabbed as many videos as allowed by the setting onlygrab uptodate = True break#quit updating the list for vid in vids: if m_xml.episode_exists(id, vid['contentDetails']['videoId'], type=type): if reverse != '1': #This list contains a videoId we already got, assume we are up to date uptodate = True continue #continue to the next video in the list if vid['snippet']['title'].lower() != 'private video' and vid['snippet']['title'].lower() != 'deleted video' and vid['snippet']['description'].lower() != 'this video is unavailable.': all_vidids.append(vid['contentDetails']['videoId']) #Collect all videoids in one list all_vids.append(vid) #Append this video to the all_vids list ##Grab the duration of the videos. We will need it for the minlength and maxlength filters, and for the duration tag in the .nfo file #We are gonna grab the duration of all 50 videos, saving on youtube api calls. dev.log('Grabbing duration of videos') duration.update(ytube.get_duration_vids(all_vidids)) #Get all the duration of the videos #If there is a nextPagetoken there are more videos to parse, call this function again so it can parse them to if 'nextPageToken' in resp: if uptodate is not True: nextpage = resp['nextPageToken'] else: uptodate = True #Since there are no more pages, we are uptodate #update_playlist_vids(id, folder, settings, resp['nextPageToken'], firstvid) times = times+1 dev.log('') dev.log('') dev.log('( ._.)~~~~~~~~~~ DONE GRABBING VIDS FROM YOUTUBE FOR :'+settings.find('title').text+' ~~~~~~~~~~(._. )') dev.log('') dev.log('') ##Grab settings from the settings.xml for this playlist minlength = settings.find('minlength').text maxlength = settings.find('maxlength').text if minlength is not '' and minlength is not None and minlength is not '00:00' and minlength is not '0:00': #Recalculate minlength dev.log('minlength is turned on: '+minlength) minlength = ytube.hms_to_sec(minlength) dev.log('minlength in seconds: '+str(minlength)) else: minlength = None if maxlength is not '' and maxlength is not None and maxlength is not '00:00' and maxlength is not '0:00': #Recalculate maxlength dev.log('maxlength is turned on: '+maxlength) maxlength = ytube.hms_to_sec(maxlength) dev.log('maxlength in seconds: '+str(maxlength)) else: maxlength = None if reverse == '1': all_vids = list(reversed(all_vids)) ##Loop through all vids and check with filters if we should add it for vid in reversed(all_vids): dev.log('') #Check if we already had this video, if so we should skip it if m_xml.episode_exists(id, vid['contentDetails']['videoId'], type=type): dev.log('Episode '+vid['contentDetails']['videoId']+' is already scanned into the library') continue ##Check if the filters in the settings prevent this video from being added #Check if the word has been found, cause if not, we should not add this video to the library if onlyinclude(vid, settings) == False: continue #Skip this video #Check if the word has been found, cause if so, we should not add this video to the library if excludewords(vid, settings) == False: continue #Skip this video #See if this video is smaller or larger than the min-/maxlength specified in the settings if minlength is not None: if int(minlength) > int(duration[vid['contentDetails']['videoId']]): dev.log('Does not match minlength ('+str(minlength)+'): '+vid['snippet']['title']+' (id: '+vid['contentDetails']['videoId']+')') continue #Skip this video dev.log('Matches minlength: '+vid['snippet']['title']+' (id: '+vid['contentDetails']['videoId']+')') if maxlength is not None: if int(maxlength) < int(duration[vid['contentDetails']['videoId']]): dev.log('Does not match maxlength: '+vid['snippet']['title']+' (id: '+vid['contentDetails']['videoId']+')') continue #Skip this video #dev.log('TEST duration '+str(duration[vid['contentDetails']['videoId']])) if type == '' or type == 'tv': #Grab the correct season and episode number from this vid season, episode, vid = generators.episode_season(vid, settings, resp['pageInfo']['totalResults'], id) filename = 's'+season+'e'+episode+' - '+vid['snippet']['title'] #Create the filename for the .strm & .nfo file generators.write_strm(filename, folder, vid['contentDetails']['videoId'], show=settings.find('title').text, episode=episode, season=season) #Write the strm file for this episode if settings.find('writenfo').text != 'no': generators.write_nfo(filename, folder, vid, settings, season = season, episode = episode, duration = duration[vid['contentDetails']['videoId']]) #Write the nfo file for this episode ##Musicvideo elif type == 'musicvideo': #Grab the musicvideo information from the generator musicvideo_info = generators.get_songinfo(vid, settings, duration = duration[vid['contentDetails']['videoId']]) if musicvideo_info == False: continue #Skip this video, it did not make it past the musicvideo filters filename = vid['snippet']['title'] #Create the filename for the .strm & .nfo file generators.write_strm(filename, folder, vid['contentDetails']['videoId'], artist=musicvideo_info['artist'], song=musicvideo_info['title'], album=musicvideo_info['album'], year=musicvideo_info['year'], type=type) #Write the strm file for this episode if settings.find('writenfo').text != 'no': generators.write_nfo(filename, folder, vid, settings, musicvideo=musicvideo_info, duration = duration[vid['contentDetails']['videoId']], type=type) #Write the nfo file for this episode season = musicvideo_info['album'] if season == '': season = musicvideo_info['artist'] ##Movies elif type == 'movies': #Prepare the title as best as we can for the imdb search and stuff #title = vid['snippet']['title'] #description = vid['snippet']['description'] #title = removetitle(title, settings.find('removetitle').text) #title = striptitle(title, settings.find('striptitle').text) #if settings.find('smart_search') == '2': #title, description = generators.smart_search(title, description, vid, settings) filename = vid['snippet']['title'] #Create the filename for the .strm & .nfo file if settings.find('writenfo').text != 'no': create_strm = generators.write_nfo(filename, folder, vid, settings, duration = duration[vid['contentDetails']['videoId']], type=type) #Write the nfo file for this episode if create_strm is False: m_xml.playlist_add_episode(id, '1', vid['contentDetails']['videoId'], type=type) #Add it to the episode list, so it doesnt get picked up again continue #Skip this video, it did not make it past the filters generators.write_strm(filename, folder, vid['contentDetails']['videoId'], type=type) #Write the strm file for this episode season = '1' #Add this episode to the episodenr/playlist.xml file so we can remember we scanned this episode already m_xml.playlist_add_episode(id, season, vid['contentDetails']['videoId'], type=type) #If there is a nextPagetoken there are more videos to parse, call this function again so it can parse them to ''' if 'nextPageToken' in resp and lastvid is not True: #update_playlist_vids(id, folder, settings, resp['nextPageToken'], firstvid) else: if firstvid != False: m_xml.xml_update_playlist_setting(id, 'lastvideoId', firstvid) #Set the lastvideoId to this videoId so the playlist remembers the last video it has. This will save on API calls, since it will quit when it comes across a video that already has been set ''' dev.log('( ._.)========== Done ripping videos from playlist '+settings.find('title').text+' (ID: '+id+') ==========(._. )') dev.log('\n\n\n\n') return amount