def disp_setting(setting, title, description, level=0):
    #Is the mode in the addon settings high enough to display this setting?
    if level > vars.mode:
        return False #no
    
    #build url
    val = None
    if elem.find(setting) != None:
        val = elem.find(setting).text
        if setting == 'published':
            d = ytube.convert_published(val)
            val = d['day']+'-'+d['month']+'-'+d['year']
        elif setting == 'search_imdb': #Search_IMDB (movies setting)
            options = ['Yes, fallback on addon settings', 'Yes, dont add if imdb fails', 'No, just use addon settings']
            val = options[int(val)]
        elif setting == 'use_ytimage': 
            options = ['Only if no image found on IMDB', 'Always', 'Dont add if no image is found on IMDB', 'Never']
            val = options[int(val)]
    if val == None or val == 'None':
        val = ''
    url = dev.build_url({'mode': 'editPlaylist', 'id': plid, 'set': setting, 'type': pltype})
    if 'hardcoded' in title.lower() and 'genre hardcoded' not in title.lower() or 'fallback' in title.lower() and 'song fallback' not in title.lower():
        dev.adddir('[COLOR blue] --'+title+':[/COLOR] '+val, url, gear, fanart, description)
    else:
        dev.adddir('[COLOR blue]'+title+':[/COLOR] '+val, url, gear, fanart, description)
def disp_setting(setting, title, description, level=0):
    #Is the mode in the addon settings high enough to display this setting?
    if level > vars.mode:
        return False #no
    
    #build url
    val = None
    if elem.find(setting) != None:
        val = elem.find(setting).text
        if setting == 'published':
            d = ytube.convert_published(val)
            val = d['day']+'-'+d['month']+'-'+d['year']
        elif setting == 'search_imdb': #Search_IMDB (movies setting)
            options = ['Yes, fallback on addon settings', 'Yes, dont add if imdb fails', 'No, just use addon settings']
            val = options[int(val)]
        elif setting == 'use_ytimage': 
            options = ['Only if no image found on IMDB', 'Always', 'Dont add if no image is found on IMDB', 'Never']
            val = options[int(val)]
    if val == None or val == 'None':
        val = ''
    url = dev.build_url({'mode': 'editPlaylist', 'id': plid, 'set': setting, 'type': pltype})
    if 'hardcoded' in title.lower() and 'genre hardcoded' not in title.lower() or 'fallback' in title.lower() and 'song fallback' not in title.lower():
        dev.adddir('[COLOR blue] --'+title+':[/COLOR] '+val, url, gear, fanart, description)
    else:
        dev.adddir('[COLOR blue]'+title+':[/COLOR] '+val, url, gear, fanart, description)
Exemplo n.º 3
0
def get_hardcoded(setting, settings, vid):
    if settings.find(setting).text == 'hardcoded':
        setting = setting.replace('_fallback', '')
        return dev.get_setting(setting+'_hardcoded', settings)
    if settings.find(setting).text == 'playlist channelname':
        return settings.find('channel').text
    if settings.find(setting).text == 'video channelname':
        return vid['snippet']['channelTitle']
    if settings.find(setting).text == 'published year':
        return ytube.convert_published(vid['snippet']['publishedAt'])['year']
    if settings.find(setting).text == 'playlist description':
        return settings.find('description').text
    if settings.find(setting).text == 'video description':
        return vid['snippet']['description']
    return False
