mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-05-09 02:45:07 +00:00
added nextup videonode to tvshow collections
This commit is contained in:
commit
93f2d4cd91
7 changed files with 68 additions and 49 deletions
|
@ -238,7 +238,10 @@ class DownloadUtils():
|
|||
self.logMsg("====== 200 Success ======", 2)
|
||||
return r
|
||||
except:
|
||||
self.logMsg("Unable to convert the response for: %s" % url, 1)
|
||||
if r.headers['content-type'] == "text/html":
|
||||
pass
|
||||
else:
|
||||
self.logMsg("Unable to convert the response for: %s" % url, 1)
|
||||
else:
|
||||
r.raise_for_status()
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@ from DownloadUtils import DownloadUtils
|
|||
from PlaybackUtils import PlaybackUtils
|
||||
|
||||
class Kodi_Monitor(xbmc.Monitor):
|
||||
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
xbmc.Monitor.__init__(self)
|
||||
|
||||
|
@ -26,7 +29,8 @@ class Kodi_Monitor(xbmc.Monitor):
|
|||
#this library monitor is used to detect a watchedstate change by the user through the library
|
||||
#as well as detect when a library item has been deleted to pass the delete to the Emby server
|
||||
def onNotification (self,sender,method,data):
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
|
||||
WINDOW = self.WINDOW
|
||||
downloadUtils = DownloadUtils()
|
||||
|
||||
if method == "VideoLibrary.OnUpdate":
|
||||
|
@ -37,15 +41,26 @@ class Kodi_Monitor(xbmc.Monitor):
|
|||
playcount = jsondata.get("playcount")
|
||||
item = jsondata.get("item").get("id")
|
||||
type = jsondata.get("item").get("type")
|
||||
if playcount != None:
|
||||
prop = WINDOW.getProperty('Played%s%s' % (type,item))
|
||||
|
||||
if (playcount != None) and (prop != "true"):
|
||||
WINDOW.setProperty("Played%s%s" % (type,item), "true")
|
||||
utils.logMsg("MB# Sync","Kodi_Monitor--> VideoLibrary.OnUpdate : " + str(data),2)
|
||||
WriteKodiDB().updatePlayCountFromKodi(item, type, playcount)
|
||||
|
||||
self.clearProperty(type,item)
|
||||
|
||||
if method == "System.OnWake":
|
||||
xbmc.sleep(10000) #Allow network to wake up
|
||||
utils.logMsg("Doing_Db_Sync Post Resume: syncDatabase (Started)",1)
|
||||
libSync = LibrarySync().FullLibrarySync()
|
||||
utils.logMsg("Doing_Db_Sync Post Resume: syncDatabase (Finished) " + str(libSync),1)
|
||||
|
||||
def clearProperty(self,type,id):
|
||||
# The sleep is necessary since VideoLibrary.OnUpdate
|
||||
# triggers 3 times in a row.
|
||||
xbmc.sleep(100)
|
||||
self.WINDOW.clearProperty("Played%s%s" % (type,id))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ class PlaybackUtils():
|
|||
if xbmc.getCondVisibility("Window.IsActive(home)"):
|
||||
xbmc.Player().play(playurl,listItem)
|
||||
else:
|
||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listItem)
|
||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listItem)
|
||||
|
||||
def setArt(self, list,name,path):
|
||||
if name=='thumb' or name=='fanart_image' or name=='small_poster' or name=='tiny_poster' or name == "medium_landscape" or name=='medium_poster' or name=='small_fanartimage' or name=='medium_fanartimage' or name=='fanart_noindicators':
|
||||
|
|
|
@ -143,16 +143,6 @@ def CleanName(filename):
|
|||
cleanedFilename = unicodedata.normalize('NFKD', filename).encode('ASCII', 'ignore')
|
||||
return ''.join(c for c in cleanedFilename if c in validFilenameChars)
|
||||
|
||||
|
||||
def removeDirectory(path):
|
||||
if xbmcvfs.exists(path):
|
||||
allDirs, allFiles = xbmcvfs.listdir(path)
|
||||
for dir in allDirs:
|
||||
xbmcvfs.rmdir(os.path.join(path,dir))
|
||||
for file in allFiles:
|
||||
xbmcvfs.delete(os.path.join(path,file))
|
||||
|
||||
xbmcvfs.rmdir(path)
|
||||
|
||||
def reset():
|
||||
|
||||
|
@ -161,6 +151,16 @@ def reset():
|
|||
if return_value == 0:
|
||||
return
|
||||
|
||||
#cleanup video nodes
|
||||
import shutil
|
||||
path = "special://userdata/library/video/"
|
||||
if xbmcvfs.exists(path):
|
||||
allDirs, allFiles = xbmcvfs.listdir(path)
|
||||
for dir in allDirs:
|
||||
if dir.startswith("Emby "):
|
||||
shutil.rmtree(xbmc.translatePath("special://userdata/library/video/" + dir))
|
||||
|
||||
|
||||
# Ask if user information should be deleted too.
|
||||
return_user = xbmcgui.Dialog().yesno("Warning", "Reset all Emby Addon settings?")
|
||||
|
||||
|
|
|
@ -1159,6 +1159,17 @@ class WriteKodiDB():
|
|||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||
except:
|
||||
ET.ElementTree(root).write(nodefile)
|
||||
|
||||
#create tag node - nextup items
|
||||
nodefile = os.path.join(libraryPath, tagname + "_nextup_episodes.xml")
|
||||
root = Element("node", {"order":"4", "type":"folder"})
|
||||
SubElement(root, "label").text = tagname + " - Nextup episodes"
|
||||
SubElement(root, "path").text = "plugin://plugin.video.emby/?id=%s&mode=nextup&limit=25" %tagname
|
||||
SubElement(root, "icon").text = "DefaultMovies.png"
|
||||
try:
|
||||
ET.ElementTree(root).write(nodefile, xml_declaration=True)
|
||||
except:
|
||||
ET.ElementTree(root).write(nodefile)
|
||||
|
||||
def updateBoxsetToKodiLibrary(self, boxsetmovie, boxset, connection, cursor):
|
||||
strSet = boxset["Name"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue