rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
if self.maxNew >= 0 and newItems >= self.maxNew: | if self.maxNew >= 0 and newitems >= self.maxNew: | def downloadNextAuto(self, dontUse = []): self.beginRead() try: next = None |
self.beginRead() try: try: ret = datetime(*self.entry.enclosures[0].modified_parsed[0:7]).strftime("%b %d %Y") | if hasattr(self,'releaseDate'): return self.releaseDate self.beginRead() try: try: self.releaseDate = datetime(*self.entry.enclosures[0].modified_parsed[0:7]).strftime("%b %d %Y") | def getReleaseDate(self): |
ret = datetime(*self.entry.modified_parsed[0:7]).strftime("%b %d %Y") | self.releaseDate = datetime(*self.entry.modified_parsed[0:7]).strftime("%b %d %Y") | def getReleaseDate(self): |
ret = "" finally: self.endRead() return ret | self.releaseDate = "" finally: self.endRead() return self.releaseDate | def getReleaseDate(self): |
raise template.TemplateError, "Multiple values of '%s' argument passend to '%s' action" % (key, action) | raise template.TemplateError, "Multiple values of '%s' argument passed to '%s' action" % (key, action) if type(key) == unicode: key = key.encode('utf8') | def onURLLoad(self, url): print "DTV: got %s" % url try: # Special-case non-'action:'-format URL match = re.compile(r"^template:(.*)$").match(url) if match: self.dispatchAction('switchTemplate', name = match.group(1)) return False |
remove(self.filename) | if os.path.isdir(self.filename): shutil.rmtree(self.filename) else: remove(self.filename) | def stop(self): self.state = "stopped" self.updateClient() self._shutdownTorrent() try: remove(self.filename) except: pass |
self.skipIfItemFileIsMissing(anItem) videoDisplay = Controller.instance.videoDisplay if videoDisplay.canPlayItem(anItem): self.playItemInternally(videoDisplay, anItem) else: if self.currentDisplay is videoDisplay: if videoDisplay.isFullScreen: videoDisplay.exitFullScreen() videoDisplay.stop() self.scheduleExternalPlayb... | anItem = self.skipIfItemFileIsMissing(anItem) if anItem is not None: videoDisplay = Controller.instance.videoDisplay if videoDisplay.canPlayItem(anItem): self.playItemInternally(videoDisplay, anItem) else: if self.currentDisplay is videoDisplay: if videoDisplay.isFullScreen: videoDisplay.exitFullScreen() videoDisplay.s... | def playItem(self, anItem): try: self.skipIfItemFileIsMissing(anItem) videoDisplay = Controller.instance.videoDisplay if videoDisplay.canPlayItem(anItem): self.playItemInternally(videoDisplay, anItem) else: if self.currentDisplay is videoDisplay: if videoDisplay.isFullScreen: videoDisplay.exitFullScreen() videoDisplay.... |
self.onMovieFinished() | return self.skip(1) else: return anItem | def skipIfItemFileIsMissing(self, anItem): path = anItem.getPath() if not os.path.exists(path): print "DTV: movie file '%s' is missing, skipping to next" % path self.onMovieFinished() |
if self.skip(1) is None: self.stop() | return self.skip(1) | def onMovieFinished(self): if self.skip(1) is None: self.stop() |
sortKey = obj.getTitle() | sortKey = obj.getTitle().lower() | def mapToTab(self,obj): data = {'global': self.globalTemplateData}; if isinstance(obj, StaticTab): return Tab(obj.tabTemplateBase, data, obj.contentsTemplate, data, [obj.order], obj, controller) elif isinstance(obj, feed.Feed): data['feed'] = obj # Change this to sort feeds on a different value sortKey = obj.getTitle()... |
self.outString.write('<%s'%name) for key in attrs.keys(): if not (key in ['t:hideIfKey','t:hideIfNotKey','t:hideFunctionKey','t:hideParameter','style']): self.outString.write(' %s=%s'%(key,self.quoteAndFillAttr(attrs[key],self.data))) if hide: self.outString.write(' style="display:none">') else: | if not hide: self.outString.write('<%s'%name) for key in attrs.keys(): if not (key in ['t:hideIfKey','t:hideIfNotKey','t:hideFunctionKey','t:hideParameter','style']): self.outString.write(' %s=%s'%(key,self.quoteAndFillAttr(attrs[key],self.data))) | 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... |
feedURL = app.Controller.instance.currentSelectedTab.feedID() | feedID = app.Controller.instance.currentSelectedTab.feedID() | def updateChannel_(self, sender): feedURL = app.Controller.instance.currentSelectedTab.feedID() if feedID is not None: backEndDelegate = self.appl.getBackendDelegate() app.ModelActionHandler(backEndDelegate).updateFeed(feedID) |
CORRECT_QTMEDIA_TYPES = (QTMediaTypeVideo, QTMediaTypeMPEG, QTMediaTypeMovie) | CORRECT_QTMEDIA_TYPES = (QTMediaTypeVideo, QTMediaTypeMPEG, QTMediaTypeMovie, QTMediaTypeFlash) | def sendEvent_(self, event): if self.isFullScreen: if event.type() == NSLeftMouseDown: if NSApplication.sharedApplication().isActive(): app.controller.videoDisplay.exitFullScreen() else: NSApplication.sharedApplication().activateIgnoringOtherApps_(YES) elif event.type() == NSKeyDown: if event.characters().characterAtIn... |
if self.client is not None and self.client.gotBadStatusCode: | if self.client.gotBadStatusCode: | def onHeaders(self, info): if info['contentLength'] != None: self.totalSize = info['contentLength'] if self.client is not None and self.client.gotBadStatusCode: self.handleError("HTTP Error") return if not self.acceptDownloadSize(self.totalSize): self.handleError("Not enough free space") return #Get the length of the f... |
def __init__(self, url,item, conn = None,info = None): | def __init__(self, url,item, conn = None,download = None,redirURL = None): | def __init__(self, url,item, conn = None,info = None): |
self.info = info | self.download = download self.redirURL = redirURL | def __init__(self, url,item, conn = None,info = None): |
if download.status != 200: if download.status == 302 or download.status == 307 or download.status == 301: info = download.msg download.close() conn.close() if download.status == 301: self.url = info['Location'] (scheme, host, path, params, query, fragment) = urlparse(info['Location']) if len(params): path += ';'+params... | depth = 0 | def runDownloader(self, retry = False): |
if self.info == None: info = download.msg else: info = self.info | info = download.msg download.close() | def runDownloader(self, retry = False): |
raise DownloaderError, "File not found" | raise DownloaderError, "Failed with "+str(download.status) | def runDownloader(self, retry = False): |
print "Couldn't connect" | def getDownloader(self,url): | |
if download.status != 200: if download.status == 301: | depth = 0 while download.status != 200 and depth < 10: depth += 1 if download.status == 302 or download.status == 307 or download.status == 301: | def getDownloader(self,url): |
return self.getDownloader(info['Location']) elif download.status == 302 or download.status == 307: info = download.msg download.close() conn.close() (scheme, host, path, params, query, fragment) = urlparse(url) | redirURL = info['Location'] if download.status == 301: url = redirURL (scheme, host, path, params, query, fragment) = urlparse(info['Location']) | def getDownloader(self,url): |
if download.status != 200: return None | def getDownloader(self,url): | |
return HTTPDownloader(url,self.item,conn,info) | print "Starting http downloader" return HTTPDownloader(url,self.item,conn,download,redirURL) | def getDownloader(self,url): |
import tempfile import os | def __init__(self, html, existingView=None, frameHint=None, areaHint=None): """'html' is the initial contents of the display, as a string. If frameHint is provided, it is used to guess the initial size the HTML display will be rendered at, which might reduce flicker when the display is installed.""" app.Display.__init_... | |
self.deleteOnLoadFinished = location parts = re.split(r'\\', location) url = "file:///" + '/'.join(parts) print "url = %s" % url | def __init__(self, html, existingView=None, frameHint=None, areaHint=None): """'html' is the initial contents of the display, as a string. If frameHint is provided, it is used to guess the initial size the HTML display will be rendered at, which might reduce flicker when the display is installed.""" app.Display.__init_... | |
self.wb = WebBrowser.WebBrowser(hwnd = self.hwnd, initialHTML = html, onLoadCallback = self.rawOnLoad, userAgent = userAgent) | self.mb = MozillaBrowser. \ MozillaBrowser(hwnd = self.hwnd, initialURL = url, onLoadCallback = self.onURLLoad, onActionCallback = self.onURLLoad, onDocumentLoadFinishedCallback = \ self.onDocumentLoadFinished, userAgent = userAgent) | def __init__(self, html, existingView=None, frameHint=None, areaHint=None): """'html' is the initial contents of the display, as a string. If frameHint is provided, it is used to guess the initial size the HTML display will be rendered at, which might reduce flicker when the display is installed.""" app.Display.__init_... |
self.wb.execJS(js) | raise NotImplementedError | def execJS(self, js): # NEEDS: threading??? queueing??? # Go ahead and queue on main thread, through message. You'll be glad. #print "Punted JS" #NEEDS #self.browser.document.parentWindow.execScript(js, "javascript") |
@deferUntilAfterLoad | def execJS(self, js): # NEEDS: threading??? queueing??? # Go ahead and queue on main thread, through message. You'll be glad. #print "Punted JS" #NEEDS #self.browser.document.parentWindow.execScript(js, "javascript") | |
pass | print "aIAE" self.mb.addElementAtEnd(xml, id) print "back" @deferUntilAfterLoad | def addItemAtEnd(self, xml, id): pass |
pass | print "aIB on %s" % self self.mb.addElementBefore(xml, id) print "back" @deferUntilAfterLoad | def addItemBefore(self, xml, id): pass |
pass | print "rI" self.mb.removeItem(id) print "back" @deferUntilAfterLoad | def removeItem(self, id): pass |
pass | print "cI" self.mb.changeItem(id, xml) print "back" @deferUntilAfterLoad | def changeItem(self, id, xml): pass |
pass | print "hI" self.mb.hideItem(id) print "back" @deferUntilAfterLoad | def hideItem(self, id): pass |
pass def rawOnLoad(self, *args): print "Got load event in Python, args: %s" % (args, ) | print "sI" self.mb.showItem(id) print "back" | def showItem(self, id): pass |
self.wb = None | self.mb = None | def unlink(self): self.wb = None if self.hwnd: print "HTMLDisplay unlink %s" % self.hwnd win32gui.DestroyWindow(self.hwnd) self.hwnd = None |
delegate.openExternalURL(url) | self.handleCandidateExternalURL(url) | def onURLLoad(self, url): #print "DTV: got %s" % url try: # Special-case non-'action:'-format URL if url.startswith ("template:"): name, args = self.parseEventURL(url) self.dispatchAction('switchTemplate', name=name, **args) return False |
else: self.actualFeed.update() finally: self.endRead() | finally: self.endRead() self.actualFeed.update() | def update(self): self.beginRead() try: if self.loading: return elif self.errorState: self.loading = True self.errorState = False self.beginChange() self.endChange() thread = Thread(target=lambda: self.generateFeed()) thread.setDaemon(False) thread.start() return else: self.actualFeed.update() finally: self.endRead() |
raise DatabaseConstraintError("%s not in database" % self.feed_id) | raise DatabaseConstraintError("my feed (%s) is not in database" % self.feed_id) | def checkConstraints(self): if self.feed_id is not None: try: obj = self.dd.getObjectByID(self.feed_id) except ObjectNotFoundError: raise DatabaseConstraintError("%s not in database" % self.feed_id) else: if not isinstance(obj, feed.Feed): msg = "feed_id points to a %s instance" % obj.__class__ raise DatabaseConstraint... |
raise DatabaseConstraintError("%s not in database" % self.parent_id) | raise DatabaseConstraintError("my parent (%s) is not in database" % self.parent_id) | def checkConstraints(self): if self.feed_id is not None: try: obj = self.dd.getObjectByID(self.feed_id) except ObjectNotFoundError: raise DatabaseConstraintError("%s not in database" % self.feed_id) else: if not isinstance(obj, feed.Feed): msg = "feed_id points to a %s instance" % obj.__class__ raise DatabaseConstraint... |
self.expiring = None | def signalChange(self, needsSave=True, needsUpdateUandA=True, needsUpdateXML=True): self._calcState() self.expiring = None if hasattr(self, "_size"): del self._size DDBObject.signalChange(self, needsSave=needsSave) if needsUpdateXML: try: del self._itemXML except: pass if needsUpdateUandA: try: # If the feed has been d... | |
if ufeed.expire == 'never' or (ufeed.expire == 'system' and config.get(prefs.EXPIRE_AFTER_X_DAYS) <= 0): | if (self.keep or ufeed.expire == 'never' or (ufeed.expire == 'system' and config.get(prefs.EXPIRE_AFTER_X_DAYS) <= 0)): | def getExpiring(self): if self.expiring is None: if (not self.getSeen()) or (not self.isDownloaded()): self.expiring = False else: ufeed = self.getFeed() if ufeed.expire == 'never' or (ufeed.expire == 'system' and config.get(prefs.EXPIRE_AFTER_X_DAYS) <= 0): self.expiring = False else: self.expiring = True return self.... |
return tab.isGuide() and not tab.obj.isDefault() | return tab.isGuide() and not tab.obj.getDefault() | def validateMenuItem_(self, item): if item.action() == 'removeGuide:': tab = app.controller.currentSelectedTab return tab.isGuide() and not tab.obj.isDefault() else: return item.action() in self.itemsAlwaysAvailable |
print "DTV: bad HTML in %s" % self.baseurl | print "DTV: bad HTML in description for %s" % self.baseurl | def endElementNS(self, name, qname): uri = name[0] tag = name[1] 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 HTMLParseErro... |
linkPattern = re.compile("^.*?<(a|embed).*?(href|src)\s*=\s*\"(.*?)\".*?>(.*?)</a>(.*)$", re.S) imgPattern = re.compile(".*<img.*?src\s*=\s*\"(.*?)\".*?>", re.S) | linkPattern = re.compile("^.*?<(a|embed)\s.*?(href|src)\s*=\s*\"(.*?)\".*?>(.*?)</a>(.*)$", re.S) imgPattern = re.compile(".*<img\s.*?src\s*=\s*\"(.*?)\".*?>", re.S) | def addItem(self, item): self.ufeed.beginRead() try: if not item in self.items: item.beginRead() try: item.feed.items.remove(item) item.feed = self.ufeed finally: item.endRead() self.items.append(item) finally: self.ufeed.endRead() |
return re.match(r"^(http|https|feed)://[^/]+/.*", url) is not None | return re.match(r"^(http|https)://[^/]+/.*", url) is not None | def validateFeedURL(url): return re.match(r"^(http|https|feed)://[^/]+/.*", url) is not None |
match = re.match(r"^(http|https|feed):/*(.*)$", url) | match = re.match(r"^(http|https):/*(.*)$", url) | def normalizeFeedURL(url): # Valid URL are returned as-is if validateFeedURL(url): return url originalURL = url # Check valid schemes with invalid separator match = re.match(r"^(http|https|feed):/*(.*)$", url) if match is not None: url = "%s://%s" % match.group(1,2) # Replace invalid schemes by http match = re.match... |
match = re.match(r"^(.*:/*)*(.*)$", url) if match is not None: url = "http://%s" % match.group(2) | match = re.match(r"^(([A-Za-z]*):/*)*(.*)$", url) if match.group(2) in ['feed', 'podcast']: url = "http://%s" % match.group(3) elif match.group(1) == 'feeds': url = "https://%s" % match.group(3) | def normalizeFeedURL(url): # Valid URL are returned as-is if validateFeedURL(url): return url originalURL = url # Check valid schemes with invalid separator match = re.match(r"^(http|https|feed):/*(.*)$", url) if match is not None: url = "%s://%s" % match.group(1,2) # Replace invalid schemes by http match = re.match... |
match = re.match(r"^(http|https|feed)://[^/]*$", url) | match = re.match(r"^(http|https)://[^/]*$", url) | def normalizeFeedURL(url): # Valid URL are returned as-is if validateFeedURL(url): return url originalURL = url # Check valid schemes with invalid separator match = re.match(r"^(http|https|feed):/*(.*)$", url) if match is not None: url = "%s://%s" % match.group(1,2) # Replace invalid schemes by http match = re.match... |
elif item.getState() == 'downloading': | elif self.getState() == 'downloading': | def makeContextMenu(self, templateName, view): c = app.controller # easier/shorter to type if self.isDownloaded(): if templateName in ('playlist', 'playlist-folder'): label = _('Remove From Playlist') else: label = _('Remove From My Collection') items = [ (lambda: c.playView(view, self.getID()), _('Play')), (lambda: c.... |
print print repr(text) print repr(self.text) print | def test(self): compiled_templates.unittest.translationtest._ = lambda x : '!%s!' % x (tch, handle) = fillTemplate("unittest/translationtest",DOMTracker(),'gtk-x11-MozillaBrowser','platform') compiled_templates.unittest.translationtest._ = self.oldgettext text = tch.read() text = HTMLPattern.match(text).group(1) print ... | |
return self.status['filename'] | return self.status.get('filename') | def getFilename(self): self.beginRead() try: return self.status['filename'] finally: self.endRead() |
self.scheduleFastSeek(seekDelay, direction) | info = {'seekDirection': direction} self.fastSeekTimer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(seekDelay, self, 'fastSeek:', info, NO) self.scheduleFastSeek(self.fastSeekTimer) | def performSeek(self, sender, direction, seekDelay=0.5): if sender.state() == NSOnState: sender.sendActionOn_(NSLeftMouseUpMask) if seekDelay > 0.0: self.scheduleFastSeek(seekDelay, direction) else: self.fastSeekTimer = nil self.fastSeek(direction) else: sender.sendActionOn_(NSLeftMouseDownMask) if self.fastSeekTimer i... |
def scheduleFastSeek(self, delay, direction): info = {'seekDirection': direction} self.fastSeekTimer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(delay, self, 'fastSeek:', info, NO) NSRunLoop.currentRunLoop().addTimer_forMode_(self.fastSeekTimer, NSEventTrackingRunLoopMode) | def scheduleFastSeek(self, timer): platformutils.warnIfNotOnMainThread('scheduleFastSeek') NSRunLoop.currentRunLoop().addTimer_forMode_(timer, NSEventTrackingRunLoopMode) | def scheduleFastSeek(self, delay, direction): info = {'seekDirection': direction} self.fastSeekTimer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(delay, self, 'fastSeek:', info, NO) NSRunLoop.currentRunLoop().addTimer_forMode_(self.fastSeekTimer, NSEventTrackingRunLoopMode) |
self.handleError(BadHeaderLine(line)) return | print "DTV: Warning: Bad Header from %s:%s%s (%s)" % (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 == '': self.handleError(BadHeaderLine(line)) return if header not in self.headers: self.headers[header] = value else: self.headers[header] += (',%s' % value) |
windowTitle, WS_CHILDWINDOW, 320, 10, 300, 300, | windowTitle, WS_CHILDWINDOW, 120, 10, 500, 300, | def __init__(self, appl): """The initially active display will be an instance of NullDisplay.""" |
if oldHwnd: | if oldHwnd and oldHwnd != newHwnd: | def selectDisplay(self, newDisplay, area): """Install the provided 'newDisplay' in the requested area""" print "selectDisplay %s (%s) in %s" % (newDisplay, newDisplay.getHwnd(), area) if not self.hwnd: print "Warning: selectDisplay ignored on destroyed MainFrame." |
return | called = True break | def dispatchAction(self, action, **kwargs): start = clock() for handler in self.actionHandlers: if hasattr(handler, action): getattr(handler, action)(**kwargs) return end = clock() if end - start > 0.5: print "WARNING: dispatch action %s too slow (%.3f secs)" % (action, end - start) print "Ignored bad action URL: actio... |
print "Ignored bad action URL: action=%s" % action | if not called: print "Ignored bad action URL: action=%s" % action | def dispatchAction(self, action, **kwargs): start = clock() for handler in self.actionHandlers: if hasattr(handler, action): getattr(handler, action)(**kwargs) return end = clock() if end - start > 0.5: print "WARNING: dispatch action %s too slow (%.3f secs)" % (action, end - start) print "Ignored bad action URL: actio... |
expireTime = timedelta(days=int(config.get(config.EXPIRE_AFTER_X_DAYS))) | expireTime = timedelta(days=config.get(config.EXPIRE_AFTER_X_DAYS)) | def expireItems(self): expireTime = datetime.max - datetime.min if self.expire == "feed": expireTime = self.expireTime elif self.expire == "system": expireTime = timedelta(days=int(config.get(config.EXPIRE_AFTER_X_DAYS))) elif self.expire == "never": return for item in self.items: local = item.getFilename() is not "" e... |
if view.len() == 0: | if view.len() == 0 and id in self.trackedItems: | def checkItemIDRemoved(self, id): index = indexes.playlistsByItemAndFolderID value = (id, self.getID()) view = views.playlists.filterWithIndex(index, value) if view.len() == 0: self.removeID(id) |
if downloader.status.get('state') in ('downloading', 'paused'): filename = downloader.status['filename'] if not os.path.isabs(filename): filename = os.path.join(downloadDir, file) filesInUse.add(filename) | if downloader.getState() in ('downloading', 'paused'): filename = downloader.getFilename() if len(filename) > 0: if not os.path.isabs(filename): filename = os.path.join(downloadDir, file) filesInUse.add(filename) | def cleanupIncompleteDownloads(): downloadDir = os.path.join(config.get(prefs.MOVIES_DIRECTORY), 'Incomplete Downloads') if not os.path.exists(downloadDir): return filesInUse = set() views.remoteDownloads.beginRead() try: for downloader in views.remoteDownloads: if downloader.status.get('state') in ('downloading', 'pa... |
def downloadedItems(obj, param): | def unwatchedItems(obj, param): | def downloadedItems(obj, param): params = param.split('|',1) dled = (str(obj.feed.getID()) == params[0] and ((obj.getState() == 'finished' or obj.getState() == 'uploading' or obj.getState() == 'watched'))) if len(params) > 1: dled = (dled and (str(params[1]).lower() in obj.getTitle().lower() or str(params[1]).lower() ... |
obj.getState() == 'uploading' or obj.getState() == 'watched'))) | obj.getState() == 'uploading'))) | def downloadedItems(obj, param): params = param.split('|',1) dled = (str(obj.feed.getID()) == params[0] and ((obj.getState() == 'finished' or obj.getState() == 'uploading' or obj.getState() == 'watched'))) if len(params) > 1: dled = (dled and (str(params[1]).lower() in obj.getTitle().lower() or str(params[1]).lower() ... |
'downloadedItems': downloadedItems, | 'unwatchedItems': unwatchedItems, 'expiringItems': expiringItems, | def allDownloadingItems(obj, param): params = param.split('|',1) if len(params)>1: search = params[1] else: search = '' return (obj.getState() == 'downloading' and (search.lower() in obj.getTitle().lower() or search.lower() in obj.getDescription().lower())) |
self.addChannelSheetURL.setStringValue_("") | url = NSPasteboard.generalPasteboard().stringForType_(NSStringPboardType) if not url.startswith('http://'): url = '' self.addChannelSheetURL.setStringValue_(url) | def awakeFromNib(self): self.addChannelSheetURL.setStringValue_("") |
self.isPlaying = True | def play_(self, sender): if self.currentItem is None: # There has to be a better way to do this... app.Controller.instance.frame.obj.doCommandBySelector_('playVideo:') else: self.currentVideoView.play_(self) self.currentVideoView.setNeedsDisplay_(YES) self.isPlaying = True | |
self.isPlaying = False | def pause_(self, sender): self.currentVideoView.pause_(self) self.isPlaying = False | |
self.playPauseButton.setEnabled_(YES) self.fullscreenButton.setEnabled_(YES) info = notification.userInfo() playlist = info['view'] self.setPlaylist(playlist, False) self.currentWatchableDisplay = notification.object() | source = notification.object() if source is not VideoDisplay.getInstance(): self.playPauseButton.setEnabled_(YES) self.fullscreenButton.setEnabled_(YES) info = notification.userInfo() playlist = info['view'] self.setPlaylist(playlist, False) self.currentWatchableDisplay = source | def handleWatchableDisplayNotification_(self, notification): self.playPauseButton.setEnabled_(YES) self.fullscreenButton.setEnabled_(YES) info = notification.userInfo() playlist = info['view'] self.setPlaylist(playlist, False) self.currentWatchableDisplay = notification.object() |
self.movieView.setMovie_(self.previousMovieView.movie()) | movie = self.previousMovieView.movie() self.movieView.setMovie_(movie) self.movieView.setNeedsDisplay_(YES) self.previousMovieView.setMovie_(nil) | def makeKeyAndOrderFront_(self, sender): self.movieView.setMovie_(self.previousMovieView.movie()) super(FullScreenVideoWindow, self).makeKeyAndOrderFront_(sender) self.previousMovieWindow.orderOut_(sender) |
self.previousMovieView.setMovie_(self.movieView.movie()) | super(FullScreenVideoWindow, self).orderOut_(sender) movie = self.movieView.movie() self.previousMovieView.setMovie_(movie) self.movieView.setMovie_(nil) self.previousMovieView.setNeedsDisplay_(YES) | def orderOut_(self, sender): self.previousMovieView.setMovie_(self.movieView.movie()) self.previousMovieWindow.makeKeyAndOrderFront_(sender) self.previousMovieWindow = nil self.previousMovieView = nil super(FullScreenVideoWindow, self).orderOut_(sender) |
super(FullScreenVideoWindow, self).orderOut_(sender) | def orderOut_(self, sender): self.previousMovieView.setMovie_(self.movieView.movie()) self.previousMovieWindow.makeKeyAndOrderFront_(sender) self.previousMovieWindow = nil self.previousMovieView = nil super(FullScreenVideoWindow, self).orderOut_(sender) | |
self.refresh_(nil) | self.refresh_(nil) self.setNeedsDisplay_(YES) | def setup(self, renderer): if self.renderer != renderer: self.renderer = renderer if renderer is not nil: self.updateTimer = NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(1.0, self, 'refresh:', nil, YES) NSRunLoop.currentRunLoop().addTimer_forMode_(self.updateTimer, NSEventTrackingRunLoopMode... |
if qtmovie is not nil: | if qtmovie is not nil and qtmovie.duration().timeValue > 0 and len(qtmovie.tracks()) > 0: | def canPlayItem(self, item): canPlay = False 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 = qtmovie if qtmovie is no... |
frame = Controller.instance.frame area = frame.mainDisplay frame.selectDisplay(self.previousDisplay, area) | area = Controller.instance.frame.mainDisplay previousDisplay = self.previousDisplay | def exitVideoMode(self): frame = Controller.instance.frame area = frame.mainDisplay frame.selectDisplay(self.previousDisplay, area) self.reset() |
frame.selectDisplay(previousDisplay, area) | def exitVideoMode(self): frame = Controller.instance.frame area = frame.mainDisplay frame.selectDisplay(self.previousDisplay, area) self.reset() | |
ok = NSWorkspace.sharedWorkspace().openFile_withApplication_andDeactivate_(moviePath, nil, YES) | ws = NSWorkspace.sharedWorkspace() ok, externalApp, movieType = ws.getInfoForFile_application_type_(moviePath) if ok: if externalApp == NSBundle.mainBundle().bundlePath(): print 'DTV: WARNING, trying to play movie externally with Democracy.' ok = False else: ok = ws.openFile_withApplication_andDeactivate_(moviePath, ni... | def playItemExternally(self, itemID): item = app.PlaybackControllerBase.playItemExternally(self, itemID) moviePath = item.getVideoFilename() ok = NSWorkspace.sharedWorkspace().openFile_withApplication_andDeactivate_(moviePath, nil, YES) if not ok: print "DTV: movie %s could not be externally opened" % moviePath |
except KeyError: | except: | 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... |
except: pass | 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... | |
if True not in itertools.imap(url.startswith, self.allowedURLSchemes): | if url is None or True not in itertools.imap(url.startswith, self.allowedURLSchemes): | def awakeFromNib(self): url = NSPasteboard.generalPasteboard().stringForType_(NSStringPboardType) if True not in itertools.imap(url.startswith, self.allowedURLSchemes): url = '' self.addChannelSheetURL.setStringValue_(url) |
if parent.childNodes().length() != 1: raise NotImplementedError, "in createElt, expected exactly one node" | if parent.childNodes().length() > 1: eltlist = [] for child in range(parent.childNodes().length()): eltlist.append(parent.childNodes().item_(child)) return eltlist | def createElt(self, xml): parent = self.view.mainFrame().DOMDocument().createElement_("div") parent.setInnerHTML_(xml) elt = parent.firstChild() if parent.childNodes().length() != 1: raise NotImplementedError, "in createElt, expected exactly one node" return elt |
newelt = self.createElt(xml) elt.parentNode().insertBefore__(newelt, elt) | newelts = self.createElt(xml) try: for newelt in newelts: elt.parentNode().insertBefore__(newelt, elt) except: elt.parentNode().insertBefore__(newelts, elt) | def addItemBefore(self, xml, id): elt = self.findElt(id) if not elt: print "warning: addItemBefore: missing element %s" % id else: newelt = self.createElt(xml) elt.parentNode().insertBefore__(newelt, elt) #print "add item %s before %s" % (newelt.getAttribute_("id"), id) #print xml[0:79] |
self.updateFeed(tab.objID()) | tab.obj.update() | def updateCurrentFeed(self): for tab in controller.selection.getSelectedTabs(): if tab.isFeed(): self.updateFeed(tab.objID()) |
childIds = [i.getID() for i in selected if i.isDownloaded()] | childIDs = [i.getID() for i in selected if i.isDownloaded()] | def addToNewPlaylist(self): selected = controller.selection.getSelectedItems() childIds = [i.getID() for i in selected if i.isDownloaded()] playlist.createNewPlaylist(childIDs) |
control.remove('victim') | control.removeElement('victim') | def onLoadCallback(getControl, url): control = getControl() print "onLoad for %s (control is %s)" % (url, control) if url == "test:remove": print "before remove" control.remove('victim') print "after remove" return True |
self.itemListSelection.clearSelection() self.updateMenus() | def displayCurrentTabContent(self): frame = app.controller.frame mainDisplay = frame.getDisplay(frame.mainDisplay) | |
mainDisplay.reInit([], {'id': tab.obj.getID()}) return | if tab.contentsTemplate == 'channel': newId = int(tab.obj.getID()) self.itemListSelection.clearSelection() self.updateMenus() mainDisplay.reInit(id = newId) return | def displayCurrentTabContent(self): frame = app.controller.frame mainDisplay = frame.getDisplay(frame.mainDisplay) |
description = """Are you sure you want to remove the channel \'%s\'? \ This will delete all videos and cancel any downloads contained in it. This \ operation cannot be undone.""" % obj.getTitle() | description = """\ Are you sure you want to remove the %s channel? This will delete the video \ list and cancel any downloads on this channel. You must resubscribe to this \ channel to get these videos back""" % obj.getTitle() | def removeFeed(self, feed): try: obj = db.getObjectByID(int(feed)) except: print "DTV: Warning: tried to remove feed that doesn't exist with id %d" % int(feed) return title = 'Remove Channel' description = """Are you sure you want to remove the channel \'%s\'? \ |
_appDataDirectory = _getRegString(key, 'AppData') | try: _appDataDirectory = _getRegString(key, 'AppData') except: keyName2 = r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders' key2 = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, keyName2) _appDataDirectory = _getRegString(key2, 'AppData') | def _findDirectories(): global _appDataDirectory global _baseMoviesDirectory keyName = r'Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders' key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, keyName) _appDataDirectory = _getRegString(key, 'AppData') try: _baseMoviesDirectory = _getRegString(key, 'My... |
if not self.idExists(): | if not self.ufeed.idExists(): | def feedparser_errback (self, e): if not self.idExists(): return print "Error updating feed: %s: %s" % (self.url, e) self.updating = False self.ufeed.signalChange() self.scheduleUpdateEvents(-1) |
if not self.idExists(): | if not self.ufeed.idExists(): | def feedparser_callback (self, parsed): if not self.idExists(): return self.ufeed.confirmDBThread() start = clock() self.updateUsingParsed(parsed) self.feedparser_finished() end = clock() if end - start > 0.1: print "WARNING: feed update for: %s too slow (%.3f secs)" % (self.url, end - start) |
if not self.idExists(): | if not self.ufeed.idExists(): | def _updateErrback(self, error): if not self.idExists(): return print "WARNING: error in Feed.update for %s -- %s" % (self.ufeed, error) if not self.idExists(): return self.scheduleUpdateEvents(-1) self.updating = False self.ufeed.signalChange(needsSave=False) |
if not self.idExists(): return | def _updateErrback(self, error): if not self.idExists(): return print "WARNING: error in Feed.update for %s -- %s" % (self.ufeed, error) if not self.idExists(): return self.scheduleUpdateEvents(-1) self.updating = False self.ufeed.signalChange(needsSave=False) | |
if not self.idExists(): | if not self.ufeed.idExists(): | def _updateCallback(self,info): if not self.idExists(): return if info['status'] == 304: self.scheduleUpdateEvents(-1) self.updating = False self.ufeed.signalChange() return html = info['body'] if info.has_key('charset'): html = fixXMLHeader(html,info['charset']) self.url = info['updated-url'] if info.has_key('etag'): ... |
if not self.idExists(): | if not self.ufeed.idExists(): | def callback(info): if not self.idExists(): return self.downloads.discard(download) try: self.processDownloadedHTML(info, urlList, depth,linkNumber, top) finally: self.checkDone() |
if not self.idExists(): | if not self.ufeed.idExists(): | def errback(error): if not self.idExists(): return self.downloads.discard(download) print "WARNING unhandled error for ScraperFeedImpl.getHTML: ", error self.checkDone() |
return self.downloader.getTotalSize() != -1 | if self.downloader is None: return False else: return self.downloader.getTotalSize() != -1 | def gotContentLength(self): return self.downloader.getTotalSize() != -1 |
alert = NSAlert.alloc().init() alert.setAlertStyle_(NSCriticalAlertStyle) alert.setMessageText_('Unsupported version of Quicktime') alert.setInformativeText_('To run DTV you need the most recent version of Quicktime, which is a free update.') button1 = alert.addButtonWithTitle_('Quit') button1.setTag_(NSAlertFirstButt... | summary = u'Unsupported version of Quicktime' message = u'To run DTV you need the most recent version of Quicktime, which is a free update.' buttons = ('Quit', 'Download Quicktime now') quit = showCriticalDialog(summary, message, buttons) if quit: | def checkQuicktimeVersion(self, showError): supported = gestalt('qtim') >= 0x07000000 if not supported and showError: alert = NSAlert.alloc().init() alert.setAlertStyle_(NSCriticalAlertStyle) alert.setMessageText_('Unsupported version of Quicktime') alert.setInformativeText_('To run DTV you need the most recent versio... |
elif result == NSAlertSecondButtonReturn: | else: | def checkQuicktimeVersion(self, showError): supported = gestalt('qtim') >= 0x07000000 if not supported and showError: alert = NSAlert.alloc().init() alert.setAlertStyle_(NSCriticalAlertStyle) alert.setMessageText_('Unsupported version of Quicktime') alert.setInformativeText_('To run DTV you need the most recent versio... |
alert = NSAlert.alloc().init() alert.setAlertStyle_(NSInformationalAlertStyle) alert.setMessageText_(u'Help for DTV will be available soon.') alert.setInformativeText_(u'In the meantime, please visit our homepage for our help FAQ: http://participatoryculture.org/\n\nFor individual user support, please e-mail feedback@p... | summary = u'Help for DTV will be available soon.' message = u'In the meantime, please visit our homepage for our help FAQ: http://participatoryculture.org/\n\nFor individual user support, please e-mail feedback@ppolitics.org.' showInformationalDialog(summary, message) | def showHelp_(self, sender): alert = NSAlert.alloc().init() alert.setAlertStyle_(NSInformationalAlertStyle) alert.setMessageText_(u'Help for DTV will be available soon.') alert.setInformativeText_(u'In the meantime, please visit our homepage for our help FAQ: http://participatoryculture.org/\n\nFor individual user supp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.