Exemplo n.º 4
0
def disp_setting(setting, title, description, level=0):
    #Is the mode in the addon settings high enough to display this setting?
    if level > vars.mode:
        return False #no
    
    #build url
    val = None
    if elem.find(setting) != None:
        val = elem.find(setting).text
        if setting == 'published':
            d = ytube.convert_published(val)
            val = d['day']+'-'+d['month']+'-'+d['year']
    if val == None or val == 'None':
        val = ''
    url = dev.build_url({'mode': 'editPlaylist', 'id': plid, 'set': setting, 'type': pltype})
    if 'hardcoded' in title.lower() and 'genre hardcoded' not in title.lower() or 'fallback' in title.lower() and 'song fallback' not in title.lower():
        dev.adddir('[COLOR blue] --'+title+':[/COLOR] '+val, url, gear, fanart, description)
    else:
        dev.adddir('[COLOR blue]'+title+':[/COLOR] '+val, url, gear, fanart, description)
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
Exemplo n.º 7
0
def write_tvshow_nfo(fold, settings):
    dev.log('write_tvshow_nfo('+fold+')')
    name = 'tvshow'
    movieLibrary = vars.tv_folder #Use the directory from the addon settings

    #Grab the published date and convert it to a normal date
    d = ytube.convert_published(settings.find('published').text)
    normaldate = d['year']+'-'+d['month']+'-'+d['day']
    
    #Grab the tags and convert them to xml
    tags = settings.find('tags')
    tags_xml = ''
    if tags is not None:
        tags = settings.find('tags').text
        if '/' in tags:
            multi_tags = tags.split('/')
            tags_xml = ''
            for tag in multi_tags:
                tags_xml += '<tag>'+tag.strip(' \t\n\r')+'</tag>'
        elif tags.strip(' \t\n\r') is not '':
            tags_xml = '<tag>'+tags.strip(' \t\n\r')+'</tag>'
    
    #Create the contents of the xml file
    content = u"""
            <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
            <tvshow>
                <title>%(title)s</title>
                <showtitle>%(title)s</showtitle>
                <year>%(year)s</year>
                <plot>%(plot)s</plot>
                <genre>%(genre)s</genre>
                <premiered>%(date)s</premiered>
                <aired>%(date)s</aired>
                <studio>%(studio)s</studio>
                <thumb>%(thumb)s</thumb>
                <thumb aspect="poster">%(thumb)s</thumb>
                <thumb aspect="banner">%(banner)s</thumb>
                <fanart>
                    <thumb>%(fanart)s</thumb>
                </fanart>
                %(tags)s
            </tvshow>
    """ % {
        'title': settings.find('title').text,
        'plot': settings.find('description').text,
        'year': d['year'],
        'genre': settings.find('genre').text,
        'studio': settings.find('channel').text,
        'thumb': settings.find('thumb').text,
        'banner': settings.find('banner').text,
        'fanart': settings.find('fanart').text,
        'date': normaldate,
        'tags': tags_xml,
    }
    
    xbmcvfs.mkdir(movieLibrary) #Create the maindirectory if it does not exists yet
    enc_name = dev.legal_filename(name) #Set the filename to a legal filename
    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 + '.nfo') #Set the file to maindir/name/name.strm
    
    import codecs
    # process Unicode text
    with codecs.open(stream,'w',encoding='utf8') as f:
        f.write(content)
        f.close()
    #file = xbmcvfs.File(stream, 'w') #Open / create this file for writing
    #file.write(str(content)) #Write the content in the file
    #file.close() #Close the file
    dev.log('write_tvshow_nfo: Written tvshow.nfo file: '+fold+'/'+enc_name+'.nfo')
    
    #If the setting download_images is true, we should also download the images as actual files into the directory
    if vars.__settings__.getSetting("download_images") == "true":
        dev.log('download_images enabled, so downloading images to '+folder)
        urllib.urlretrieve(settings.find('thumb').text, folder+"/folder.jpg")
        urllib.urlretrieve(settings.find('banner').text, folder+"/banner.jpg")
        urllib.urlretrieve(settings.find('fanart').text, folder+"/fanart.jpg")
