# -*- coding: utf-8 -*- try: import wingdbstub except: pass import os,os.path,sys, datetime, traceback from kodiswift import Plugin, ListItem, storage from kodiswift import xbmc, xbmcgui, xbmcplugin, xbmcvfs, CLI_MODE sys.path.append(os.path.join(os.path.dirname(__file__), "resources", "lib")) #from resources.lib import ContentSources, util #sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)),"resources","lib","sources")) from twisted.web import client from twisted.internet import reactor, defer, ssl, task import content.Downloader as Downloader import sys,os, os.path, re import urlparse, requests print "twisted imported" #str(time.time()) plugin = Plugin() plugin.load_addon_settings() download_dir = plugin.get_setting("general_download_dir",str) queue_dir = os.path.join(plugin.storage_path,"downloads)") if not os.path.exists(queue_dir): os.mkdir(queue_dir) class DownloadQueue(object): def __init__(self): self.flist=[] self.q=[] def check_queue(self): print "check_queue" flist = os.listdir(queue_dir) print "Checking queue" def start_download(self): pass def download_ok(self): pass def download_err(self): pass def notify(text, title="Info", time=10000): if isinstance(text, unicode): text = text.encode("utf8") #xbmc.executebuiltin('Notification(Hello World,This is a simple example of notifications,5000,/script.hellow.world.png)') xbmc.executebuiltin('Notification(%s, %s, %d, %s)'%("Info", text, time, xbmcgui.NOTIFICATION_INFO)) queue = DownloadQueue() loop = task.LoopingCall(queue.check_queue) loop.start(2) reactor.run()