Add force refresh playlist

To correct missing tag bug.
This commit is contained in:
angelblue05 2015-12-26 03:42:13 -06:00
parent 7b3aae2d83
commit a5e9fb1698
3 changed files with 46 additions and 9 deletions

View File

@ -59,7 +59,8 @@ class Main:
'channelsfolder': entrypoint.BrowseChannels, 'channelsfolder': entrypoint.BrowseChannels,
'nextup': entrypoint.getNextUpEpisodes, 'nextup': entrypoint.getNextUpEpisodes,
'inprogressepisodes': entrypoint.getInProgressEpisodes, 'inprogressepisodes': entrypoint.getInProgressEpisodes,
'recentepisodes': entrypoint.getRecentEpisodes 'recentepisodes': entrypoint.getRecentEpisodes,
'refreshplaylist': entrypoint.refreshPlaylist
} }
if modes.get(mode): if modes.get(mode):
@ -87,10 +88,12 @@ class Main:
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)') xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
elif mode in ("manualsync", "repair"): elif mode in ("manualsync", "repair"):
import librarysync import librarysync
lib = librarysync.LibrarySync()
if mode == "manualsync": if mode == "manualsync":
librarysync.LibrarySync().fullSync(manualrun=True) lib.fullSync(manualrun=True)
else: else:
librarysync.LibrarySync().fullSync(repair=True) lib.fullSync(repair=True)
elif mode == "texturecache": elif mode == "texturecache":
import artwork import artwork
artwork.Artwork().FullTextureCacheSync() artwork.Artwork().FullTextureCacheSync()

View File

@ -74,6 +74,10 @@ def doMainListing():
addDirectoryItem("Settings", "plugin://plugin.video.emby/?mode=settings", False) addDirectoryItem("Settings", "plugin://plugin.video.emby/?mode=settings", False)
addDirectoryItem("Add user to session", "plugin://plugin.video.emby/?mode=adduser", False) addDirectoryItem("Add user to session", "plugin://plugin.video.emby/?mode=adduser", False)
#addDirectoryItem("Cache all images to Kodi texture cache (advanced)", "plugin://plugin.video.emby/?mode=texturecache") #addDirectoryItem("Cache all images to Kodi texture cache (advanced)", "plugin://plugin.video.emby/?mode=texturecache")
addDirectoryItem(
label="Refresh Emby playlists",
path="plugin://plugin.video.emby/?mode=refreshplaylist",
folder=False)
addDirectoryItem("Perform manual sync", "plugin://plugin.video.emby/?mode=manualsync", False) addDirectoryItem("Perform manual sync", "plugin://plugin.video.emby/?mode=manualsync", False)
addDirectoryItem( addDirectoryItem(
label="Repair local database (force update all content)", label="Repair local database (force update all content)",
@ -370,6 +374,31 @@ def getThemeMedia():
time=1000, time=1000,
sound=False) sound=False)
##### REFRESH EMBY PLAYLISTS #####
def refreshPlaylist():
lib = librarysync.LibrarySync()
dialog = xbmcgui.Dialog()
try:
# First remove playlists
utils.deletePlaylists()
# Refresh views
lib.refreshViews()
dialog.notification(
heading="Emby for Kodi",
message="Emby playlist refreshed!",
icon="special://home/addons/plugin.video.emby/icon.png",
time=1000,
sound=False)
except Exception as e:
utils.logMsg("EMBY", "Refresh playlist failed: %s" % e, 1)
dialog.notification(
heading="Emby for Kodi",
message="Emby playlist refresh failed!",
icon="special://home/addons/plugin.video.emby/icon.png",
time=1000,
sound=False)
##### BROWSE EMBY CHANNELS ##### ##### BROWSE EMBY CHANNELS #####
def BrowseChannels(itemid, folderid=None): def BrowseChannels(itemid, folderid=None):

View File

@ -132,11 +132,7 @@ def reset():
xbmc.sleep(1000) xbmc.sleep(1000)
# Clean up the playlists # Clean up the playlists
path = xbmc.translatePath("special://profile/playlists/video/").decode('utf-8') deletePlaylists()
dirs, files = xbmcvfs.listdir(path)
for file in files:
if file.startswith('Emby'):
xbmcvfs.delete("%s%s" % (path, file))
# Clean up the video nodes # Clean up the video nodes
import shutil import shutil
@ -493,3 +489,12 @@ def playlistXSP(mediatype, tagname, viewtype="", delete=False):
% (itemtypes.get(mediatype, mediatype), plname, tagname)) % (itemtypes.get(mediatype, mediatype), plname, tagname))
f.close() f.close()
logMsg("EMBY", "Successfully added playlist: %s" % tagname) logMsg("EMBY", "Successfully added playlist: %s" % tagname)
def deletePlaylists():
# Clean up the playlists
path = xbmc.translatePath("special://profile/playlists/video/").decode('utf-8')
dirs, files = xbmcvfs.listdir(path)
for file in files:
if file.startswith('Emby'):
xbmcvfs.delete("%s%s" % (path, file))