Exemplo n.º 8
0
def write_nfo(name, fold, vid, settings, season='', episode='', duration='0', overwrite_title=None, overwrite_description=None, musicvideo=None, type=''):
    #dev.log('write_nfo('+name+', '+fold+')')
    movieLibrary = vars.tv_folder #Use the directory from the addon settings
    if type=='musicvideo':
        movieLibrary = vars.musicvideo_folder
    snippet = vid['snippet']
    
    
    #See if we should do something to the title according to the settings
    title = snippet['title']
    if overwrite_title != None:
        title = overwrite_title
    removetitle = settings.find('removetitle').text
    if removetitle == None:
        removetitle = ''
    if len(removetitle) > 0:
        #See if there are multiple lines
        if '|' in removetitle:
            strip = removetitle.split('|')
            for s in strip:
                #Check if we should do regex
                r = reg(s, title)
                if r is not None:
                    s = r
                if s in title:
                    title = title.replace(s, '') #Remove this line from the title
        else:
            #Check if this is a regex var of what should be removed
            rem = reg(removetitle, title)
            if rem is not None:
                removetitle = rem #Regex was succesfull, set removetitle to the found string so it can be removed as normal
            title = re.sub(removetitle, '', title, flags=re.IGNORECASE)
            #if removetitle in title:
                #title = title.replace(removetitle, '')
    #See if we should do something to the title according to the settings
    striptitle = settings.find('striptitle').text
    if striptitle == None:
        striptitle = ''
    if len(striptitle) > 0:
        #See if there are multiple lines
        if '|' in striptitle:
            strip = striptitle.split('|')
            for s in strip:
                if s in title:
                    title = title[:title.index(s)] #Strip everything to the point where the line was found
        else:
            #Check if this is a regex var of what should be removed
            rem = reg(title, striptitle)
            if rem is not None:
                striptitle = rem #Regex was succesfull, set striptitle to the found string so it can be stripped as normal
            if striptitle in title:
                title = title[:title.index(striptitle)] #Strip everything to the point where the line was found
                
                
    #See if we should do something to the description according to the settings
    description = snippet['description']
    if overwrite_description != None:
        description = overwrite_description
    removedescription = settings.find('removedescription').text
    if removedescription == None:
        removedescription = ''
    if len(removedescription) > 0:
        #See if there are multiple lines
        if '|' in removedescription:
            strip = removedescription.split('|')
            for s in strip:
                if s in description:
                    description = description.replace(s, '') #Remove this line from the description
        else:
            #Check if this is a regex var of what should be removed
            rem = reg(description, removedescription)
            if rem is not None:
                removedescription = rem #Regex was succesfull, set removedescription to the found string so it can be removed as normal
            if removedescription in description:
                description = description.replace(removedescription, '')
    #See if we should do something to the description according to the settings
    stripdescription = settings.find('stripdescription').text
    if stripdescription == None:
        stripdescription = ''
    if len(stripdescription) > 0:
        #See if there are multiple lines
        if '|' in stripdescription:
            strip = stripdescription.split('|')
            for s in strip:
                if s in description:
                    description = description[:description.index(s)] #Strip everything to the point where the line was found
        else:
            #Check if this is a regex var of what should be removed
            rem = reg(description, stripdescription)
            if rem is not None:
                stripdescription = rem #Regex was succesfull, set stripdescription to the found string so it can be stripped as normal
            if stripdescription in description:
                description = description[:description.index(stripdescription)] #Strip everything to the point where the line was found
   
   
    #Grab the best possible thumbnail
    #if 'maxres' in snippet['thumbnails']:
    #    thumbnail = snippet['thumbnails']['maxres']
    if 'standard' in snippet['thumbnails']:
        thumbnail = snippet['thumbnails']['standard']['url']
    elif 'high' in snippet['thumbnails']:
        thumbnail = snippet['thumbnails']['high']['url']
    elif 'medium' in snippet['thumbnails']:
        thumbnail = snippet['thumbnails']['medium']['url']
    elif 'default' in snippet['thumbnails']:
        thumbnail = snippet['thumbnails']['default']['url']
    else:
        thumbnail = settings.find('thumbnail').text
    
    #Grab the published date and convert it to a normal date
    d = ytube.convert_published(snippet['publishedAt'])
    normaldate = d['year']+'/'+d['month']+'/'+d['day']
    
    #Convert the duration (seconds) in number of minutes
    durationminutes = int(int(duration) / 60)
    
    durationhms = dev.convert_sec_to_hms(duration)
    
    if type == 'musicvideo':
        if musicvideo == None:
            return False
        #Grab the featured artists and convert them to xml
        featured_xml = ''
        if musicvideo['featured'] != False:
            for artist in musicvideo['featured']:
                featured_xml += '<artist>'+artist.strip(' \t\n\r')+'</artist>'
        #Grab the tags and convert them to xml
        tags_xml = ''
        if musicvideo['tags'] != False:
            for tag in musicvideo['tags']:
                tags_xml += '<tag>'+tag.strip(' \t\n\r')+'</tag>'
        tags = settings.find('tags')
        if tags is not None:
            tags = settings.find('tags').text
            if '/' in tags:
                multi_tags = tags.split('/')
                for tag in multi_tags:
                    tags_xml += '<tag>'+tag.strip(' \t\n\r')+'</tag>'
            elif tags.strip(' \t\n\r') is not '':
                tags_xml += '<tag>'+tags.strip(' \t\n\r')+'</tag>'
        
        genre = musicvideo['genre']
        if genre is None:
            genre = ''
        #Create the contents of the xml file
        content = """
<musicvideo>
    <title>%(title)s</title>
    <artist>%(artist)s</artist>
    %(featured)s
    <album>%(album)s</album>
    <genre>%(genre)s</genre>
    <runtime>%(durationminutes)s</runtime>
    <plot>%(plot)s</plot>
    <year>%(year)s</year>
    <director></director>
    <studio>%(studio)s</studio>
    <track>%(tracknr)s</track>
    <thumb>%(thumb)s</thumb>
    <fanart>
        <thumb>%(fanart)s</thumb>
    </fanart>
    <fileinfo>
        <streamdetails>
            <durationinseconds>%(duration)s</durationinseconds>
        </streamdetails>
    </fileinfo>
    %(tags)s
</musicvideo>
        """ % {
            'title': musicvideo['title'].strip(' \t\n\r'),
            'artist': musicvideo['artist'].strip(' \t\n\r'),
            'featured': featured_xml,
            'album': musicvideo['album'].strip(' \t\n\r'),
            'genre': genre.strip(' \t\n\r'),
            'plot': musicvideo['plot'].strip(' \t\n\r'),
            'year': musicvideo['year'].strip(' \t\n\r'),
            'studio': musicvideo['studio'].strip(' \t\n\r'),
            'thumb': thumbnail,
            'durationhms': durationhms,
            'tracknr': musicvideo['tracknr'].strip(' \t\n\r'),
            'fanart': settings.find('fanart').text,
            'tags': tags_xml,
            'durationminutes': durationminutes,
            'duration': duration
        }
    else:
        ##TV
        #Create the contents of the xml file
        content = """
<episodedetails>
    <title>%(title)s</title>
    <season>%(season)s</season>
    <episode>%(episode)s</episode>
    <plot>%(plot)s</plot>
    <thumb>%(thumb)s</thumb>
    <credits>%(channel)s</credits>
    <director>%(channel)s</director>
    <aired>%(date)s</aired>
    <premiered>%(date)s</premiered>
    <studio>Youtube</studio>
    <runtime>%(durationminutes)s</runtime>
    <fileinfo>
        <streamdetails>
            <durationinseconds>%(duration)s</durationinseconds>
        </streamdetails>
    </fileinfo>
</episodedetails>
        """ % {
            'title': title.strip(' \t\n\r'),
            'plot': description.strip(' \t\n\r'),
            'channel': settings.find('channel').text,
            'thumb': thumbnail,
            'date': normaldate,
            'season': season,
            'episode': episode,
            'durationminutes': durationminutes,
            'duration': duration
        }
    
    xbmcvfs.mkdir(movieLibrary) #Create the maindirectory if it does not exists yet
    

    #enc_name = name.translate('\/:*?"<>|').strip('.') #Escape special characters in the name
    enc_name = dev.legal_filename(name)
    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 + '.nfo') #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_nfo: Written nfo file: '+fold+'/'+enc_name+'.nfo')
