rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.addText('<%s'%name) for key in attrs.keys(): if (not key.startswith('i18n:')): self.addAttr(key,attrs[key]) self.addText('>') | self.addElementStart(name, attrs) | def startElement(self,name, attrs): self.depth = self.depth + 1 |
self.addText('<%s'%name) for key in attrs.keys(): if key != 't:replace': self.addAttr(key,attrs[key]) self.addText('>') | self.addElementStart(name, attrs) | def startElement(self,name, attrs): self.depth = self.depth + 1 |
self.addText('<%s'%name) for key in attrs.keys(): if key != 't:replaceMarkup': self.addAttr(key,attrs[key]) self.addText('>') | self.addElementStart(name, attrs) | def startElement(self,name, attrs): self.depth = self.depth + 1 |
self.addText('<%s'%name) for key in attrs.keys(): if (not (key.startswith('t:') or key.startswith('i18n:')) or key == 't:contextMenu'): self.addAttr(key,attrs[key]) self.addText('>') | self.addElementStart(name, attrs) | def startElement(self,name, attrs): self.depth = self.depth + 1 |
def addTextHide(self,ifValue,text): self.addInstruction(genRepeatTextHide,(ifValue,text)) | def addElementStart(self, name, attrs, addId=False): self.addText('<%s'%name) for key in attrs.keys(): if (not (key.startswith('t:') or key.startswith('i18n:')) or key == 't:contextMenu'): self.addAttr(key,attrs[key]) if addId: self.addIdAndClose() else: self.addText('>') | def addTextHide(self,ifValue,text): self.addInstruction(genRepeatTextHide,(ifValue,text)) |
guide = getSingletonDDBObject(views.guide) (mode, location) = guide.getLocation() if mode == 'template': self.switchTemplate(location, baseURL=config.get(prefs.CHANNEL_GUIDE_URL)) elif mode == 'url': controller.frame.selectURL(location, \ controller.frame.mainDisplay) else: raise StandardError("DTV: Invalid guide lo... | if controller.frame.getDisplay(controller.frame.mainDisplay) is self.display: guide = getSingletonDDBObject(views.guide) (mode, location) = guide.getLocation() if mode == 'template': self.switchTemplate(location, baseURL=config.get(prefs.CHANNEL_GUIDE_URL)) elif mode == 'url': controller.frame.selectURL(location, \ ... | def goToGuide(self): guide = getSingletonDDBObject(views.guide) # Does the Guide want to implement itself as a redirection to # a URL? (mode, location) = guide.getLocation() |
anItem = self.skipIfItemFileIsMissing(anItem) | while not os.path.exists(anItem.getPath()): print "DTV: movie file '%s' is missing, skipping to next" % \ anItem.getPath() anItem = self.currentPlaylist.getNext() if anItem is None: self.stop() return | def playItem(self, anItem): try: anItem = self.skipIfItemFileIsMissing(anItem) if anItem is not None: videoDisplay = controller.videoDisplay videoRenderer = videoDisplay.getRendererForItem(anItem) if videoRenderer is not None: self.playItemInternally(anItem, videoDisplay, videoRenderer) else: frame = controller.frame i... |
def skipIfItemFileIsMissing(self, anItem): path = anItem.getPath() if not os.path.exists(path): print "DTV: movie file '%s' is missing, skipping to next" % path return self.skip(1) else: return anItem | def skip(self, direction): nextItem = None if self.currentPlaylist is not None: if direction == 1: nextItem = self.currentPlaylist.getNext() else: frame = controller.frame currentDisplay = frame.getDisplay(frame.mainDisplay) if not hasattr(currentDisplay, 'getCurrentTime') or currentDisplay.getCurrentTime() <= 2.0: nex... | |
self.lastSelected = id | self.currentView.addRemoveCallback(self.onRemove) def onRemove(self, obj, id): if id in self.currentSelection: self._doUnselect(id) | def selectItem(self, view, id, shiftSelect, controlSelect): if (controlSelect or shiftSelect) and view != self.currentView: return if not controlSelect: self.clearSelection() |
if notification.name() == QTMovieDidEndNotification and not self.progressDisplayer.dragging: | if notification.name() == QTMovieDidEndNotification and not self.renderer.interactivelySeeking: | def handleMovieNotification_(self, notification): if notification.name() == QTMovieDidEndNotification and not self.progressDisplayer.dragging: app.Controller.instance.playbackController.onMovieFinished() |
menuItems = [] | def webView_contextMenuItemsForElement_defaultMenuItems_(self,webView,contextMenu,defaultMenuItems): if self.initialLoadFinished: menuItems = [] | |
for menuEntry in x.split("\n"): menuEntry = menuEntry.strip() if len(menuEntry) == 0: menuItems.append(NSMenuItem.separatorItem()) else: (url, name) = menuEntry.split('|',1) menuItem = NSMenuItem.alloc() menuItem.initWithTitle_action_keyEquivalent_(name,self.processContextClick_,"") menuItem.setEnabled_(YES) menuItem.s... | if len(x) > 0: for menuEntry in x.split("\n"): menuEntry = menuEntry.strip() if len(menuEntry) == 0: menuItems.append(NSMenuItem.separatorItem()) else: (url, name) = menuEntry.split('|',1) menuItem = NSMenuItem.alloc() menuItem.initWithTitle_action_keyEquivalent_(name,self.processContextClick_,"") menuItem.setEnable... | def webView_contextMenuItemsForElement_defaultMenuItems_(self,webView,contextMenu,defaultMenuItems): if self.initialLoadFinished: menuItems = [] |
event = NSApplication.sharedApplication().currentEvent() NSMenu.popUpContextMenu_withEvent_forView_(nsmenu, event, event.window().contentView()) | window = NSApplication.sharedApplication().mainWindow() view = window.contentView() event = NSEvent.mouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure_( NSRightMouseDown, window.mouseLocationOutsideOfEventStream(), 0, 1, window.windowNumber(), NSGraphicsContext.curr... | def showContextMenu(self, items): nsmenu = NSMenu.alloc().init() nsmenu.setAutoenablesItems_(NO) for item in items: if item.label == '': nsitem = NSMenuItem.separatorItem() else: nsitem = NSMenuItem.alloc() nsitem.initWithTitle_action_keyEquivalent_(item.label, 'processContextItem:', '') nsitem.setEnabled_(item.callbac... |
shutil.copyfile(pathname, pathname + '.bak') | retval = True | def saveDatabase(db=None, pathname=None, scheduleAnother=False): """Save a database object.""" print "Saving database" if db is None: db = database.defaultDatabase if pathname is None: pathname = config.get(config.DB_PATHNAME) pathname = os.path.expanduser(pathname) tempPathname = pathname + '.temp' try: db.beginRea... |
eventloop.addTimeout(300, saveDatabase, args=(db, pathname, scheduleAnother)) | eventloop.addTimeout(300, saveDatabase, "Database Save", args=(db, pathname, scheduleAnother)) return retval | def saveDatabase(db=None, pathname=None, scheduleAnother=False): """Save a database object.""" print "Saving database" if db is None: db = database.defaultDatabase if pathname is None: pathname = config.get(config.DB_PATHNAME) pathname = os.path.expanduser(pathname) tempPathname = pathname + '.temp' try: db.beginRea... |
def remove(self): self.cancelUpdateEvents() self.ufeed.beginRead() try: items = [] for item in self.items: if not item.getKeep(): item.expire() item.remove() finally: self.ufeed.endRead() self.ufeed.remove() | def getNewItems(self): self.ufeed.beginRead() count = 0 for item in self.items: try: if item.getState() == 'finished' and not item.getSeen(): count += 1 except: pass self.ufeed.endRead() return count | |
def get_time(self): t = time() + self.offset if t < self.time or t > self.time + _MAXFORWARD: self.time += _FUDGE self.offset += self.time - t return self.time self.time = t | def get_time(self): self.lock.acquire() try: t = time() + self.offset if t < self.time or t > self.time + _MAXFORWARD: self.time += _FUDGE self.offset += self.time - t return self.time self.time = t finally: self.lock.release() | def get_time(self): t = time() + self.offset if t < self.time or t > self.time + _MAXFORWARD: self.time += _FUDGE self.offset += self.time - t return self.time self.time = t return t |
print 'DTV: running Quicktime Components Installer.' | print 'DTV: running QuickTime Components Installer.' | def run(): willRestart = False if _shouldRun(): print 'DTV: running Quicktime Components Installer.' _didRun() installList = list() upgradeList = list() installableComponents = _gatherInstallableComponents() for installable in installableComponents: installed = _checkInstalledComponent(installable) if installed is No... |
dlogTitle = 'Quicktime Components Installation' | dlogTitle = 'QuickTime Components Installation' | def _performInstallation(installList, upgradeList): installCount = len(installList) upgradeCount = len(upgradeList) if installCount > 0 or upgradeCount > 0: message = _buildMessage(installCount, upgradeCount) else: print ' nothing to install or upgrade.' return False dlogTitle = 'Quicktime Components Installation'... |
script = 'echo -- Quicktime Components Installation/Upgrade -- \n' | script = 'echo -- QuickTime Components Installation/Upgrade -- \n' | def _performInstallation(installList, upgradeList): installCount = len(installList) upgradeCount = len(upgradeList) if installCount > 0 or upgradeCount > 0: message = _buildMessage(installCount, upgradeCount) else: print ' nothing to install or upgrade.' return False dlogTitle = 'Quicktime Components Installation'... |
message += 'install %d Quicktime component%s.' % (installCount, installPlural) | message += 'install %d QuickTime component%s.' % (installCount, installPlural) | def _buildMessage(installCount, upgradeCount): installPlural = '' if installCount > 1: installPlural = 's' upgradePlural = '' if upgradePlural > 1: upgradePlural = 's' message = 'Democracy can now ' if installCount > 0 and upgradeCount == 0: message += 'install %d Quicktime component%s.' % (installCount, installPlural... |
message += 'upgrade %d outdated Quicktime component%s ' % (upgradeCount, upgradePlural) | message += 'upgrade %d outdated QuickTime component%s ' % (upgradeCount, upgradePlural) | def _buildMessage(installCount, upgradeCount): installPlural = '' if installCount > 1: installPlural = 's' upgradePlural = '' if upgradePlural > 1: upgradePlural = 's' message = 'Democracy can now ' if installCount > 0 and upgradeCount == 0: message += 'install %d Quicktime component%s.' % (installCount, installPlural... |
message += 'install %d Quicktime component%s ' % (installCount, installPlural) | message += 'install %d QuickTime component%s ' % (installCount, installPlural) | def _buildMessage(installCount, upgradeCount): installPlural = '' if installCount > 1: installPlural = 's' upgradePlural = '' if upgradePlural > 1: upgradePlural = 's' message = 'Democracy can now ' if installCount > 0 and upgradeCount == 0: message += 'install %d Quicktime component%s.' % (installCount, installPlural... |
self.unregisterMovieObserver() | def registerMovieObserver(self, movie): self.unregisterMovieObserver() nc.addObserver_selector_name_object_(self.delegate, 'handleMovieNotification:', QTMovieDidEndNotification, movie) | |
def unregisterMovieObserver(self): nc.removeObserver_name_object_(self.delegate, QTMovieDidEndNotification, nil) | def unregisterMovieObserver(self, movie): nc.removeObserver_name_object_(self.delegate, QTMovieDidEndNotification, movie) | def unregisterMovieObserver(self): nc.removeObserver_name_object_(self.delegate, QTMovieDidEndNotification, nil) |
self.unregisterMovieObserver() | self.cachedMovie = nil | def reset(self): self.view.setMovie_(nil) self.unregisterMovieObserver() |
self.cachedMovie = nil | self.reset() | def selectItem(self, item): pathname = item.getPath() if self.cachedMovie is not nil and self.cachedMovie.attributeForKey_(QTMovieFileNameAttribute) == pathname: qtmovie = self.cachedMovie else: (qtmovie, error) = QTMovie.alloc().initWithFile_error_(pathname) self.cachedMovie = nil if qtmovie is not nil: self.view.setM... |
return self.isDownloaded() or (self.getFeedURL() == 'dtv:manualFeed' and self.getState() != 'downloading') | return self.getState() in ('newly-downloaded', 'expiring') | def showSaveButton(self): return self.isDownloaded() or (self.getFeedURL() == 'dtv:manualFeed' and self.getState() != 'downloading') |
return None | return '' | def getURL(self): self.confirmDBThread() videoEnclosure = self.getFirstVideoEnclosure() if videoEnclosure is not None and 'url' in videoEnclosure: return videoEnclosure['url'] else: return None |
self.expired = False self.keep = False | self.expired = self.keep = self.seen = False | def actualDownload(self,autodl=False): self.confirmDBThread() manualDownloadCount = views.manualDownloads.len() |
return 'expired' | return 'expiring' | def getState(self): """Get the state of this item. The state will be on of the following: |
raise dbus.NameExistsException(name) | raise NameExistsException(name) | def __new__(cls, name, bus=None, flags=0): # get default bus if bus == None: bus = dbus.Bus() |
if (entry.has_key('enclosures') and len(entry['enclosures'])>0 and entry.has_key('description') and not entry['enclosures'][0].has_key('thumbnail')): desc = RSSFeedImpl.firstImageRE.search(unescape(entry['description'])) if not desc is None: entry['enclosures'][0]['thumbnail'] = FeedParserDict({'url': desc.expand("\\1"... | if entry.has_key('thumbnail'): return entry if entry.has_key('enclosures'): for enc in entry['enclosures']: if enc.has_key('thumbnail'): return entry if not entry.has_key('description'): return entry desc = RSSFeedImpl.firstImageRE.search(unescape(entry['description'])) if not desc is None: entry['thumbnail'] = FeedPa... | def addScrapedThumbnail(self,entry): if (entry.has_key('enclosures') and len(entry['enclosures'])>0 and entry.has_key('description') and not entry['enclosures'][0].has_key('thumbnail')): desc = RSSFeedImpl.firstImageRE.search(unescape(entry['description'])) if not desc is None: entry['enclosures'][0]['thumbnail'] = Fee... |
for url in urls: f = feed.getFeedByURL(url) if f is lastFeed: app.controller.selection.selectTabByObject(f) else: f.blink() | if lastFeed: for url in urls: f = feed.getFeedByURL(url) if f is lastFeed: app.controller.selection.selectTabByObject(f) else: f.blink() else: for i in xrange (len(urls) - 1): feed.getFeedByURL(urls[i]).blink() f = feed.getFeedByURL(urls[-1]) app.controller.selection.selectTabByObject(f) | def addFeeds(urls, newFolderName=None): if len(urls) > 0: if newFolderName is not None: newFolder = folder.ChannelFolder(newFolderName) for url in filterExistingFeedURLs(urls): f = feed.Feed(url) if newFolderName is not None: f.setFolder(newFolder) lastFeed = f if newFolderName is None: for url in urls: f = feed.getFee... |
backEndDelegate = self.appl.getBackendDelegate() eventloop.addUrgentCall(lambda:app.ModelActionHandler(backEndDelegate).removeFeed(feedID), "Remove channel") | eventloop.addUrgentCall(lambda:app.ModelActionHandler(app.delegate).removeFeed(feedID), "Remove channel") | def removeChannel_(self, sender): feedID = app.controller.currentSelectedTab.feedID() if feedID is not None: backEndDelegate = self.appl.getBackendDelegate() eventloop.addUrgentCall(lambda:app.ModelActionHandler(backEndDelegate).removeFeed(feedID), "Remove channel") |
backEndDelegate = self.appl.getBackendDelegate() eventloop.addUrgentCall(lambda:app.ModelActionHandler(backEndDelegate).updateFeed(feedID), "Update channel") | eventloop.addUrgentCall(lambda:app.ModelActionHandler(app.delegate).updateFeed(feedID), "Update channel") | def updateChannel_(self, sender): feedID = app.controller.currentSelectedTab.feedID() if feedID is not None: backEndDelegate = self.appl.getBackendDelegate() eventloop.addUrgentCall(lambda:app.ModelActionHandler(backEndDelegate).updateFeed(feedID), "Update channel") |
backEndDelegate = self.appl.getBackendDelegate() eventloop.addUrgentCall(lambda:app.ModelActionHandler(backEndDelegate).updateAllFeeds(), "Update all channels") | eventloop.addUrgentCall(lambda:app.ModelActionHandler(app.delegate).updateAllFeeds(), "Update all channels") | def updateAllChannels_(self, sender): backEndDelegate = self.appl.getBackendDelegate() eventloop.addUrgentCall(lambda:app.ModelActionHandler(backEndDelegate).updateAllFeeds(), "Update all channels") |
app.controller.playbackController.onMovieFinished() | eventloop.addUrgentCall(lambda:app.controller.playbackController.onMovieFinished(), "Movie Finished Callback") | def handleMovieNotification_(self, notification): renderer = self.videoDisplay.activeRenderer if notification.name() == QTMovieDidEndNotification and not renderer.interactivelySeeking: app.controller.playbackController.onMovieFinished() |
def onSelectedTabChange(self, tabType, multiple, guideURL): | def onSelectedTabChange(self, tabType, multiple, guideURL, videoFilename): | def onSelectedTabChange(self, tabType, multiple, guideURL): pass |
addKey = key self.repeatList.append(lambda x, y:' ') self.repeatList.append(lambda x, y:addKey) self.repeatList.append(lambda x, y:'=') self.repeatList.append(lambda x, y:self.quoteAndFillAttr(attrs[addKey],x)) | self.repeatList.append(self.makeReplaceFunc(key,attrs[key])) | def startElement(self,name, attrs): self.depth += 1 if self.inReplace: pass elif 't:hideIfViewEmpty' in attrs.keys() or 't:hideIfViewNotEmpty' in attrs.keys(): nodeId = generateId() if 't:hideIfViewEmpty' in attrs.keys(): viewName = attrs['t:hideIfViewEmpty'] ifInvert = False else: viewName = attrs['t:hideIfViewNotEmpt... |
print "DC: ", self.name | def dispatch(self): if not self.canceled: when = "While handling %s" % self.name start = clock() util.trapCall(when, self.function, *self.args, **self.kwargs) end = clock() if end-start > 0.5: print "WARNING: %s too slow (%.3f secs)" % ( self.name, end-start) print "DC: ", self.name try: total = cumulative[self.name] e... | |
break except socket.error, EOFError: self.cleanupAfterError() print "Socket exception in the controller daemon" traceback.print_exc() | def controllerLoop(self): try: while True: self.connectToDownloader() try: self.listenLoop() print "Controller listen loop completed" break except socket.error, EOFError: # On socket errors, the downloader dies, but the # controller stays alive and restarts the downloader self.cleanupAfterError() print "Socket exceptio... | |
redirURL = urljoin(redirURL,info['location']) | if info.has_key('location'): redirURL = urljoin(redirURL,info['location']) | def grabURL(url, type="GET",start = 0, etag=None,modified=None): maxDepth = 10 maxAuthAttempts = 5 redirURL = url myHeaders = {"User-Agent":"DTV/pre-release (http://participatoryculture.org/)"} (scheme, host, path, params, query, fragment) = urlparse(url) #print "grab URL called for "+host auth = findHTTPAuth(host,pa... |
config.set(config.NO_FULLSCREEN_ALERT, TRUE) | config.set(config.NO_FULLSCREEN_ALERT, True) | def dismiss_(self, sender): if self.dontShowCheckbox.state() == NSOnState: config.set(config.NO_FULLSCREEN_ALERT, TRUE) NSApplication.sharedApplication().stopModal() self.window().orderOut_(nil) |
(uri, tag) = name | uri = name[0] tag = name[1] | def startElementNS(self, name, qname, attrs): (uri, tag) = name if self.firstTag: self.firstTag = False if tag != 'rss': raise xml.sax.SAXNotRecognizedException, "Not an RSS file" if tag.lower() == 'enclosure' or tag.lower() == 'content': self.enclosureCount += 1 elif tag.lower() == 'link': self.inLink = True self.theL... |
(uri, tag) = name | uri = name[0] tag = name[1] | def endElementNS(self, name, qname): (uri, tag) = name if tag.lower() == 'description': lg = HTMLLinkGrabber() try: html = xhtmlify(unescape(self.descHTML),addTopTags=True) if not self.charset is None: html = fixHTMLHeader(html,self.charset) self.links[:0] = lg.getLinks(html,self.baseurl) except HTMLParseError: # Don't... |
return | def displayCurrentTabContent(self): frame = app.controller.frame mainDisplay = frame.getDisplay(frame.mainDisplay) | |
print "Ignored bad action URL: %s" % url | print "Ignored bad action URL: action=%s" % action | def dispatchAction(self, action, **kwargs): for handler in self.actionHandlers: if hasattr(handler, action): getattr(handler, action)(**kwargs) return print "Ignored bad action URL: %s" % url |
def startReadTimeout(self, delay): | def startReadTimeout(self): | def startReadTimeout(self, delay): if self.readTimeout is not None: self.stopReadTimeout() self.readTimeout = eventloop.addTimeout(delay, self.onReadTimeout, "AsyncSocket.onReadTimeout") |
self.readTimeout = eventloop.addTimeout(delay, self.onReadTimeout, | self.readTimeout = eventloop.addTimeout(30, self.onReadTimeout, | def startReadTimeout(self, delay): if self.readTimeout is not None: self.stopReadTimeout() self.readTimeout = eventloop.addTimeout(delay, self.onReadTimeout, "AsyncSocket.onReadTimeout") |
self.startReadTimeout(30) | self.startReadTimeout() | def startReading(self, readCallback): """Start reading from the socket. When data becomes available it will be passed to readCallback. If there is already a read callback, it will be replaced. """ |
origCallback = self.callback | def finishRequest(self): # figure out what the response was before we do things like start a # pipelined response. if self.bodyDataCallback: body = None elif self.chunked: body = ''.join(self.chunks) else: body = self.body response = self.makeResponse(body) if self.stream.isOpen(): if self.willClose: self.closeConnecti... | |
trapCall(self, self.callback, response) | trapCall(self, origCallback, response) | def finishRequest(self): # figure out what the response was before we do things like start a # pipelined response. if self.bodyDataCallback: body = None elif self.chunked: body = ''.join(self.chunks) else: body = self.body response = self.makeResponse(body) if self.stream.isOpen(): if self.willClose: self.closeConnecti... |
print "CANCELED!" | def onRequestStart(self, connection): if self.cancelled: print "CANCELED!" connection.closeConnection() else: self.connection = connection | |
self.downloads = set() | def onRestore(self): #self.itemlist = defaultDatabase.filter(lambda x:isinstance(x,Item) and x.feed is self) #FIXME: the update dies if all of the items aren't restored, so we # wait a little while before we start the update self.downloads = set() self.updating = False self.scheduleUpdateEvents(0.1) | |
if self.dc: self.dc.cancel() self.dc = eventloop.addIdle (self.update, "Channel Guide Update") | if not self.dc: self.dc = eventloop.addIdle (self.update, "Channel Guide Update") | def startUpdates(self): if self.dc: self.dc.cancel() self.dc = eventloop.addIdle (self.update, "Channel Guide Update") |
if not self.cachedGuideBody: | if (not self.cachedGuideBody) or (not self.loadedThisSession): | def getHTML(self): # In the future, may want to use # self.loadedThisSession to tell if this is a fresh # copy of the channel guide, and/or block a bit to # give the initial load a chance to succeed or fail # (but this would require changing the frontend code # to expect the template code to block, and in general # see... |
print "DTV: No guide available! Sending apology instead." | def getHTML(self): # In the future, may want to use # self.loadedThisSession to tell if this is a fresh # copy of the channel guide, and/or block a bit to # give the initial load a chance to succeed or fail # (but this would require changing the frontend code # to expect the template code to block, and in general # see... | |
return guideNotAvailableBody else: if not self.loadedThisSession: print "DTV: *** WARNING *** loading a stale copy of the channel guide from cache" | return fillStaticTemplate("go-to-guide", platform="", eventCookie="") else: | def getHTML(self): # In the future, may want to use # self.loadedThisSession to tell if this is a fresh # copy of the channel guide, and/or block a bit to # give the initial load a chance to succeed or fail # (but this would require changing the frontend code # to expect the template code to block, and in general # see... |
print "DTV: Warning: Bad Header from %s:%s%s (%s)" % (self.host, self.port, self.path, line) | print "DTV: Warning: Bad Header from %s://%s:%s%s (%s)" % (self.scheme, self.host, self.port, self.path, line) | def parseHeader(self, line): header, value = line.split(":", 1) value = value.strip() header = header.lstrip().lower() if value == '': print "DTV: Warning: Bad Header from %s:%s%s (%s)" % (self.host, self.port, self.path, line) if header not in self.headers: self.headers[header] = value else: self.headers[header] += ('... |
def __init__(self, url, ufeed, title = None, visible = True): | def __init__(self, url, ufeed, title = None, visible = True, calcItems=True): | def __init__(self, url, ufeed, title = None, visible = True): self.available = 0 self.unwatched = 0 self.url = url self.ufeed = ufeed self.calc_item_list() if title == None: self.title = url else: self.title = title self.created = datetime.now() self.autoDownloadable = ufeed.initiallyAutoDownloadable self.startfrom = d... |
self.calc_item_list() | if calcItems: self.calc_item_list() | def __init__(self, url, ufeed, title = None, visible = True): self.available = 0 self.unwatched = 0 self.url = url self.ufeed = ufeed self.calc_item_list() if title == None: self.title = url else: self.title = title self.created = datetime.now() self.autoDownloadable = ufeed.initiallyAutoDownloadable self.startfrom = d... |
self.actualFeed = FeedImpl(url,self) | self.actualFeed = FeedImpl(url,self, calcItems=False) | def __init__(self,url, initiallyAutoDownloadable=True): self.origURL = url self.errorState = False self.initiallyAutoDownloadable = initiallyAutoDownloadable self.loading = True self.actualFeed = FeedImpl(url,self) self.download = None self.generateFeed(True) self.iconCache = IconCache(self, is_vital = True) self.infor... |
self.generateFeed(True) | def __init__(self,url, initiallyAutoDownloadable=True): self.origURL = url self.errorState = False self.initiallyAutoDownloadable = initiallyAutoDownloadable self.loading = True self.actualFeed = FeedImpl(url,self) self.download = None self.generateFeed(True) self.iconCache = IconCache(self, is_vital = True) self.infor... | |
self.setAutoDownloadable(False) | def __init__(self, ufeed): RSSFeedImpl.__init__(self, url='', ufeed=ufeed, title='dtv:search', visible=False) self.setUpdateFrequency(-1) self.setAutoDownloadable(False) self.searching = False self.lastEngine = 'yahoo' self.lastQuery = '' | |
eventloop.addUrgentCall(obj.signalChange, "tab signal change", kwargs={'needsSave': False}) | obj.signalChange(needsSave=False) | def onAddTab(self, obj, id): if id not in self.trackedTabs: self.trackedTabs.appendID(id, sendSignalChange=False) eventloop.addUrgentCall(obj.signalChange, "tab signal change", kwargs={'needsSave': False}) |
def __getstate(self): | def __getstate__(self): | def __getstate(self): assert(0) #This should never be serialized |
def copyVLCPluginFiles(self, baseDir): destDir = os.path.join(baseDir, 'plugins') | def copyVLCPluginFiles(self, baseDir, xulrunnerDir): destDir = os.path.join(xulrunnerDir, 'plugins') | def copyVLCPluginFiles(self, baseDir): destDir = os.path.join(baseDir, 'plugins') |
shutil.copy2(os.path.join(VLC_PLUGIN_DIR, f), destDir) | shutil.copy2(os.path.join(VLC_MOZ_PLUGIN_DIR, f), destDir) vlcPluginDest = os.path.join(baseDir, "vlc-plugins") if not os.access(vlcPluginDest, os.F_OK): os.mkdir(vlcPluginDest) vlcPlugins = os.listdir(VLC_PLUGINS_DIR) for f in vlcPlugins: if f[0] != '.': shutil.copy2(os.path.join(VLC_PLUGINS_DIR, f), vlcPluginDest) | def copyVLCPluginFiles(self, baseDir): destDir = os.path.join(baseDir, 'plugins') |
self.copyVLCPluginFiles(buildBase) | self.copyVLCPluginFiles(self.bdist_base, buildBase) | def buildXulrunnerInstallation(self): |
os.execle(xulrunnerBinary, xulrunnerBinary, applicationIni, "-jsconsole", newEnv) | os.execle(xulrunnerBinary, xulrunnerBinary, applicationIni, "-jsconsole", "-console", newEnv) | def run(self): # Build extensions and add results to child search path build = self.reinitialize_command('build') build.build_base = self.bdist_base build.run() if build.build_platlib is not None: self.childPythonPaths.append(build.build_platlib) if build.build_lib is not None: self.childPythonPaths.append(build.build_... |
self.copyVLCPluginFiles(self.xulrunnerOut) | self.copyVLCPluginFiles(self.dist_dir, self.xulrunnerOut) | def run(self): packagePaths = copy.copy(sys.path) |
return item.getTitle() | return self.item.getTitle() | def getTitle(self): return item.getTitle() |
(enclosure['url'][-4:].lower() in ['.mov','.wmv','.mp4', | (enclosure['url'][-4:].lower() in ['.mov','.wmv','.mp4', '.m4v', | def hasVideoFeed(self, enclosures): hasOne = False for enclosure in enclosures: if ((enclosure.has_key('type') and (enclosure['type'].startswith('video/') or enclosure['type'].startswith('audio/') or enclosure['type'] == "application/x-bittorrent")) or (enclosure.has_key('url') and (enclosure['url'][-4:].lower() in ['.... |
['.mov','.wmv','.mp4','.mp3','.mpg','.avi']) or | ['.mov','.wmv','.mp4','.m4v','.mp3','.mpg','.avi']) or | def processLinks(self,links, depth = 0,linkNumber = 0): maxDepth = 2 urls = links[0] links = links[1] if depth<maxDepth: for link in urls: if depth == 0: linkNumber += 1 #print "Processing %s (%d)" % (link,linkNumber) |
self.currentPlaylist.reset() self.currentPlaylist = None | if self.currentPlaylist is not None: self.currentPlaylist.reset() self.currentPlaylist = None | def reset(self): self.currentPlaylist.reset() self.currentPlaylist = None self.currentDisplay = None |
cur = self.controller.checkTabByID(id) | try: cur = self.controller.checkTabByID(id) except: print "Tab %s doesn't exist! Cannot select it." % str(id) return | def selectTab(self, id, templateNameHint = None): cur = self.controller.checkTabByID(id) |
for item in manualFeed.items: item.beginRead() | for i in manualFeed.items: i.beginRead() | def addTorrent(path): try: torrentInfohash = getTorrentInfoHash(path) except ValueError: print "WARNING: %s doesn't seem to be a torrent file" return manualFeed = app.getSingletonDDBObject('manualFeed') manualFeed.beginRead() try: for item in manualFeed.items: item.beginRead() try: infohash = item.downloaders[0].status... |
infohash = item.downloaders[0].status.get('infohash') | infohash = i.downloaders[0].status.get('infohash') | def addTorrent(path): try: torrentInfohash = getTorrentInfoHash(path) except ValueError: print "WARNING: %s doesn't seem to be a torrent file" return manualFeed = app.getSingletonDDBObject('manualFeed') manualFeed.beginRead() try: for item in manualFeed.items: item.beginRead() try: infohash = item.downloaders[0].status... |
"download for %s" % (path, item)) | "download for %s" % (path, i)) | def addTorrent(path): try: torrentInfohash = getTorrentInfoHash(path) except ValueError: print "WARNING: %s doesn't seem to be a torrent file" return manualFeed = app.getSingletonDDBObject('manualFeed') manualFeed.beginRead() try: for item in manualFeed.items: item.beginRead() try: infohash = item.downloaders[0].status... |
item.endRead() | i.endRead() | def addTorrent(path): try: torrentInfohash = getTorrentInfoHash(path) except ValueError: print "WARNING: %s doesn't seem to be a torrent file" return manualFeed = app.getSingletonDDBObject('manualFeed') manualFeed.beginRead() try: for item in manualFeed.items: item.beginRead() try: infohash = item.downloaders[0].status... |
print "DTV: eventloop: %s" % detail | print "DTV: eventloop: Warning: %s" % detail | def loop(self): database.set_thread() while not self.quitFlag: self._beginLoop() timeout = self.scheduler.nextTimeout() readfds = self.readCallbacks.keys() writefds = self.writeCallbacks.keys() try: readables, writeables, _ = select.select(readfds, writefds, [], timeout) except select.error, (err, detail): if err == er... |
if self.state == 'finished' and oldState != 'finished': | if ((self.state in ['finished','uploading']) and (oldState not in ['finished', 'uploading'])): | def updateStatus(cls, data): view = app.globalViewList['remoteDownloads'].filterWithIndex( app.globalIndexList['downloadsByDLID'],data['dlid']) try: view.resetCursor() self = view.getNext() finally: app.globalViewList['remoteDownloads'].removeView(view) if not self is None: oldState = self.state for key in data.keys():... |
singleclick.openFile (initialFeeds) | urls = subscription.parseFile(initialFeeds) if urls is not None: for url in urls: feed.Feed(url, initiallyAutoDownloadable=False) | def _getInitialChannelGuide(): default_guide = None for guideObj in views.guides: if default_guide is None: if guideObj.getDefault(): default_guide = guideObj else: guideObj.remove() if default_guide is None: print "DTV: Spawning Channel Guide..." default_guide = guide.ChannelGuide() initialFeeds = resource.path("initi... |
return string.replace(val, '%USERPROFILE%', os.environ['USERPROFILE']) | out = ctypes.create_string_buffer(4096) indata = ctypes.create_string_buffer(val) bytes = ctypes.windll.kernel32.ExpandEnvironmentStringsA(indata,out,4093) return out.value | def doExpand(val): # We can't use os.path.expandvars because that handles only # $foo and ${foo}-style vars, while Windows is lobbing us # %FOO%-style expansions. So just handle the special case of # %USERPROFILE%, which is what we'll be dealing with under normal # circumstances. # .. If USERPROFILE isn't defined, we'r... |
* Items are always new if their feed hasn't been marked as viewed after the item's pub date. This is so that when a user gets a list of items and starts downloading them, the list doesn't reorder itself. | * Newly downloaded and downloading items are always new if their feed hasn't been marked as viewed after the item's pub date. This is so that when a user gets a list of items and starts downloading them, the list doesn't reorder itself. Once they start watching them, then it reorders itself. | def getChannelCategory(self): """Get the category to use for the channel template. This method is similar to getState(), but has some subtle differences. getState() is used by the download-item template and is usually more useful to determine what's actually happening with an item. getChannelCategory() is used by by t... |
if not self.getViewed(): return 'new' elif self.downloader is None or not self.downloader.isFinished(): | if self.downloader is None or not self.downloader.isFinished(): if not self.getViewed(): return 'new' | def getChannelCategory(self): """Get the category to use for the channel template. This method is similar to getState(), but has some subtle differences. getState() is used by the download-item template and is usually more useful to determine what's actually happening with an item. getChannelCategory() is used by by t... |
def getThumbnail(self): for enc in self.entry.enclosures: try: return enc["thumbnail"]["url"] | def getThumbnail(self): self.lock.acquire() try: try: for enc in self.entry.enclosures: try: ret = enc["thumbnail"]["url"] break except: pass except: try: ret = self.entry["thumbnail"]["url"] | def getThumbnail(self): for enc in self.entry.enclosures: try: return enc["thumbnail"]["url"] |
pass try: return self.entry["thumbnail"]["url"] except: return "resource:images/thumb.gif" | ret = "resource:images/thumb.gif" return ret finally: self.lock.release() | def getThumbnail(self): for enc in self.entry.enclosures: try: return enc["thumbnail"]["url"] |
self.goodID = self.origObjs[0].getID() self.objs = self.everything.filter(lambda x: x.getID() == self.goodID) | self.origObjs[0].good = True self.origObjs[1].good = False self.origObjs[2].good = False self.objs = self.everything.filter(lambda x: x.good) | def setUp(self): DDBObject.dd = DynamicDatabase() self.everything = DDBObject.dd |
self.origObjs[0].id = -1 | self.origObjs[0].good = False | def testLoss(self): self.assertEqual(self.objs.len(),1) self.origObjs[0].beginChange() self.origObjs[0].id = -1 self.origObjs[0].endChange() self.assertEqual(self.objs.len(),0) |
self.origObjs[1].id = self.goodID | self.origObjs[1].good = True | def testAdd(self): self.assertEqual(self.objs.len(),1) self.origObjs[1].beginChange() self.origObjs[1].id = self.goodID self.origObjs[1].endChange() self.assertEqual(self.objs.len(),2) |
self.goodID = self.origObjs[0].getID() self.objs = self.everything.map(self.mapToObject).filter(lambda x: x.oldID == self.goodID) | self.origObjs[0].good = True self.origObjs[1].good = False self.origObjs[2].good = False self.objs = self.everything.map(self.mapToObject).filter(lambda x: x.good) | def setUp(self): DDBObject.dd = DynamicDatabase() self.everything = DDBObject.dd |
temp.oldID = obj.getID() | temp.good = obj.good | def mapToObject(self, obj): |
self.origObjs[0].id = -1 | self.origObjs[0].good = False | def testLoss(self): self.assertEqual(self.objs.len(),1) self.origObjs[0].beginChange() self.origObjs[0].id = -1 self.origObjs[0].endChange() self.assertEqual(self.objs.len(),1) |
self.origObjs[1].id = self.goodID | self.origObjs[1].good = True | def testAdd(self): self.assertEqual(self.objs.len(),1) self.origObjs[1].beginChange() self.origObjs[1].id = self.goodID self.origObjs[1].endChange() self.assertEqual(self.objs.len(),1) |
self.goodID = self.origObjs[0].getID() self.objs = self.everything.sort(lambda x, y: 0).sort(lambda x, y: 0).filter(lambda x: x.getID() == self.goodID) | self.origObjs[0].good = True self.origObjs[1].good = False self.origObjs[2].good = False self.objs = self.everything.sort(lambda x, y: 0).sort(lambda x, y: 0).filter(lambda x: x.good) | def setUp(self): DDBObject.dd = DynamicDatabase() self.everything = DDBObject.dd |
if not hasattr(currentDisplay, 'getCurrentTime') or currentDisplay.getCurrentTime() <= 1.0: | if not hasattr(currentDisplay, 'getCurrentTime') or currentDisplay.getCurrentTime() <= 2.0: | def skip(self, direction): nextItem = None if self.currentPlaylist is not None: if direction == 1: nextItem = self.currentPlaylist.getNext() else: frame = Controller.instance.frame currentDisplay = frame.getDisplay(frame.mainDisplay) if not hasattr(currentDisplay, 'getCurrentTime') or currentDisplay.getCurrentTime() <=... |
return VideoRenderer.DEFAULT_DISPLAY_TIME | return 0 | def getCurrentTime(self): if self.activeRenderer is not None: return self.activeRenderer.getCurrentTime() return VideoRenderer.DEFAULT_DISPLAY_TIME |
pyexe = info['PythonInfoDict']['PythonExecutable'] script = bundle.pathForResource_ofType_('Democracy_Downloader', 'py') import imp mfile, mpath, mdesc = imp.find_module('dl_daemon') daemonPrivatePath = os.path.join(mpath, 'private') pythonPath = list(sys.path) pythonPath[0:0] = [daemonPrivatePath] env['PYTHONPATH'] ... | for location in info['PyRuntimeLocations']: if location.startswith('@executable_path'): location = location.replace('@executable_path', os.path.dirname(bundle.executablePath())) location = os.path.dirname(location) location = os.path.join(location, "bin", "python") location = os.path.normpath(location) if os.path.exist... | def launchDownloadDaemon(self, oldpid, env): self.killDownloadDaemon(oldpid) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.