if len(tmpGenres) > 0:
				tmpGenres.sort()
				filter.append(("Genre", ("Genres", True), tmpGenres))
				
			if len(tmpAbc) > 0:
				tmpAbc.sort()
				filter.append(("Abc", ("Title", False, 1), tmpAbc))
			
			return (parsedLibrary, ("ViewMode", "Id", ), None, None, sort, filter)
		
		elif params["ViewMode"] == "Tree":
			pass
		
		elif params["ViewMode"]=="ShowGroup":
			pass
	
		return None

	def buildInfoPlaybackArgs(self, entry):
		args = {}
		args["id"] 	= entry["Id"]
		args["title"]   = entry["Title"]
		args["year"]    = entry["Year"]
		args["imdbid"]  = entry["ImdbId"]
		args["type"]    = "movie"
		return args

if gAvailable is True:
	registerPlugin(Plugin(id="movies", name=_("Movies"), start=DMC_MovieLibrary, where=Plugin.MENU_VIDEOS, weight=1))
        args["type"] = "tvshow"
        return args


def settings():
    s = []
    s.append((
        _("Enabled"),
        config.plugins.pvmc.plugins.latestepisodes.enabled,
    ))
    s.append((
        _("days back"),
        config.plugins.pvmc.plugins.latestepisodes.daysback,
    ))
    return s


if gAvailable is True:
    registerPlugin(
        Plugin(id="newestepisodes",
               name=_("Newest Episodes"),
               fnc=settings,
               where=Plugin.SETTINGS))
    if config.plugins.pvmc.plugins.latestepisodes.enabled.value:
        registerPlugin(
            Plugin(id="newestepisodes",
                   name=_("Newest Episodes"),
                   start=DMC_NewestEpisodes,
                   where=Plugin.MENU_VIDEOS,
                   weight=6))
		planedTimestamp += 60*60*24
	
	printl("currentTime: " + str(localtime(currentTimestamp)), "DMC_AutoSync::getPlanedTime", "I")
	printl("planedTime: " + str(localtime(planedTimestamp)), "DMC_AutoSync::getPlanedTime", "I")
	
	return (currentTimestamp, planedTimestamp, )

def callback():
	printl("->", "DMC_AutoSync::callback", "I")
	global gSession
	from Plugins.Extensions.ProjectValerie.DMC_Global import PowerManagement
	PowerManagement(gSession).standby()

def wakeup():
	if config.plugins.pvmc.plugins.autosync.onstart.value == False:
		return -1
	
	return getPlanedTime()[1]

def settings():
	s = []
	s.append((_("Autosync Database on start"), config.plugins.pvmc.plugins.autosync.onstart, ))
	s.append((_("Autosync time"), config.plugins.pvmc.plugins.autosync.time, ))
	return s

if gAvailable is True:
	registerPlugin(Plugin(id="autosync", name=_("AutoSync"), fnc=settings, where=Plugin.SETTINGS))
	from Plugins.Extensions.ProjectValerie.DMC_Plugins.DMC_SyncExtras.plugin import ProjectValerieSync
	registerPlugin(Plugin(id="autosync", name=_("AutoSync"), fnc=autostart, where=Plugin.AUTOSTART_DELAYED, weight=10000))
	registerPlugin(Plugin(id="autosync", name=_("AutoSync"), fnc=wakeup, where=Plugin.WAKEUP))
	s.append((_("Skin"), config.plugins.pvmc.skin, ))
	s.append((_("On Power press"), config.plugins.pvmc.onpowerpress, ))
	s.append((_("Show Movie and TVShow in main menu"), config.plugins.pvmc.showmovieandtvinmainmenu, ))
	s.append((_("Seen / Unseen User ID"), config.plugins.pvmc.seenuserid, ))
	s.append((_("Show Seen / Unseen for Shows"), config.plugins.pvmc.showseenforshow, ))
	s.append((_("Show Seen / Unseen for Seasons"), config.plugins.pvmc.showseenforseason, ))
	return s