Exemplo n.º 9
0
def episode_season(vid, settings, totalresults = False, playlist = False):
    ep = settings.find('episode').text #Grab the episode settings from the xml
    se = settings.find('season').text
    
    found = False
    
    ##See if there should be standard season/episode recognisition for the season
    if se == 's02e12':
        regex = "s(eason)?\s*(\d+)\s*ep?(isode)?\s*(\d+)"
        m = re.search( regex, vid['snippet']['title'])
        if m:
            #Found the sxxexx
            dev.log('s2e12 '+regex+' found its match: '+m.group(0).encode('UTF-8')+' , '+m.group(1).encode('UTF-8')+' , '+m.group(2).encode('UTF-8'))
            #Try to replace the s01e01 in the title
            vid['snippet']['title'] = re.sub(regex, '', vid['snippet']['title'], 1)
            return m.group(2), m.group(4), vid
            
        #Regex not found, return None
        dev.log('s02e12 recognizition has not found anything: '+regex+' on '+vid['snippet']['title'].encode('UTF-8'), True)
        return '0', '0', vid

    if se == '02x12':
        regex = "(\d+)\s?x\s?(\d+)"
        m = re.search( regex, vid['snippet']['title'])
        if m:
            #Found the sxxexx
            dev.log('2x12 '+regex+' found its match: '+m.group(0).encode('UTF-8')+' , '+m.group(1).encode('UTF-8')+' , '+m.group(2).encode('UTF-8'))
            #Try to replace the s01e01 in the title
            vid['snippet']['title'] = re.sub(regex, '', vid['snippet']['title'], 1)
            return m.group(1), m.group(2), vid
            
        #Regex not found, return None
        dev.log('02x12 recognizition has not found anything: '+regex+' on '+vid['snippet']['title'].encode('UTF-8'), True)
        return '0', '0', vid
    
    ##Normal recongizitions
    #See if there should be a regex search for the season
    if se[:6] == 'regex(':
        match = reg(se, vid['snippet']['title'])
        if match != None:
            season = match[0]
            found = True
    if found == False: #If the episode has not been found yet, either it is not regex, or regex failed
        if se == 'year': #We want to save the season of the video as the year it is published
            d = ytube.convert_published(vid['snippet']['publishedAt'])
            season = d['year']
        elif se.isdigit(): #If the season is set to a hardcoded number
            season = str(se)
        else:
            dev.log('Error: invalid season tag in settings.xml: '+se+', set season to 0', True)
            season = '0'
        
    found = False
    #See if there should be a regex search for the episode
    if ep[:6] == 'regex(':
        match = reg(ep, vid['snippet']['title'])
        if match != None:
            episode = match
            found = True
    
    if found == False:
        if ep == 'default':
            if playlist == False:
                dev.log('episode_season: Error: episode recognisition set to default, but no playlist id given')
                return [season, '0']
            #Get the current episode number from episodes.xml
            from resources.lib import m_xml
            episode = m_xml.number_of_episodes(playlist, season)
            if episode == None:
                episode = 0
            episode = str(episode + 1)
        elif ep == 'monthday': #We want the episode to be the month number + day number
            d = ytube.convert_published(vid['snippet']['publishedAt'])
            episode = d['month']+d['day']
        elif ep == 'monthdayhour': #month number + day number + hour number
            d = ytube.convert_published(vid['snippet']['publishedAt'])
            episode = d['month']+d['day']+d['hour']
        elif ep == 'monthdayhourminute': #month + day + hour + minute numbers
            d = ytube.convert_published(vid['snippet']['publishedAt'])
            episode = d['month']+d['day']+d['hour']+d['minute']
        elif ep == 'pos': #The position in the playlist as episode number
            episode = str(int(totalresults) - int(vid['snippet']['position']))
        elif ep.isdigit(): #A hardcoded number as episode number
            episode = str(ep)
        else:
            dev.log('Invalid episode setting in settings.xml! '+ep)
            episode = '0'
            
    return season, episode, vid
Exemplo n.º 10
0
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