Add refresh for videonodes
To fix home video nodes.
This commit is contained in:
parent
55d841b0b3
commit
1d6556fb44
2 changed files with 22 additions and 14 deletions
|
@ -85,7 +85,7 @@ def doMainListing():
|
||||||
addDirectoryItem("Network credentials", "plugin://plugin.video.emby/?mode=passwords")
|
addDirectoryItem("Network credentials", "plugin://plugin.video.emby/?mode=passwords")
|
||||||
addDirectoryItem("Settings", "plugin://plugin.video.emby/?mode=settings")
|
addDirectoryItem("Settings", "plugin://plugin.video.emby/?mode=settings")
|
||||||
addDirectoryItem("Add user to session", "plugin://plugin.video.emby/?mode=adduser")
|
addDirectoryItem("Add user to session", "plugin://plugin.video.emby/?mode=adduser")
|
||||||
addDirectoryItem("Refresh Emby playlists", "plugin://plugin.video.emby/?mode=refreshplaylist")
|
addDirectoryItem("Refresh Emby playlists/nodes", "plugin://plugin.video.emby/?mode=refreshplaylist")
|
||||||
addDirectoryItem("Perform manual sync", "plugin://plugin.video.emby/?mode=manualsync")
|
addDirectoryItem("Perform manual sync", "plugin://plugin.video.emby/?mode=manualsync")
|
||||||
addDirectoryItem("Repair local database (force update all content)", "plugin://plugin.video.emby/?mode=repair")
|
addDirectoryItem("Repair local database (force update all content)", "plugin://plugin.video.emby/?mode=repair")
|
||||||
addDirectoryItem("Perform local database reset (full resync)", "plugin://plugin.video.emby/?mode=reset")
|
addDirectoryItem("Perform local database reset (full resync)", "plugin://plugin.video.emby/?mode=reset")
|
||||||
|
@ -382,19 +382,22 @@ def refreshPlaylist():
|
||||||
try:
|
try:
|
||||||
# First remove playlists
|
# First remove playlists
|
||||||
utils.deletePlaylists()
|
utils.deletePlaylists()
|
||||||
|
# Remove video nodes
|
||||||
|
utils.deleteNodes()
|
||||||
# Refresh views
|
# Refresh views
|
||||||
lib.refreshViews()
|
lib.refreshViews()
|
||||||
dialog.notification(
|
dialog.notification(
|
||||||
heading="Emby for Kodi",
|
heading="Emby for Kodi",
|
||||||
message="Emby playlist refreshed",
|
message="Emby playlists/nodes refreshed",
|
||||||
icon="special://home/addons/plugin.video.emby/icon.png",
|
icon="special://home/addons/plugin.video.emby/icon.png",
|
||||||
time=1000,
|
time=1000,
|
||||||
sound=False)
|
sound=False)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
utils.logMsg("EMBY", "Refresh playlist failed: %s" % e, 1)
|
utils.logMsg("EMBY", "Refresh playlists/nodes failed: %s" % e, 1)
|
||||||
dialog.notification(
|
dialog.notification(
|
||||||
heading="Emby for Kodi",
|
heading="Emby for Kodi",
|
||||||
message="Emby playlist refresh failed",
|
message="Emby playlists/nodes refresh failed",
|
||||||
icon=xbmcgui.NOTIFICATION_ERROR,
|
icon=xbmcgui.NOTIFICATION_ERROR,
|
||||||
time=1000,
|
time=1000,
|
||||||
sound=False)
|
sound=False)
|
||||||
|
|
|
@ -140,15 +140,7 @@ def reset():
|
||||||
deletePlaylists()
|
deletePlaylists()
|
||||||
|
|
||||||
# Clean up the video nodes
|
# Clean up the video nodes
|
||||||
import shutil
|
deleteNodes()
|
||||||
path = xbmc.translatePath("special://profile/library/video/").decode('utf-8')
|
|
||||||
dirs, files = xbmcvfs.listdir(path)
|
|
||||||
for dir in dirs:
|
|
||||||
if dir.decode('utf-8').startswith('Emby'):
|
|
||||||
shutil.rmtree("%s%s" % (path, dir.decode('utf-8')))
|
|
||||||
for file in files:
|
|
||||||
if file.decode('utf-8').startswith('emby'):
|
|
||||||
xbmcvfs.delete("%s%s" % (path, file.decode('utf-8')))
|
|
||||||
|
|
||||||
# Wipe the kodi databases
|
# Wipe the kodi databases
|
||||||
logMsg("EMBY", "Resetting the Kodi video database.")
|
logMsg("EMBY", "Resetting the Kodi video database.")
|
||||||
|
@ -503,3 +495,16 @@ def deletePlaylists():
|
||||||
for file in files:
|
for file in files:
|
||||||
if file.decode('utf-8').startswith('Emby'):
|
if file.decode('utf-8').startswith('Emby'):
|
||||||
xbmcvfs.delete("%s%s" % (path, file))
|
xbmcvfs.delete("%s%s" % (path, file))
|
||||||
|
|
||||||
|
def deleteNodes():
|
||||||
|
|
||||||
|
# Clean up video nodes
|
||||||
|
import shutil
|
||||||
|
path = xbmc.translatePath("special://profile/library/video/").decode('utf-8')
|
||||||
|
dirs, files = xbmcvfs.listdir(path)
|
||||||
|
for dir in dirs:
|
||||||
|
if dir.decode('utf-8').startswith('Emby'):
|
||||||
|
shutil.rmtree("%s%s" % (path, dir.decode('utf-8')))
|
||||||
|
for file in files:
|
||||||
|
if file.decode('utf-8').startswith('emby'):
|
||||||
|
xbmcvfs.delete("%s%s" % (path, file.decode('utf-8')))
|
Loading…
Reference in a new issue