added option to exclude theme videos on sync

This commit is contained in:
im85288 2015-07-24 12:52:33 +01:00
parent 7f21c61753
commit 6e66f60331
1 changed files with 13 additions and 11 deletions

View File

@ -124,7 +124,6 @@ def addUser():
# THEME MUSIC/VIDEOS # THEME MUSIC/VIDEOS
def getThemeMedia(): def getThemeMedia():
doUtils = DownloadUtils() doUtils = DownloadUtils()
playUtils = PlayUtils() playUtils = PlayUtils()
@ -156,7 +155,9 @@ def getThemeMedia():
dialog = xbmcgui.Dialog() dialog = xbmcgui.Dialog()
dialog.ok('Warning', 'The settings file does not exist in tvtunes. Go to the tvtunes addon and change a setting, then come back and re-run') dialog.ok('Warning', 'The settings file does not exist in tvtunes. Go to the tvtunes addon and change a setting, then come back and re-run')
return return
# Offer to exclude video themes
includeVideoThemes = xbmcgui.Dialog().yesno("Theme Types", "Should video themes be included?")
# Create library directory # Create library directory
if not xbmcvfs.exists(library): if not xbmcvfs.exists(library):
@ -174,15 +175,16 @@ def getThemeMedia():
# Get Ids with Theme Videos # Get Ids with Theme Videos
itemIds = {} itemIds = {}
for view in userViews: if includeVideoThemes:
url = "{server}/mediabrowser/Users/{UserId}/Items?HasThemeVideo=True&ParentId=%s&format=json" % view for view in userViews:
result = doUtils.downloadUrl(url) url = "{server}/mediabrowser/Users/{UserId}/Items?HasThemeVideo=True&ParentId=%s&format=json" % view
if result[u'TotalRecordCount'] != 0: result = doUtils.downloadUrl(url)
for item in result[u'Items']: if result[u'TotalRecordCount'] != 0:
itemId = item[u'Id'] for item in result[u'Items']:
folderName = item[u'Name'] itemId = item[u'Id']
folderName = utils.normalize_string(folderName.encode('utf-8')) folderName = item[u'Name']
itemIds[itemId] = folderName folderName = utils.normalize_string(folderName.encode('utf-8'))
itemIds[itemId] = folderName
# Get paths for theme videos # Get paths for theme videos
for itemId in itemIds: for itemId in itemIds: