Enigma2 plugin to to play various online streams (mostly Latvian).

plugin.py 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env python
  2. # coding=utf8
  3. # This file is part of PlayStream - enigma2 plugin to play video streams from various sources
  4. # Copyright (c) 2016 ivars777 (ivars777@gmail.com)
  5. import os, traceback
  6. from Plugins.Plugin import PluginDescriptor
  7. from Components.Language import language
  8. import PlayStream as plugin
  9. from plugin_locale import _, locale_init
  10. # lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
  11. # os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
  12. locale_init(plugin.__title__,"locale")
  13. language.addCallback(locale_init)
  14. def main(session, **kwargs):
  15. try:
  16. reload(plugin)
  17. session.open(plugin.MainScreen)
  18. except Exception as e:
  19. print "Error loading PlayStream - "+ e.message
  20. traceback.print_exc()
  21. def menu(menuid, **kwargs):
  22. if menuid == "mainmenu":
  23. return [(plugin.__title__, main, plugin.__id__, 57)]
  24. return []
  25. def Plugins(**kwargs):
  26. return [
  27. PluginDescriptor(name = plugin.__title__, description = plugin.__desc__, where = [PluginDescriptor.WHERE_PLUGINMENU,PluginDescriptor.WHERE_EXTENSIONSMENU], icon = "plugin.png", fnc = main),
  28. PluginDescriptor(name=plugin.__title__, description = plugin.__desc__, where = [PluginDescriptor.WHERE_MENU], fnc=menu)
  29. ]