def settings_expert():
	s = []
	s.append((_("Valerie Config folder (Database, ...)"), config.plugins.pvmc.configfolderpath, ))
	s.append((_("Valerie media folder (Poster, Backdrops)"), config.plugins.pvmc.mediafolderpath, ))
	s.append((_("Valerie tmp folder (Logs, Cache)"), config.plugins.pvmc.tmpfolderpath, ))
	s.append((_("Valerie debug mode"), config.plugins.pvmc.debugMode, ))
	return s

def stop_e2(session):
	printl("->", __name__, "S")
	try:
		import os
		os.system("chmod 777 " + config.plugins.pvmc.configfolderpath.value + "stop.sh")
		os.system("/bin/sh " + config.plugins.pvmc.configfolderpath.value + "stop.sh")
	except Exception, e:
		printl("Exception(" + str(type(ex)) + "): " + str(ex), self, "W")

registerPlugin(Plugin(id="stop",         name="Excecute stop.sh on e2 shutdown", fnc=stop_e2, where=Plugin.STOP_E2))
registerPlugin(Plugin(id="settings", name="", fnc=settings, where=Plugin.SETTINGS, weight=10))
registerPlugin(Plugin(id="expert",   name=_("Expert"), fnc=settings_expert, where=Plugin.SETTINGS, weight=1000))
registerPlugin(Plugin(id="settings",     name=_("Settings"), start=PVMC_Settings, where=Plugin.MENU_SYSTEM, supportStillPicture=True, weight=20))
registerPlugin(Plugin(id="update",       name=_("Update"), start=PVMC_Update, where=Plugin.MENU_SYSTEM, supportStillPicture=True, weight=30))
Example #5
0
		gtrakt.setProgress(d["progress"])
	if d.has_key("duration"):
		gtrakt.setDuration(d["duration"])
	
	if d.has_key("status"):
		# send status updates only if state has changed
		if d["status"] == gtrakt.getStatus():
			return
		if d["status"] == "playing":
			gtrakt.setStatus(TraktAPI.STATUS_WATCHING)
		elif d["status"] == "stopped":
			gtrakt.setStatus(TraktAPI.STATUS_WATCHED)
	else:
		# do not send progress updates without status change
		return
	
	if config.plugins.pvmc.plugins.trakt.enabled.value is True:
		gtrakt.setUsernameAndPassword(config.plugins.pvmc.plugins.trakt.username.value, config.plugins.pvmc.plugins.trakt.password.value)
		if gtrakt.getStatus() == TraktAPI.STATUS_WATCHED:
			if gtrakt.getProgress() >= 70:
				gtrakt.send()
			else:
				gtrakt.setStatus(TraktAPI.STATUS_CANCELED)
				gtrakt.send()
		else:
			gtrakt.send()

if gAvailable is True:
	registerPlugin(Plugin(id="trakt", name=_("trakt.tv"), fnc=settings, where=Plugin.SETTINGS))
	registerPlugin(Plugin(id="trakt", name=_("trakt.tv"), fnc=autostart, where=Plugin.AUTOSTART))
	registerPlugin(Plugin(id="trakt", name=_("trakt.tv"), fnc=info_playback, where=Plugin.INFO_PLAYBACK))
gAvailable = False
try:
	from Plugins.Extensions.MerlinMusicPlayer.plugin import MerlinMusicPlayerFileList
	gAvailable = True
except Exception, ex:
	printl("Merlin Music Player not found", "I")
	gAvailable = False
	MerlinMusicPlayerFileList = object

class PVMC_MerlinMusicPlayer(MerlinMusicPlayerFileList):

	#If custom skin should be used, define it here or in the skin.xml file
	#skin = "<screen ...."

	def __init__(self, session):
		MerlinMusicPlayerFileList.__init__(self, session, None)
		# If no own screen os provided, use the one of the plugin
		self.skinName = "MerlinMusicPlayerFileList"

def settings():
	s = []
	if gAvailable is True:
		s.append((_("Show"), config.plugins.pvmc.plugins.merlinmusicplayer.show, ))
	return s

if gAvailable is True:
	p = []
	p.append(Plugin(id="merlinmusicplayer", name=_("MerlinMusicPlayer"), fnc=settings, where=Plugin.SETTINGS))
	p.append(Plugin(id="merlinmusicplayer", name=_("MerlinMusicPlayer"), start=PVMC_MerlinMusicPlayer, where=Plugin.MENU_MUSIC))
	registerPlugin(p)

def autostart(session):
    printl("autostart->")
    try:
        thread = InternetTime(session)
        thread.start()
    except Exception, ex:
        printl("Exception(Can be ignored): " + str(ex), __name__, "W")


def settings():
    s = []
    s.append((
        _("Sync time on start"),
        config.plugins.pvmc.plugins.internettime.autosync,
    ))
    return s


if gAvailable is True:
    registerPlugin(
        Plugin(id="internettime",
               name=_("InternetTime"),
               fnc=settings,
               where=Plugin.SETTINGS))
    registerPlugin(
        Plugin(id="internettime",
               name=_("InternetTime"),
               fnc=autostart,
               where=Plugin.AUTOSTART))
    t = gettext.dgettext("ProjectValerie", txt)
    if t == txt:
        t = gettext.gettext(txt)
    return t


localeInit()
language.addCallback(localeInit)

gAvailable = False
try:
    from Plugins.Extensions.YTTrailer.plugin import YTTrailer
    gAvailable = True
except Exception, ex:
    printl("YTTrailer not found", "I")
    gAvailable = False


def start(session, args):
    if args.has_key("Title"):
        ytTrailer = YTTrailer(session)
        ytTrailer.showTrailer(args["Title"])


if gAvailable is True:
    registerPlugin(
        Plugin(id="yttrailer",
               name=_("YTTrailer"),
               desc=_("View Trailer (YTTrailer by Dr. Best)"),
               fnc=start,
               where=Plugin.MENU_MOVIES_PLUGINS))
	def run(self):
		printl("run->", self, "S")
		
		if config.plugins.pvmc.plugins.internettime.autosync.value is False:
			return
		
		if haveRTC() is False:
			date = getUTC()
			if date is not None:
				setUTC(date)
		
		printl("run<-", self, "S")


def autostart(session):
	printl("autostart->")
	try:
		thread = InternetTime(session)
		thread.start()
	except Exception, ex:
		printl("Exception(Can be ignored): " + str(ex), __name__, "W")

def settings():
	s = []
	s.append((_("Sync time on start"), config.plugins.pvmc.plugins.internettime.autosync, ))
	return s

if gAvailable is True:
	registerPlugin(Plugin(id="internettime", name=_("InternetTime"), fnc=settings, where=Plugin.SETTINGS))
	registerPlugin(Plugin(id="internettime", name=_("InternetTime"), fnc=autostart, where=Plugin.AUTOSTART))
Example #10
0
            gmy.setType(-1)
    if d.has_key("progress"):
        gmy.setProgress(d["progress"])

    if config.plugins.pvmc.plugins.myepisodes.enabled.value is True:
        gmy.setUsernameAndPassword(
            config.plugins.pvmc.plugins.myepisodes.username.value,
            config.plugins.pvmc.plugins.myepisodes.password.value)
        if gmy.getType() == MyEpisodesAPI.TYPE_TVSHOW:
            if d.has_key("status"):
                if d["status"] == "stopped":
                    if gmy.getProgress() >= 70:
                        gmy.send()


if gAvailable is True:
    registerPlugin(
        Plugin(id="myepisodes",
               name=_("myepisodes"),
               fnc=settings,
               where=Plugin.SETTINGS))
    registerPlugin(
        Plugin(id="myepisodes",
               name=_("myepisodes"),
               fnc=autostart,
               where=Plugin.AUTOSTART))
    registerPlugin(
        Plugin(id="myepisodes",
               name=_("myepisodes"),
               fnc=info_playback,
               where=Plugin.INFO_PLAYBACK))
		)

	def getPlaybackList(self, entry):
		playbackList = []
		
		playbackList.append( (entry["Path"], entry["Title"], entry, ))
		
		return playbackList

	def buildInfoPlaybackArgs(self, entry):
		args = {}
		args["id"] 	= entry["Id"]
		args["title"]   = entry["Title"]
		args["year"]    = entry["Year"]
		args["thetvdb"] = entry["TheTvDbId"]
		args["season"]  = entry["Season"]
		args["episode"] = entry["Episode"]
		args["type"]    = "tvshow"
		return args

def settings():
	s = []
	s.append((_("Enabled"), config.plugins.pvmc.plugins.latestepisodes.enabled, ))
	s.append((_("days back"), config.plugins.pvmc.plugins.latestepisodes.daysback, ))
	return s

if gAvailable is True:
	registerPlugin(Plugin(id="newestepisodes", name=_("Newest Episodes"), fnc=settings, where=Plugin.SETTINGS))
	if config.plugins.pvmc.plugins.latestepisodes.enabled.value:
		registerPlugin(Plugin(id="newestepisodes", name=_("Newest Episodes"), start=DMC_NewestEpisodes, where=Plugin.MENU_VIDEOS, weight=6))
Example #12
0
def startPlugin(session):
    if isInetAvailable():
        from Plugins.Extensions.ProjectValerie.DMC_Plugins.DMC_SyncExtras.plugin import ProjectValerieSync
        session.open(ProjectValerieSync)
    else:
        from Screens.MessageBox import MessageBox
        session.open(MessageBox,
                     _("No internet connection available!"),
                     MessageBox.TYPE_INFO,
                     timeout=10)


registerPlugin(
    Plugin(id="sync",
           name=_("Synchronize"),
           fnc=settings,
           where=Plugin.SETTINGS))
registerPlugin(
    Plugin(id="sync",
           name=_("Synchronize"),
           fnc=startPlugin,
           where=Plugin.MENU_SYSTEM,
           supportStillPicture=True,
           weight=10))
if config.plugins.pvmc.plugins.sync.fastsynconautostart.value is True:
    registerPlugin(
        Plugin(id="sync",
               name=_("Synchronize"),
               fnc=autostartPlugin,
               where=Plugin.AUTOSTART))
Example #13
0
		setSeen(args["Id"], True)
	
def markUnSeen(session, args):
	if args.has_key("Id"):
		setSeen(args["Id"], False)
	
def info_playback(d, flags):
	global progress
	global status
	global id
	if flags.has_key("DO_NOT_TRACK") and flags["DO_NOT_TRACK"] is True:
		return
	
	status = ""
	if d.has_key("progress"):
		progress = d["progress"]
	if d.has_key("status"):
		status = d["status"]
	if d.has_key("id"):
		id = d["id"]

	if status == "stopped":
		if progress >= 70:
			setSeen(id, True)

if gAvailable is True:
	registerPlugin(Plugin(id="seen", name=_("Seen"), fnc=autostart, where=Plugin.AUTOSTART))
	registerPlugin(Plugin(id="seen", name=_("Seen"), fnc=info_playback, where=Plugin.INFO_PLAYBACK))
	#registerPlugin(Plugin(name=_("Seen"), fnc=is_Seen, where=Plugin.INFO_SEEN))
	registerPlugin(Plugin(id="seen", name=_("Mark as Seen"), fnc=markSeen, where=Plugin.MENU_MOVIES_PLUGINS))
	registerPlugin(Plugin(id="unseen", name=_("Mark as Unseen"), fnc=markUnSeen, where=Plugin.MENU_MOVIES_PLUGINS))
Example #14
0
				for zip_entry in files:
					if os.path.splitext( zip_entry )[1] in exts:
						subtitle_file, file_path = self.create_name(zip_entry,sub_filename,subtitle_lang)
						shutil.copy(subtitle_file, file_path)
						#subtitle_set,file_path  = self.copy_files( subtitle_file, file_path )            
		
		try:
			shutil.rmtree(str(self.tmp_sub_dir))
		except Exception, ex:
			printl("Exception: " + str(ex), __name__, "E")

	def create_name(self,zip_entry,sub_filename,subtitle_lang):
		sub_ext  = os.path.splitext( zip_entry )[1]
		sub_name = os.path.splitext( sub_filename )[0]
		#Workaroudn the problem that default e2 can not parse movie.eng.srt 
		#file_name = "%s.%s%s" % ( sub_name, subtitle_lang, sub_ext )
		file_name = "%s%s" % ( sub_name, sub_ext )
		file_path = os.path.join(self.sub_folder, file_name)
		subtitle_file = os.path.join(self.tmp_sub_dir, zip_entry)
		return subtitle_file, file_path


gsubdown = None

def autostart(session):
	global gsubdown

if gAvailable is True:
	registerPlugin(Plugin(id="subdown", name=_("SubtitleDownloader"), fnc=settings, where=Plugin.SETTINGS))
	#registerPlugin(Plugin(name=_("SubtitleDownloader"), fnc=autostart, where=Plugin.AUTOSTART))
	registerPlugin(Plugin(id="subdown", name=_("Download subtitles"), start=DMC_SubtitleDownloader, where=Plugin.MENU_MOVIES_PLUGINS))
                    playbackList.append((
                        episodeDict["Path"],
                        episodeDict["Title"],
                        episodeDict,
                    ))
                    nextEpisode += 1
                    found = True
                    break

        return playbackList

    def buildInfoPlaybackArgs(self, entry):
        args = {}
        args["id"] = entry["Id"]
        args["title"] = entry["Title"]
        args["year"] = entry["Year"]
        args["thetvdb"] = entry["TheTvDbId"]
        args["season"] = entry["Season"]
        args["episode"] = entry["Episode"]
        args["type"] = "tvshow"
        return args


if gAvailable is True:
    registerPlugin(
        Plugin(id="tvshows",
               name=_("TV Shows"),
               start=DMC_TvShowLibrary,
               where=Plugin.MENU_VIDEOS,
               weight=4))
	lang = language.getLanguage()
	os.environ["LANGUAGE"] = lang[:2]
	gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANGUAGE))
	gettext.textdomain("enigma2")
	gettext.bindtextdomain("ProjectValerie", "%s%s" % (resolveFilename(SCOPE_PLUGINS), "Extensions/ProjectValerie/locale/"))

def _(txt):
	t = gettext.dgettext("ProjectValerie", txt)
	if t == txt:
		t = gettext.gettext(txt)
	return t

localeInit()
language.addCallback(localeInit)

gAvailable = False
try:
	from Plugins.Extensions.YTTrailer.plugin import YTTrailer
	gAvailable = True
except Exception, ex:
	printl("YTTrailer not found", "I")
	gAvailable = False

def start(session, args):
	if args.has_key("Title"):
		ytTrailer = YTTrailer(session)
		ytTrailer.showTrailer(args["Title"])

if gAvailable is True:
	registerPlugin(Plugin(id="yttrailer", name=_("YTTrailer"), desc=_("View Trailer (YTTrailer by Dr. Best)"), fnc=start, where=Plugin.MENU_MOVIES_PLUGINS))
class BackgroundDbLoader(Thread):
	def __init__ (self, session):
		Thread.__init__(self)
		printl("init->", self, "S")
		self.session = session
		#self.mm = self.session.open(MessageBox, (_("\nLoading data.... \n\nPlease wait... ")), MessageBox.TYPE_INFO)
		#self.mm = self.session.open(Msg)		

	def run(self):
		printl("run->")
		from Plugins.Extensions.ProjectValerie.DMC_Plugins.DMC_SyncExtras.Manager import Manager
		m = Manager("BackgroundDbLoader", self.session)
		#self.mm.close(False, self.session)

def autostart(session):
	printl("autostart->")
	try:
		thread = BackgroundDbLoader(session)
		thread.start()
	except Exception, ex:
		printl("Exception(Can be ignored): " + str(ex), __name__, "W")

def settings():
	s = []
	s.append((_("Autoload Database on start"), config.plugins.pvmc.plugins.backgrounddbloader.autoload, ))
	return s

if gAvailable is True:
	registerPlugin(Plugin(id="backgrounddbloader", name=_("BackgroundDbLoader"), fnc=settings, where=Plugin.SETTINGS))
	registerPlugin(Plugin(id="backgrounddbloader", name=_("BackgroundDbLoader"), fnc=autostart, where=Plugin.AUTOSTART))
Example #18
0
#------------------------------------------------------------------------------------------

config.plugins.pvmc.plugins.sync = ConfigSubsection()
config.plugins.pvmc.plugins.sync.fastsynconautostart = ConfigYesNo(default=False)

def settings():
	s = []
	s.append((_("Fast Sync on autostart"), config.plugins.pvmc.plugins.sync.fastsynconautostart, ))
	return s

def autostartPlugin(session):
	if isInetAvailable():
		from Plugins.Extensions.ProjectValerie.DMC_Plugins.DMC_SyncExtras.plugin import autostart
		autostart(session)
	else:
		printl("Can not sync as no internet connection available!", __name__, "W")

def startPlugin(session):
	if isInetAvailable():
		from Plugins.Extensions.ProjectValerie.DMC_Plugins.DMC_SyncExtras.plugin import ProjectValerieSync
		session.open(ProjectValerieSync)
	else:
		from Screens.MessageBox import MessageBox
		session.open(MessageBox,_("No internet connection available!"), MessageBox.TYPE_INFO, timeout=10)

registerPlugin(Plugin(id="sync", name=_("Synchronize"), fnc=settings, where=Plugin.SETTINGS))
registerPlugin(Plugin(id="sync", name=_("Synchronize"), fnc=startPlugin, where=Plugin.MENU_SYSTEM, supportStillPicture=True, weight=10))
if config.plugins.pvmc.plugins.sync.fastsynconautostart.value is True:
	registerPlugin(Plugin(id="sync", name=_("Synchronize"), fnc=autostartPlugin, where=Plugin.AUTOSTART))
Example #19
0
    if d.has_key("progress"):
        progress = d["progress"]
    if d.has_key("status"):
        status = d["status"]
    if d.has_key("id"):
        id = d["id"]

    if status == "stopped":
        if progress >= 70:
            setSeen(id, True)


