Exemple #1
0
 def __init__(self, httpSession, userMgr, userId=None, screenName=None):
     StoppableThread.__init__(self)
     self.__session = httpSession
     self.__userMgr = userMgr
     self.__userId = userId
     self.__screenName = screenName
     self.__token = self.__session["token"]
Exemple #2
0
 def __init__(self, token, userMgr, callback, userId=None, screenName=None):
     StoppableThread.__init__(self)
     self.__userMgr = userMgr
     self.__userId = userId
     self.__screenName = screenName
     self.__token = token
     self.__callback = callback
Exemple #3
0
 def __init__(self, newsUrl, topic, lang, rssAnalyzer):
     StoppableThread.__init__(self, "Rss-" + topic + "-" + lang)
     self.__url = newsUrl
     self.__lang = lang
     self.__topic = topic
     self.__rssAnalyzer = rssAnalyzer
     self.__secondsSinceLastCheck = random.randint(0, INTERVAL)
Exemple #4
0
 def __init__(self, gui, stream, mainDir):
     StoppableThread.__init__(self, "Model")
     self.__iter = stream.__iter__()
     self.__elem = None
     self.__gui = gui
     self.__softPause = True
     self.__urlBuilder = UrlBuilder()
     self.__userBuilder = UserBuilder()
     streamDir = os.path.join(mainDir, "stream")
     userDir = os.path.join(mainDir, "user")
     self.__tweetResolvedListener = ResolvedTweetQueue(
         streamDir=streamDir, userDir=userDir, userBuilder=self.__userBuilder, urlBuilder=self.__urlBuilder
     )
     self.__urlResolver = UrlResolverManager(
         os.path.join(streamDir, "urlResolverCache.db2"), self.__tweetResolvedListener
     )
     self.__refreshGui = Event()
     self.__refreshStatusBar = Event()
     self.__showProbDist = Event()
     self.__probDistUrl = None
     Publisher.subscribe(self.onPauseJob, "model.pause")
     Publisher.subscribe(self.onResumeJob, "model.start")
     Publisher.subscribe(self.onRefreshGui, "model.refreshGui")
     Publisher.subscribe(self.onRefreshStatusBar, "model.refreshStatusBar")
     Publisher.subscribe(self.onProbDist, "model.prob_dist")
     Publisher.subscribe(self.onShowTreeMap, "model.showTreeMap")
     self.doPauseJob()
     self.start()
Exemple #5
0
 def __init__(self, filename):
     StoppableThread.__init__(self)
     self.__filename= filename
     self.__queue = Queue()
     self.__hits = 0
     self.__requests = 0
     self.__onLoadSize = None
     self.__size = 0
     self.__msgCount = 0
Exemple #6
0
 def __init__(self, streamDir, userDir, userBuilder, urlBuilder):
     StoppableThread.__init__(self, self.__class__.__name__)
     self.__queue = PriorityQueue(maxsize=50)
     self.__urlBuilder = urlBuilder
     self.__userBuilder = userBuilder
     self.__dir = os.path.join(streamDir, "tweets")
     self.__model = SqlModel(os.path.join(streamDir, "finalUrl.db"), drop=False)
     self.__userMgr = UserMgr(userDir)
     self.__server = EmbeddedHttpServer(self, self.__userMgr)
     self.__crawlers = []
Exemple #7
0
 def __init__(self, model, userMgr):
     StoppableThread.__init__(self)
     self.__sessions = {}
     self.__userMgr = userMgr
     self.__workers = []
     self.__sessionLock = Semaphore()
     self.__PORT = 8888
     SocketServer.TCPServer.__init__(self, ("", self.__PORT), PynewsHandler)
     self.__model = model
     dir = os.path.expanduser("~/.pynews")
     if not os.path.exists(dir):
         os.mkdir(dir)
     file = os.path.join(dir, "settings.web.db")
     self.__settingsStore = shelve.open(file, protocol=-1)
Exemple #8
0
 def __init__(self, id, pageDownloader, queue, callback):
     StoppableThread.__init__(self, "URLDownloader" + str(id))
     self.__pageDownloader = pageDownloader
     self.__queue = queue
     self.__callback = callback
Exemple #9
0
 def __init__(self, mgr, queue, cache, id):
     StoppableThread.__init__(self, self.__class__.__name__ + str(id))
     self.__queue = queue
     self.__mgr = mgr
     self.__cache = cache