from Plugins.Plugin import PluginDescriptor
import PlayStream
from . import _

def main(session, **kwargs):
    try:
        reload(PlayStream)
        session.open(PlayStream.MainScreen)
    except Exception as e:
        print "Error loading PlayStream - "+ e.message

def menu(menuid, **kwargs):
    if menuid == "mainmenu":
        return [("Play Stream", main, "playstream", 57)]
    return []

def Plugins(**kwargs):
    return [
        PluginDescriptor(name = "Play Stream",description = _("Play online streams from various sources"),where = [PluginDescriptor.WHERE_PLUGINMENU,PluginDescriptor.WHERE_EXTENSIONSMENU], icon = "plugin.png", fnc = main),
        PluginDescriptor(name="TV Play", description=_("Play online streams from various sources"), where = [PluginDescriptor.WHERE_MENU], fnc=menu)
    ]
