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

View file

@ -74,6 +74,10 @@ def doMainListing():
addDirectoryItem("Settings", "plugin://plugin.video.emby/?mode=settings", 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(
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(
label="Repair local database (force update all content)",
@ -370,6 +374,31 @@ def getThemeMedia():
time=1000,
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 #####
def BrowseChannels(itemid, folderid=None):

View file

@ -132,11 +132,7 @@ def reset():
xbmc.sleep(1000)
# 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))
deletePlaylists()
# Clean up the video nodes
import shutil
@ -492,4 +488,13 @@ def playlistXSP(mediatype, tagname, viewtype="", delete=False):
'</smartplaylist>'
% (itemtypes.get(mediatype, mediatype), plname, tagname))
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))