if gAvailable is True:
    registerPlugin(
        Plugin(id="seen",
               name=_("Seen"),
               fnc=autostart,
               where=Plugin.AUTOSTART))
    registerPlugin(
        Plugin(id="seen",
               name=_("Seen"),
               fnc=info_playback,
               where=Plugin.INFO_PLAYBACK))
    #registerPlugin(Plugin(name=_("Seen"), fnc=is_Seen, where=Plugin.INFO_SEEN))
    registerPlugin(
        Plugin(id="seen",
               name=_("Mark as Seen"),
               fnc=markSeen,
               where=Plugin.MENU_MOVIES_PLUGINS))
    registerPlugin(
        Plugin(id="unseen",
Example #20
0
        reactor.listenTCP(port, site, interface="0.0.0.0")
    except Exception, ex:
        printl("Exception(Can be ignored): " + str(ex), __name__, "W")


def settings():
    s = []
    s.append((
        _("Port"),
        config.plugins.pvmc.plugins.webinterface.port,
    ))
    #s.append((_("Use Pagination"), config.plugins.pvmc.plugins.webinterface.usepagination, ))
    s.append((
        _("Entry"),
        config.plugins.pvmc.plugins.webinterface.entrycount,
    ))
    return s


if gAvailable is True:
    registerPlugin(
        Plugin(id="webif",
               name=_("WebInterface"),
               fnc=settings,
               where=Plugin.SETTINGS))
    registerPlugin(
        Plugin(id="webif",
               name=_("WebInterface"),
               fnc=autostart,
               where=Plugin.AUTOSTART_E2))
		#Folder Lists
		root.putChild("vlog", File(config.plugins.pvmc.tmpfolderpath.value + 'log', defaultType="text/plain"))
		root.putChild("elog", File('/hdd/', defaultType="text/plain"))
		root.putChild("media", File(config.plugins.pvmc.configfolderpath.value + '/media', defaultType="text/plain"))
		root.putChild("dumps", File(config.plugins.pvmc.tmpfolderpath.value + 'dumps', defaultType="text/plain"))
		
		#Action pages without MainMenu-Entry => WebSubActions
		root.putChild("action", WebSubActions.MediaActions())
		root.putChild("mediaForm", WebSubActions.MediaForm())
		root.putChild("addRecord", WebSubActions.AddRecord())
		root.putChild("alternatives", WebSubActions.Alternatives())	
		root.putChild("function", WebSubActions.WebFunctions())
		root.putChild("syncronize", WebSubActions.SyncFunctions())		
		
		site = Site(root)
		port = config.plugins.pvmc.plugins.webinterface.port.value
		reactor.listenTCP(port, site, interface="0.0.0.0")
	except Exception, ex:
		printl("Exception(Can be ignored): " + str(ex), __name__, "W")

def settings():
	s = []
	s.append((_("Port"), config.plugins.pvmc.plugins.webinterface.port, ))
	#s.append((_("Use Pagination"), config.plugins.pvmc.plugins.webinterface.usepagination, ))
	s.append((_("Entry"), config.plugins.pvmc.plugins.webinterface.entrycount, ))
	return s

if gAvailable is True:
	registerPlugin(Plugin(id="webif", name=_("WebInterface"), fnc=settings, where=Plugin.SETTINGS))
	registerPlugin(Plugin(id="webif", name=_("WebInterface"), fnc=autostart, where=Plugin.AUTOSTART_E2))
# -*- coding: utf-8 -*-
from Components.config import *
from Components.config import ConfigSubsection
from Components.config import ConfigYesNo
from Plugins.Extensions.ProjectValerie.__common__ import printl2 as printl
from Plugins.Extensions.ProjectValerie.__plugin__ import Plugin, registerPlugin

config.plugins.pvmc.plugins.filebrowser = ConfigSubsection()
config.plugins.pvmc.plugins.filebrowser.show = ConfigYesNo(default = True)

gAvailable = False
try:
	from Plugins.Extensions.Filebrowser.plugin import start_from_pluginmenu as StartFunction
	gAvailable = True
except:
	printl("Filebrowser not found", "I")
	gAvailable = False

def settings():
	s = []
	s.append((_("Show"), config.plugins.pvmc.plugins.filebrowser.show, ))
	return s

if gAvailable is True:
	p = []
	p.append(Plugin(id="filebrowser", name=_("Filebrowser"), fnc=settings, where=Plugin.SETTINGS))
	p.append(Plugin(id="filebrowser", name=_("Filebrowser"), fnc=StartFunction, where=Plugin.MENU_SYSTEM))
	registerPlugin(p)
			nextEpisode = 0
		else:	
			nextEpisode = entry["Episode"] + 1
		
		found = True
		while found is True:
			found = False
			for episode in library:
				episodeDict = episode[1]
				if episodeDict["Episode"] == nextEpisode:
					playbackList.append( (episodeDict["Path"], episodeDict["Title"], episodeDict, ))
					nextEpisode += 1
					found = True
					break
		
		return playbackList

	def buildInfoPlaybackArgs(self, entry):
		args = {}
		args["id"] 	= entry["Id"]
		args["title"]   = entry["Title"]
		args["year"]    = entry["Year"]
		args["thetvdb"] = entry["TheTvDbId"]
		args["season"]  = entry["Season"]
		args["episode"] = entry["Episode"]
		args["type"]    = "tvshow"
		return args

if gAvailable is True:
	registerPlugin(Plugin(id="tvshows", name=_("TV Shows"), start=DMC_TvShowLibrary, where=Plugin.MENU_VIDEOS, weight=4))