Kodi plugin to to play various online streams (mostly Latvian)

service.py 1.1KB

12345678910111213141516171819202122232425262728293031
  1. # -*- coding: utf-8 -*-
  2. import os,os.path,sys, urllib, traceback
  3. from kodiswift import Plugin, ListItem, storage
  4. from kodiswift import xbmc, xbmcgui, xbmcplugin, xbmcvfs, CLI_MODE
  5. #from resources.lib import ContentSources, util
  6. #sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)),"resources","lib","sources"))
  7. from resources.lib.content import playstreamproxy
  8. try:
  9. import wingdbstub
  10. except:
  11. pass
  12. #monitor = xbmc.Monitor()
  13. plugin = Plugin()
  14. plugin.load_addon_settings()
  15. autostart = plugin.get_setting("general_autostart", bool)
  16. if autostart:
  17. xbmc.executebuiltin("RunAddon(plugin.video.playstream)")
  18. # view_mode = plugin.get_setting("view_mode", str)
  19. port = plugin.get_setting("general_port",int)
  20. start_proxy = plugin.get_setting("general_proxy",bool)
  21. host = "localhost"
  22. if start_proxy:
  23. plugin.notify("Starting playstreamproxy","Info",10000, xbmcgui.NOTIFICATION_INFO)
  24. try:
  25. playstreamproxy.start(host, port)
  26. except Exception as e:
  27. xbmcgui.Dialog().ok("Error starting playstreamproxyserver",unicode(e))
  28. #plugin.notify(unicode(e), "Error", 10000, xbmcgui.NOTIFICATION_ERROR)
  29. traceback.print_exc()