rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
title = "Non-Standard Channel" message = "%s is not a DTV-style channel. DTV can try to subscribe, but videos may lack proper descriptions and thumbnails.\n\nPlease notify the publisher if you want this channel to be fully supported" % url defaultButtonTitle = "Subscribe" altButtonTitle = "Cancel" return QuestionContro... | summary = u'Non-Standard Channel' message = u'%s is not a DTV-style channel. DTV can try to subscribe, but videos may lack proper descriptions and thumbnails.\nPlease notify the publisher if you want this channel to be fully supported\n\nContinue ?' % url buttons = (u'Subscribe', u'Cancel') return showWarningDialog(sum... | def isScrapeAllowed(self, url): """Tell the user that URL wasn't a valid feed and ask if it should be scraped for links instead. Returns True if the user gives permission, or False if not.""" # This message could use some serious work. title = "Non-Standard Channel" message = "%s is not a DTV-style channel. DTV can try... |
title = "DTV Version Alert" message = "A new version of DTV is available.\n\nWould you like to download it now?" if QuestionController.alloc().init(title, message).getAnswer(): | summary = u'DTV Version Alert' message = u'A new version of DTV is available.\n\nWould you like to download it now?' download = showInformationalDialog(summary, message) if download: | def updateAvailable(self, url): """Tell the user that an update is available and ask them if they'd like to download it now""" title = "DTV Version Alert" message = "A new version of DTV is available.\n\nWould you like to download it now?" if QuestionController.alloc().init(title, message).getAnswer(): self.openExterna... |
pool = NSAutoreleasePool.alloc().init() alert = NSAlert.alloc().init() alert.setAlertStyle_(NSInformationalAlertStyle) alert.setMessageText_(u'DTV is up to date') alert.setInformativeText_(u'No updates are available. Please try again later.') alert.runModal() del alert del pool | summary = u'DTV is up to date' message = u'No updates are available. Please try again later.' showInformationalDialog(summary, message) | def dtvIsUpToDate(self): pool = NSAutoreleasePool.alloc().init() alert = NSAlert.alloc().init() alert.setAlertStyle_(NSInformationalAlertStyle) alert.setMessageText_(u'DTV is up to date') alert.setInformativeText_(u'No updates are available. Please try again later.') alert.runModal() del alert del pool |
pool = NSAutoreleasePool.alloc().init() alert = NSAlert.alloc().init() alert.setAlertStyle_(NSCriticalAlertStyle) alert.setMessageText_(u'Remove Channel') alert.setInformativeText_(u'Are you sure you want to remove this channel? This operation cannot be undone.') alert.addButtonWithTitle_(u'Remove') alert.addButtonWith... | summary = u'Remove Channel' message = u'Are you sure you want to remove this channel? This operation cannot be undone.' buttons = (u'Remove', u'Cancel') return showCriticalDialog(summary, message, buttons) | def validateFeedRemoval(self, feedURL): pool = NSAutoreleasePool.alloc().init() alert = NSAlert.alloc().init() alert.setAlertStyle_(NSCriticalAlertStyle) alert.setMessageText_(u'Remove Channel') alert.setInformativeText_(u'Are you sure you want to remove this channel? This operation cannot be undone.') alert.addButtonW... |
class QuestionController (NibClassBuilder.AutoBaseClass): def init(self, title, message, defaultButtonTitle="Yes", altButtonTitle="No"): pool = NSAutoreleasePool.alloc().init() NSBundle.loadNibNamed_owner_("QuestionWindow", self) self.window.setTitle_(title) self.textArea.setStringValue_(message) self.defaultButton.s... | def cancelEntry_(self, sender): self.condition.acquire() self.result = None self.window.close() self.condition.notify() self.condition.release() | |
self.fullscreenController = FullScreenVideoController.alloc().initWithPreviousVideoView_(self.videoView) self.fullscreenController.setDelegate_(self) | self.fullscreenController = FullScreenVideoController(self.videoView) self.fullscreenController.setDelegate(self) | def goFullscreen_(self, sender): self.fullscreenController = FullScreenVideoController.alloc().initWithPreviousVideoView_(self.videoView) self.fullscreenController.setDelegate_(self) self.fullscreenController.enterFullScreen() |
self.currentVideoView = self.fullscreenController.videoWindow.movieView | self.currentVideoView = FullScreenVideoController.fsWindow.movieView | def didEnterFullscreenMode(self): self.currentVideoView = self.fullscreenController.videoWindow.movieView FullScreenAlertPanelController.displayIfNeeded() |
class FullScreenVideoController (NSObject): def initWithPreviousVideoView_(self, previousMovieView): self = super(FullScreenVideoController, self).init() self.videoWindow = FullScreenVideoWindow.alloc().init(previousMovieView).retain() self.videoWindow.controller = self self.delegate = nil return self def setDelegate... | class FullScreenVideoController: fsWindow = nil def __init__(self, previousMovieView): self.delegate = None if FullScreenVideoController.fsWindow == nil: FullScreenVideoController.fsWindow = FullScreenVideoWindow.alloc().init().retain() FullScreenVideoController.fsWindow.controller = self FullScreenVideoController.fs... | def handleMovieNotification_(self, notification): info = notification.userInfo() if notification.name() == QTMovieRateDidChangeNotification: rate = info.get(QTMovieRateDidChangeNotificationParameter).floatValue() if rate == 0.0: self.playPauseButton.setImage_(NSImage.imageNamed_('play.png')) self.playPauseButton.setAlt... |
self.videoWindow.makeKeyAndOrderFront_(nil) if self.delegate is not nil and self.delegate.didEnterFullscreenMode: | FullScreenVideoController.fsWindow.makeKeyAndOrderFront_(nil) if self.delegate is not None: | def enterFullScreen(self): SetSystemUIMode(kUIModeAllHidden, 0) self.videoWindow.makeKeyAndOrderFront_(nil) if self.delegate is not nil and self.delegate.didEnterFullscreenMode: self.delegate.didEnterFullscreenMode() |
self.videoWindow.close() | FullScreenVideoController.fsWindow.orderOut_(nil) | def exitFullScreen(self): self.videoWindow.close() SetSystemUIMode(kUIModeNormal, 0) if self.delegate is not nil and self.delegate.didExitFullscreenMode: self.delegate.didExitFullscreenMode() |
if self.delegate is not nil and self.delegate.didExitFullscreenMode: | if self.delegate is not None: | def exitFullScreen(self): self.videoWindow.close() SetSystemUIMode(kUIModeNormal, 0) if self.delegate is not nil and self.delegate.didExitFullscreenMode: self.delegate.didExitFullscreenMode() |
def init(self, previousMovieView): | def init(self): | def init(self, previousMovieView): frame = NSScreen.mainScreen().frame() |
self.previousMovieView = previousMovieView | def init(self, previousMovieView): frame = NSScreen.mainScreen().frame() | |
self.movieView.setMovie_(previousMovieView.movie()) | def init(self, previousMovieView): frame = NSScreen.mainScreen().frame() | |
def close(self): | def makeKeyAndOrderFront_(self, sender): self.movieView.setMovie_(self.previousMovieView.movie()) super(FullScreenVideoWindow, self).makeKeyAndOrderFront_(sender) self.previousMovieWindow.orderOut_(sender) def orderOut_(self, sender): | def close(self): self.previousMovieView.setMovie_(self.movieView.movie()) super(FullScreenVideoWindow, self).close() |
super(FullScreenVideoWindow, self).close() | self.previousMovieWindow.makeKeyAndOrderFront_(sender) self.previousMovieWindow = nil self.previousMovieView = nil super(FullScreenVideoWindow, self).orderOut_(sender) | def close(self): self.previousMovieView.setMovie_(self.movieView.movie()) super(FullScreenVideoWindow, self).close() |
webbrowser.open(url) | if len(url) > 2047: url = url[:2047] try: webbrowser.open(url) except error: traceback.print_exc() | def openExternalURL(self, url): webbrowser.open(url) |
for id in self.currentSelection: obj = self.currentView.getObjectByID(id) | for obj in self.getObjects(): | def clearSelection(self): """Clears the current selection.""" |
for id in self.currentSelection: obj = self.currentView.getObjectByID(id) | for obj in self.getObjects(): | def setObjectsActive(self, newValue): """Iterate through all selected objects and call setActive on them, passing in newValue. """ |
for id in self.currentSelection: obj = self.currentView.getObjectByID(id) | for obj in self.getObjects(): | def getTypesDetailed(self): """Get the type of objects that are selected. |
upstreamLimitKey = prefs.UPSTREAM_LIMIT_IN_KBS.key if pydict is not None and pydict.has_key(upstreamLimitKey): oldval = pydict[upstreamLimitKey] newval = int(oldval) pydict[upstreamLimitKey] = newval | if pydict is not None: for k, v in pydict.iteritems(): if type(v) is objc._pythonify.OC_PythonFloat: pydict[k] = float(v) elif type(v) is objc._pythonify.OC_PythonInt: pydict[k] = int(v) | def load(): domain = getBundleIdentifier() plist = NSUserDefaults.standardUserDefaults().persistentDomainForName_(domain) pydict = Conversion.pythonCollectionFromPropertyList(plist) # A bug in the 'Downloads' preference panel allowed float values to be # used for the upstream limit, which when being pickled would cau... |
0x409: "en", | def getAvailableBytesForMovies(): # TODO: windows implementation moviesDir = config.get(prefs.MOVIES_DIRECTORY) freeSpace = ctypes.c_ulonglong(0) availableSpace = ctypes.c_ulonglong(0) totalSpace = ctypes.c_ulonglong(0) rv = ctypes.windll.kernel32.GetDiskFreeSpaceExW(unicode(moviesDir), ctypes.byref(availableSpace), ct... | |
def _getKey (keyName, subkey, typ): | def _getLocale(): code = ctypes.windll.kernel32.GetUserDefaultUILanguage() | def _getKey (keyName, subkey, typ): try: key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, keyName) (val, t) = _winreg.QueryValueEx(key, subkey) if t == typ: return val except: pass return None |
key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, keyName) (val, t) = _winreg.QueryValueEx(key, subkey) if t == typ: return val except: pass return None def _getLocale(): keyName = r"Software\Policies\Microsoft\Control Panel\Desktop" subkey = "MultiUILanguageID" val = _getKey(keyName, subkey, _winreg.REG_DWORD) if val ... | return _langs[code] except: | def _getKey (keyName, subkey, typ): try: key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, keyName) (val, t) = _winreg.QueryValueEx(key, subkey) if t == typ: return val except: pass return None |
else: return langs[val] | def _getLocale(): keyName = r"Software\Policies\Microsoft\Control Panel\Desktop" subkey = "MultiUILanguageID" val = _getKey(keyName, subkey, _winreg.REG_DWORD) if val is None: keyName = r"Control Panel\Desktop" val = _getKey(keyName, subkey, _winreg.REG_DWORD) if val is None: return None else: return langs[val] | |
indata = ctypes.create_unicode_buffer(val.decode('utf_16')) | indata = ctypes.create_unicode_buffer(val) | def doExpand(val): out = ctypes.create_unicode_buffer(8192) indata = ctypes.create_unicode_buffer(val.decode('utf_16')) bytes = ctypes.windll.kernel32.ExpandEnvironmentStringsW(indata,out,8188) return out.value |
expireTime = datetime.timedelta(days=config.get(config.EXPIRE_AFTER_X_DAYS)) | expireTime = timedelta(days=config.get(config.EXPIRE_AFTER_X_DAYS)) | def getExpirationTime(self): ret = "???" self.beginRead() self.feed.beginRead() try: if self.feed.expire == "never": ret = "never" else: if self.feed.expire == "feed": expireTime = self.feed.expireTime elif self.feed.expire == "system": expireTime = datetime.timedelta(days=config.get(config.EXPIRE_AFTER_X_DAYS)) exp =... |
oldval = pydict[prefs.UPSTREAM_LIMIT_IN_KBS.key] newval = int(oldval) pydict[prefs.UPSTREAM_LIMIT_IN_KBS.key] = newval | upstreamLimitKey = prefs.UPSTREAM_LIMIT_IN_KBS.key if pydict.has_key(upstreamLimitKey): oldval = pydict[upstreamLimitKey] newval = int(oldval) pydict[upstreamLimitKey] = newval | def load(): domain = getBundleIdentifier() plist = NSUserDefaults.standardUserDefaults().persistentDomainForName_(domain) pydict = Conversion.pythonCollectionFromPropertyList(plist) # A bug in the 'Downloads' preference panel allowed float values to be # used for the upstream limit, which when being pickled would cau... |
out = ctypes.create_string_buffer(4096) indata = ctypes.create_string_buffer(val) bytes = ctypes.windll.kernel32.ExpandEnvironmentStringsA(indata,out,4093) | out = ctypes.create_unicode_buffer(8192) indata = ctypes.create_unicode_buffer(val.decode('utf_16')) bytes = ctypes.windll.kernel32.ExpandEnvironmentStringsW(indata,out,8188) | def doExpand(val): out = ctypes.create_string_buffer(4096) indata = ctypes.create_string_buffer(val) bytes = ctypes.windll.kernel32.ExpandEnvironmentStringsA(indata,out,4093) return out.value |
self.renderer = self.getRendererForItem(item) self.renderer.selectPlaylistItem(item, self.volumeSlider.floatValue()) self.videoAreaView.setup(self.renderer) self.progressDisplayer.setup(self.renderer) | renderer = self.getRendererForItem(item) renderer.selectPlaylistItem(item, self.volumeSlider.floatValue()) if renderer != self.renderer: self.videoAreaView.setup(renderer) self.progressDisplayer.setup(renderer) self.renderer = renderer | def selectPlaylistItem(self, item): self.renderer = self.getRendererForItem(item) self.renderer.selectPlaylistItem(item, self.volumeSlider.floatValue()) self.videoAreaView.setup(self.renderer) self.progressDisplayer.setup(self.renderer) |
def setup(self, renderer): | def prepare(self): | def awakeFromNib(self): self.videoWindow = VideoWindow.alloc().initWithFrame_(((0,0),(320,200))) self.hostWindow = nil |
if link['rel'] == 'start': | if link['rel'] == 'start' or link['rel'] == 'self': | def addFeedFromFile(file): d = feedparser.parse(file) if d.feed.has_key('links'): for link in d.feed['links']: if link['rel'] == 'start': Feed(link['href']) return if d.feed.has_key('link'): addFeedFromWebPage(d.feed.link) |
platformutils.warnIfNotOnMainThread('VideoAreaView.exitFullScreen') | def exitFullScreen(self): platformutils.warnIfNotOnMainThread('VideoAreaView.exitFullScreen') if self.videoWindow.isFullScreen: self.window().addChildWindow_ordered_(self.videoWindow, NSWindowAbove) self.window().makeKeyAndOrderFront_(nil) self.videoWindow.exitFullScreen() | |
for obj in database.defaultDatabase: database.defaultDatabase.removeObj(obj) | database.resetDefaultDatabase() | def tearDown(self): # clear out any HTTPAuth objects in there for obj in database.defaultDatabase: database.defaultDatabase.removeObj(obj) EventLoopTest.tearDown(self) |
def enableSecondaryControls(self, enabled): | def enableSecondaryControls(self, enabled, allowFastSeeking=YES): | def enableSecondaryControls(self, enabled): self.backwardButton.setEnabled_(enabled) self.stopButton.setEnabled_(enabled) self.forwardButton.setEnabled_(enabled) |
self.videoDisplay.activeRenderer.setRate(rate) | if self.videoDisplay.activeRenderer is not None: self.videoDisplay.activeRenderer.setRate(rate) | def performSeek(self, sender, direction, seekDelay=0.5): if sender.state() == NSOnState: sender.sendActionOn_(NSLeftMouseUpMask) info = {'seekDirection': direction} if seekDelay > 0.0: self.fastSeekTimer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(seekDelay, self, 'fastSeek:', info, NO) NSRunLoop.... |
self.enableSecondaryControls(YES) | self.enableSecondaryControls(YES, NO) | def handleNonWatchableDisplayNotification_(self, notification): self.enablePrimaryControls(NO) display = notification.object() if hasattr(display, 'templateName') and display.templateName.startswith('external-playback'): self.enableSecondaryControls(YES) |
self.items.append(FileItem(self,file)) | self.items.append(FileItem(self.ufeed,file)) | def update(self): self.ufeed.beginRead() try: if self.updating: return else: self.updating = True finally: self.ufeed.endRead() knownFiles = [] #Files on the filesystem existingFiles = self.getFileList(config.get(config.MOVIES_DIRECTORY)) #Files known about by real feeds for item in app.globalViewList['items']: if not ... |
obj = db.getObjectByID(int(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 | def removeFeed(self, feed): obj = db.getObjectByID(int(feed)) title = 'Remove Channel' description = """Are you sure you want to remove the channel \'%s\'? This operation cannot be undone.""" % obj.getTitle() dialog = dialogs.ChoiceDialog(title, description, dialogs.BUTTON_YES, dialogs.BUTTON_NO) def dialogCallback(dia... |
global selectItemLock selectItemLock.acquire() try: path = item.getFilename() url = util.absolutePathToFileURL(path) return frontend.vlcRenderer.selectURL(url) finally: selectItemLock.release() | path = item.getFilename() url = util.absolutePathToFileURL(path) return frontend.vlcRenderer.selectURL(url) | def selectItem(self, item): # Our current implementation of selectURL crashes if we don't # wrap it in a lock. I'm not sure why... global selectItemLock selectItemLock.acquire() try: path = item.getFilename() url = util.absolutePathToFileURL(path) return frontend.vlcRenderer.selectURL(url) finally: selectItemLock.relea... |
if enclosure.has_key('length'): | if enclosure.has_key('length') and len(enclosure['length']) > 0: | def getEnclosuresSize(self): size = 0 self.beginRead() try: if self.entry.has_key('enclosures'): enclosures = self.entry['enclosures'] for enclosure in enclosures: if enclosure.has_key('length'): size += int(enclosure['length']) finally: self.endRead() return self.sizeFormattedForDisplay(size) |
if enclosure.has_key('type'): | if enclosure.has_key('type') and len(enclosure['type']) > 0: | def getFormat(self, emptyForUnknown=True): format = "n/a" if emptyForUnknown: format = "" self.beginRead() try: if self.entry.has_key('enclosures'): enclosures = self.entry['enclosures'] if len(enclosures) > 0: enclosure = enclosures[0] if enclosure.has_key('type'): type, subtype = enclosure['type'].split('/') if type.... |
print "DTV: Scraping YouTube URL: %s" % url | def _scrapeYouTubeURL(url): print "DTV: Scraping YouTube URL: %s" % url videoIDPattern = re.compile('\?video_id=([^&]+)') paramPattern = re.compile('&t=([^&?]+)') scrapedURL = None try: status = 0 while status != 200: components = list(urlparse.urlsplit(url)) http = httplib.HTTPConnection(components[1]) http.request('H... | |
return xml.sax.saxutils.unescape(url) | try: components = urlparse.urlsplit(url) params = cgi.parse_qs(components[3]) url = unquote_plus(params['videoUrl'][0]) except: print "DTV: WARNING, unable to scrape Google Video URL: %s" % url return url | def _scrapeGoogleVideoURL(url): return xml.sax.saxutils.unescape(url) |
{'pattern': 'http://vp.video.google.com', 'func': _scrapeGoogleVideoURL} | {'pattern': 'http://video.google.com/googleplayer.swf', 'func': _scrapeGoogleVideoURL} | def _scrapeGoogleVideoURL(url): return xml.sax.saxutils.unescape(url) |
if self.getState() != 'finished': msg = "getFilename() called on an unfinished downloader" raise ValueError(msg) | def getFilename(self): if self.getState() != 'finished': msg = "getFilename() called on an unfinished downloader" raise ValueError(msg) self.beginRead() try: return self.status['filename'] finally: self.endRead() | |
print "DTV: *** WARNING *** loading a stale copy of the chanel guide from cache" | print "DTV: *** WARNING *** loading a stale copy of the channel guide from cache" | def getHTML(self): self.cond.acquire() try: # 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 bl... |
p.wait() stderr = p.stderr.read() | stdout, stderr = p.communicate() | def getCommandOutput(cmd, warnOnStderr = True, warnOnReturnCode = True): """Wait for a command and return its output. Check for common errors and raise an exception if one of these occurs. """ p = subprocess.Popen(cmd, shell=True, close_fds = True, stdout=subprocess.PIPE, stderr = subprocess.PIPE) p.wait() stderr = p... |
return p.stdout.read() | return stdout | def getCommandOutput(cmd, warnOnStderr = True, warnOnReturnCode = True): """Wait for a command and return its output. Check for common errors and raise an exception if one of these occurs. """ p = subprocess.Popen(cmd, shell=True, close_fds = True, stdout=subprocess.PIPE, stderr = subprocess.PIPE) p.wait() stderr = p... |
"gtk+-2.0 glib-2.0 pygtk-2.0 mozilla-gtkmozembed mozilla-xpcom") mozilla_lib_path = parsePkgConfig('pkg-config', 'mozilla-gtkmozembed')['library_dirs'] | "gtk+-2.0 glib-2.0 pygtk-2.0 %s %s" % (gtkmozembed, xpcom)) mozilla_lib_path = parsePkgConfig('pkg-config', '%s' % gtkmozembed)['library_dirs'] for dir in mozilla_browser_options['include_dirs']: if os.path.exists(os.path.join(dir, 'dom', 'nsIDOMElementCSSInlineStyle.h')): mozilla_browser_options['include_dirs'].app... | def parsePkgConfig(command, components, options_dict = None): """Helper function to parse compiler/linker arguments from pkg-config/mozilla-config and update include_dirs, library_dirs, etc. We return a dict with the following keys, which match up with keyword arguments to the setup function: include_dirs, library_dir... |
elt.parentNode().insertBefore__(self.createElt(xml), elt) | newelt = self.createElt(xml) elt.parentNode().insertBefore__(newelt, elt) | def addItemBefore(self, xml, id): elt = self.findElt(id) if not elt: print "warning: addItemBefore: missing element %s" % id else: elt.parentNode().insertBefore__(self.createElt(xml), elt) #print "add item %s before %s" % (elt.getAttribute_("id"), id) |
assert False, "Invalid guide load mode '%s'" % mode | raise StandardError("DTV: Invalid guide load mode '%s'" % mode) | def goToGuide(self): guide = getSingletonDDBObject(views.guide) # Does the Guide want to implement itself as a redirection to # a URL? (mode, location) = guide.getLocation() |
return (self.getState() in ('newly-downloaded', 'expiring') and self.getExpirationTime() is not None) | return self.isDownloaded() or (self.getFeedURL() == 'dtv:manualFeed' and self.getState() != 'downloading') | def showSaveButton(self): return (self.getState() in ('newly-downloaded', 'expiring') and self.getExpirationTime() is not None) |
return subtype.upper() | return subtype.split(';')[0].upper() | def getFormat(self, emptyForUnknown=True): try: enclosure = self.entry['enclosures'][0] if enclosure.has_key('type') and len(enclosure['type']) > 0: type, subtype = enclosure['type'].split('/') if type.lower() in self.KNOWN_MIME_TYPES: return subtype.upper() else: extension = enclosure['url'].split('.')[-1].lower() if ... |
nc.addObserver_selector_name_object_(self, 'handleWindowNotifications:', NSWindowDidMoveNotification, self.window()) def teardown(self): platformutils.warnIfNotOnMainThread('VideoAreaView.teardown') nc.removeObserver_name_object_(self, NSWindowDidMoveNotification, nil) if self.videoWindow.isFullScreen: self.videoWindo... | def setup(self, item, renderer): if not self.videoWindow.isFullScreen: self.adjustVideoWindowFrame() self.videoWindow.setup(renderer, item) self.activateVideoWindow() | |
def teardown(self): platformutils.warnIfNotOnMainThread('VideoAreaView.teardown') if self.videoWindow.isFullScreen: self.videoWindow.exitFullScreen() self.window().removeChildWindow_(self.videoWindow) self.videoWindow.orderOut_(nil) self.videoWindow.teardown() | def teardown(self): platformutils.warnIfNotOnMainThread('VideoAreaView.teardown') if self.videoWindow.isFullScreen: self.videoWindow.exitFullScreen() self.window().removeChildWindow_(self.videoWindow) self.videoWindow.orderOut_(nil) self.videoWindow.teardown() | |
'recentItems': (lambda x, y: isinstance(x,item.Item) and x.getState() == 'finished' and x.getDownloadedTime()+config.get('DefaultTimeUntilExpiration')>datetime.datetime.now() and (str(y).lower() in x.getTitle().lower() or str(y).lower() in x.getDescription().lower())), 'oldItems': (lambda x, y: isinstance(x,item.Item)... | 'recentItems': (lambda x, y: isinstance(x,item.Item) and (x.getState() == 'finished' or x.getState() == 'uploading' or x.getState() == 'watched') and (str(y).lower() in x.getTitle().lower() or str(y).lower() in x.getDescription().lower())), 'oldItems': (lambda x, y: isinstance(x,item.Item) and (x.getState() == 'finish... | def filterHasKey(obj,parameter): try: obj[parameter] except KeyError: return False return True |
manualFeed = app.getSingletonDDBObject(views.manualFeed) manualFeed.beginRead() | views.items.beginRead() | def addVideo(path): manualFeed = app.getSingletonDDBObject(views.manualFeed) manualFeed.beginRead() try: for i in manualFeed.items: if i.getFilename() == os.path.abspath(path): print "Not adding duplicate video: %s" % path commandLineVideoIds.add(i.getID()) return finally: manualFeed.endRead() fileItem = item.FileItem(... |
for i in manualFeed.items: | for i in views.items: | def addVideo(path): manualFeed = app.getSingletonDDBObject(views.manualFeed) manualFeed.beginRead() try: for i in manualFeed.items: if i.getFilename() == os.path.abspath(path): print "Not adding duplicate video: %s" % path commandLineVideoIds.add(i.getID()) return finally: manualFeed.endRead() fileItem = item.FileItem(... |
manualFeed.endRead() | views.items.endRead() manualFeed = app.getSingletonDDBObject(views.manualFeed) | def addVideo(path): manualFeed = app.getSingletonDDBObject(views.manualFeed) manualFeed.beginRead() try: for i in manualFeed.items: if i.getFilename() == os.path.abspath(path): print "Not adding duplicate video: %s" % path commandLineVideoIds.add(i.getID()) return finally: manualFeed.endRead() fileItem = item.FileItem(... |
parent.setInnerHTML_(xml) elt = parent.firstChild() | if len(xml) == 0: parent.setInnerHTML_("<div style='height: 1px;'/>") else: parent.setInnerHTML_(xml) | def createElt(self, xml): parent = self.view.mainFrame().DOMDocument().createElement_("div") parent.setInnerHTML_(xml) elt = parent.firstChild() #FIXME: This is a bit of a hack. Since, we only deal with # multiple elements on initialFillIn, it should be fine for now if parent.childNodes().length() > 1: eltlist = [] for... |
return elt | else: return parent.firstChild() | def createElt(self, xml): parent = self.view.mainFrame().DOMDocument().createElement_("div") parent.setInnerHTML_(xml) elt = parent.firstChild() #FIXME: This is a bit of a hack. Since, we only deal with # multiple elements on initialFillIn, it should be fine for now if parent.childNodes().length() > 1: eltlist = [] for... |
elt.insertBefore__(self.createElt(xml), None) | def addItemAtEnd(self, xml, id): elt = self.findElt(id) if not elt: print "warning: addItemAtEnd: missing element %s" % id else: elt.insertBefore__(self.createElt(xml), None) #print "add item %s at end of %s" % (elt.getAttribute_("id"), id) #print xml[0:79] | |
elt.setOuterHTML_(xml) | def changeItem(self, id, xml): elt = self.findElt(id) if not elt: print "warning: changeItem: missing element %s" % id else: elt.setOuterHTML_(xml) #print "change item %s (new id %s)" % (id, elt.getAttribute_("id")) #print xml[0:79] #if id != elt.getAttribute_("id"): # raise Exception #elt = self.findElt(id) #if not... | |
app.controller.selectTabByTemplateBase('downloadtab') | app.controller.selection.selectTabByTemplateBase('downloadtab') | def addTorrent(self, path): try: infoHash = singleclick.getTorrentInfoHash(path) except: print "WARNING: %s doesn't seem to be a torrent file" % path else: singleclick.addTorrent(path, infoHash) app.controller.selectTabByTemplateBase('downloadtab') |
app.controller.selectTabByTemplateBase('librarytab') | app.controller.selection.selectTabByTemplateBase('librarytab') | def addVideo(self, path): singleclick.addVideo(path) app.controller.selectTabByTemplateBase('librarytab') |
self.assertEqual(self.domHandle.callList[1]['name'],'changeItem') self.assertEqual(self.domHandle.callList[1]['id'],match[0]) | self.assertEqual(self.domHandle.callList[1]['name'],'changeItems') self.assertEqual(self.domHandle.callList[1]['pairs'][0][0],match[0]) | def testUpdate(self): (tch, handle) = fillTemplate("unittest/update",self.domHandle,'gtk-x11-MozillaBrowser','platform') text = tch.read() text = HTMLPattern.match(text).group(1) self.assert_(self.updatePattern.match(text)) #span for template inserted id = self.updatePattern.match(text).group(1) handle.initialFillIn() ... |
self.assertEqual(self.domHandle.callList[2]['name'],'changeItem') self.assertEqual(self.domHandle.callList[2]['id'],match[0]) | self.assertEqual(self.domHandle.callList[2]['name'],'changeItems') self.assertEqual(self.domHandle.callList[2]['pairs'][0][0],match[0]) | def testUpdate(self): (tch, handle) = fillTemplate("unittest/update",self.domHandle,'gtk-x11-MozillaBrowser','platform') text = tch.read() text = HTMLPattern.match(text).group(1) self.assert_(self.updatePattern.match(text)) #span for template inserted id = self.updatePattern.match(text).group(1) handle.initialFillIn() ... |
self.assertEqual(self.domHandle.callList[3]['name'],'changeItem') self.assertEqual(self.domHandle.callList[3]['id'],match[0]) | self.assertEqual(self.domHandle.callList[3]['name'],'changeItems') self.assertEqual(self.domHandle.callList[3]['pairs'][0][0],match[0]) | def testUpdate(self): (tch, handle) = fillTemplate("unittest/update",self.domHandle,'gtk-x11-MozillaBrowser','platform') text = tch.read() text = HTMLPattern.match(text).group(1) self.assert_(self.updatePattern.match(text)) #span for template inserted id = self.updatePattern.match(text).group(1) handle.initialFillIn() ... |
return None | return (None, url, redirURL) | def getHTML(self, url): |
self.inenclosure = 1 | self.inenclosure += 1 | def _start_enclosure(self, attrsD): self.inenclosure = 1 attrsD = self._itsAnHrefDamnIt(attrsD) self._getContext().setdefault('enclosures', []).append(FeedParserDict(attrsD)) href = attrsD.get('href') if href: context = self._getContext() if not context.get('id'): context['id'] = href |
self.inenclosure = 0 | self.inenclosure -= 1 | def _end_enclosure(self): self.inenclosure = 0 |
print "whee! entering site main, %s" % sys.path | def main(): print "whee! entering site main, %s" % sys.path abs__file__() paths_in_sys = removeduppaths() setquit() setcopyright() sethelper() aliasmbcs() setencoding() execsitecustomize() # Remove sys.setdefaultencoding() so that users cannot change the # encoding after initialization. The test for presence is needed... | |
print "leaving site main, %s" % sys.path | def main(): print "whee! entering site main, %s" % sys.path abs__file__() paths_in_sys = removeduppaths() setquit() setcopyright() sethelper() aliasmbcs() setencoding() execsitecustomize() # Remove sys.setdefaultencoding() so that users cannot change the # encoding after initialization. The test for presence is needed... | |
return app.TemplateDisplay(templateName, frameHint=frame, | return app.TemplateDisplay(templateName,'default', frameHint=frame, | def _chooseDisplayForCurrentTab(self): tls = self.tabListSelection frame = app.controller.frame |
if self.watchedTime is None or not self.isDownloaded(): | if self.getWatchedTime() is None or not self.isDownloaded(): | def getExpirationTime(self): """Get the time when this item will expire. Returns a datetime object, or None if it doesn't expire. """ |
return self.watchedTime + expireTime | return self.getWatchedTime() + expireTime def getWatchedTime(self): if not self.getSeen(): return None if self.isContainerItem and self.watchedTime == None: self.watchedTime = datetime.min children = views.items.filterWithIndex(indexes.itemsByParent, self.id) for item in children: childTime = item.getWatchedTime() if ... | def getExpirationTime(self): """Get the time when this item will expire. Returns a datetime object, or None if it doesn't expire. """ |
if (not self.seen) or (not self.isDownloaded()): return False ufeed = self.getFeed() if ufeed.expire == 'never' or (ufeed.expire == 'system' and config.get(prefs.EXPIRE_AFTER_X_DAYS) <= 0): return False else: return True | 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.expiring | def getExpiring(self): if (not self.seen) or (not self.isDownloaded()): return False ufeed = self.getFeed() if ufeed.expire == 'never' or (ufeed.expire == 'system' and config.get(prefs.EXPIRE_AFTER_X_DAYS) <= 0): return False else: return True |
return 'saved' | if self.parent_id and self.getParent().getExpiring(): return 'expiring' else: return 'saved' def getExpiring(self): return False | 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... |
os.system("python setup_daemon.py py2app --dist-dir .") | os.system("python setup_daemon.py py2app --dist-dir . --bdist-base ./build-daemon") | def updatePListEntry(plist, key, conf): entry = plist[key] plist[key] = string.Template(entry).safe_substitute(conf) |
if not linkDict.has_key(link[0]): linkDict[link[0]] = {} | if not linkDict.has_key(toUTF8Bytes(link[0],charset)): linkDict[toUTF8Bytes(link[0])] = {} | def scrapeLinks(self,html,baseurl,setTitle = False,charset = None): |
linkDict[link[0]]['title'] = link[1].strip() | linkDict[link[0]]['title'] = toUTF8Bytes(link[1],charset).strip() | def scrapeLinks(self,html,baseurl,setTitle = False,charset = None): |
linkDict[link[0]]['thumbnail'] = link[2] | linkDict[link[0]]['thumbnail'] = toUTF8Bytes(link[2],charset) | def scrapeLinks(self,html,baseurl,setTitle = False,charset = None): |
linkDict = self.scrapeHTMLLinks(html,baseurl,setTitle=setTitle) | linkDict = self.scrapeHTMLLinks(html,baseurl,setTitle=setTitle, charset=charset) | def scrapeLinks(self,html,baseurl,setTitle = False,charset = None): |
def scrapeHTMLLinks(self,html, baseurl,setTitle=False): | def scrapeHTMLLinks(self,html, baseurl,setTitle=False, charset = None): | def scrapeHTMLLinks(self,html, baseurl,setTitle=False): #print "Scraping "+baseurl+" as HTML" |
if not linkDict.has_key(link[0]): linkDict[link[0]] = {} | if not linkDict.has_key(toUTF8Bytes(link[0],charset)): linkDict[toUTF8Bytes(link[0])] = {} | def scrapeHTMLLinks(self,html, baseurl,setTitle=False): #print "Scraping "+baseurl+" as HTML" |
linkDict[link[0]]['title'] = link[1].strip() | linkDict[link[0]]['title'] = toUTF8Bytes(link[1],charset).strip() | def scrapeHTMLLinks(self,html, baseurl,setTitle=False): #print "Scraping "+baseurl+" as HTML" |
linkDict[link[0]]['thumbnail'] = link[2] | linkDict[link[0]]['thumbnail'] = toUTF8Bytes(link[2],charset) | def scrapeHTMLLinks(self,html, baseurl,setTitle=False): #print "Scraping "+baseurl+" as HTML" |
print "removing" | def remove(self): self.dd.beginUpdate() try: print "removing" DDBObject.remove(self) print "updating update interval" self.dd.updateInterval() print "done" finally: self.dd.endUpdate() | |
print "updating update interval" | def remove(self): self.dd.beginUpdate() try: print "removing" DDBObject.remove(self) print "updating update interval" self.dd.updateInterval() print "done" finally: self.dd.endUpdate() | |
print "done" | def remove(self): self.dd.beginUpdate() try: print "removing" DDBObject.remove(self) print "updating update interval" self.dd.updateInterval() print "done" finally: self.dd.endUpdate() | |
if self.parent.domHandler: self.parent.domHandler.changeItem(tid, xmlString) | self.parent.domHandler.changeItem(tid, xmlString) | def onChange(self,obj,id): tid = obj.tid xmlString = self.currentXML(obj) if self.parent.domHandler: self.parent.domHandler.changeItem(tid, xmlString) |
if self.anchorType == 'parentNode': self.parent.domHandler.addItemAtEnd(self.currentXML(obj), self.anchorId) if self.anchorType == 'nextSibling': self.parent.domHandler.addItemBefore(self.currentXML(obj), self.anchorId) | self.toAdd.append(obj) self.addCallback() | def onAdd(self, obj, id): if self.parent.domHandler: next = self.view.getNextID(id) if next == None: # Adding it at the end of the list. Must add it relative to # the anchor. if self.anchorType == 'parentNode': self.parent.domHandler.addItemAtEnd(self.currentXML(obj), self.anchorId) if self.anchorType == 'nextSibling':... |
def onRemove(self, obj, id): if self.parent.domHandler: self.parent.domHandler.removeItem(obj.tid) | def doAdd(self, xml): if self.anchorType == 'parentNode': self.parent.domHandler.addItemAtEnd(xml, self.anchorId) if self.anchorType == 'nextSibling': self.parent.domHandler.addItemBefore(xml, self.anchorId) def onRemove (self, obj, id): if len (self.toAdd) > 0: self.callback() if id in self.toChange: del self.toCha... | def onRemove(self, obj, id): if self.parent.domHandler: self.parent.domHandler.removeItem(obj.tid) |
self.thread.join() | def pause(self): self.beginRead() self.state = "paused" self.endRead() for item in self.itemList: item.beginChange() item.endChange() self.thread.join() | |
self.thread.join() | def stop(self): self.beginRead() self.state = "stopped" self.endRead() for item in self.itemList: item.beginChange() item.endChange() self.thread.join() try: remove(self.filename) except: pass | |
path = item.getFilename() url = util.absolutePathToFileURL(path) return frontend.vlcRenderer.selectURL(url) | global selectItemLock selectItemLock.acquire() try: path = item.getFilename() url = util.absolutePathToFileURL(path) return frontend.vlcRenderer.selectURL(url) finally: selectItemLock.release() | def selectItem(self, item): path = item.getFilename() url = util.absolutePathToFileURL(path) return frontend.vlcRenderer.selectURL(url) |
elif 'close' in self.headers.get('connection', ''): | elif 'close' in self.headers.get('connection', '').lower(): | def decideWillClose(self): if self.shortVersion != 11: # Close all connections to HTTP/1.0 servers. self.willClose = True elif 'close' in self.headers.get('connection', ''): self.willClose = True elif not self.chunked and self.contentLength is None: # if we aren't chunked and didn't get a content length, we have to # a... |
print "normalized: %s -> %s" % (originalURL, 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):/*(.*)$", url) if match is not None: url = "%s://%s" % match.group(1,2) # Replace invalid schemes by http match = re.match(r"^(... | |
if self.currentDisplay is videoDisplay and videoDisplay.isFullScreen: videoDisplay.exitFullScreen() | if self.currentDisplay is videoDisplay: if videoDisplay.isFullScreen: videoDisplay.exitFullScreen() videoDisplay.stop() | def playItem(self, anItem): self.skipIfItemFileIsMissing(anItem) videoDisplay = Controller.instance.videoDisplay if videoDisplay.canPlayItem(anItem): self.playItemInternally(videoDisplay, anItem) else: if self.currentDisplay is videoDisplay and videoDisplay.isFullScreen: videoDisplay.exitFullScreen() self.scheduleExter... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.