1234567891011121314151617181920212223242526272829303132333435363738 |
- # -*- coding: utf-8 -*-
- try:
- import wingdbstub
- except:
- pass
- import os,os.path,sys, urllib, traceback
- from kodiswift import Plugin, ListItem, storage
- from kodiswift import xbmc, xbmcgui, xbmcplugin, xbmcvfs, CLI_MODE
- #from resources.lib import ContentSources, util
- #sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)),"resources","lib","sources"))
- from resources.lib.content import playstreamproxy
- from downloadqueue import DownloadQueue
-
- #monitor = xbmc.Monitor()
-
- plugin = Plugin()
- plugin.load_addon_settings()
- autostart = plugin.get_setting("general_autostart", bool)
-
- queue_dir = os.path.join(xbmc.translatePath("special://temp"), "download_queue") if not CLI_MODE else "download_queue"
- download_queue = DownloadQueue(queue_dir)
- download_queue.clear() # TODO restarte nepabeigtos uzdevumus varbut?
-
- if autostart:
- xbmc.executebuiltin("RunAddon(plugin.video.playstream)")
- # view_mode = plugin.get_setting("view_mode", str)
-
- port = plugin.get_setting("general_port",int)
- start_proxy = plugin.get_setting("general_proxy",bool)
- host = "localhost"
- if start_proxy:
- plugin.notify("Starting playstreamproxy","Info",10000, xbmcgui.NOTIFICATION_INFO)
- try:
- playstreamproxy.start(host, port)
- except Exception as e:
- xbmcgui.Dialog().ok("Error starting playstreamproxyserver",unicode(e))
- #plugin.notify(unicode(e), "Error", 10000, xbmcgui.NOTIFICATION_ERROR)
- traceback.print_exc()
|