rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.parent._updateChildContents(self) | self.parent._updateChildContents() | def revealCreatures(self, cnl): """cnl is a list of creature names""" print "revealCreatures for", self, cnl if ((not cnl) or (superset(getCreatureNames(self.getCertainCreatures()), cnl) and (self.allDescendentsCertain()))): print "no new information, exiting" return |
print " Known creatures not in parent legion" | def _findAllPossibleSplits(self, childSize, knownKeep, knownSplit): """ Return a list of all legal combinations of splitoffs. """ # Sanity checks if len(knownSplit) > childSize: raise RuntimeError, "More known splitoffs than splitoffs" creatures = self.creatures if len(creatures) > 8: raise RuntimeError, "More than 8 c... | |
print "_chooseCreaturesToSplitOut for", self, pos | def _chooseCreaturesToSplitOut(self, pos): """Decide how to split this legion, and return a list of Creatures to remove. Return empty list on error.""" print "_chooseCreaturesToSplitOut for", self, pos maximize = (2 * len(pos[0]) > self.getHeight()) | |
print "split for", self, childSize, otherMarkerId, turn | def split(self, childSize, otherMarkerId, turn=-1): print "split for", self, childSize, otherMarkerId, turn | |
print "certain", certain, "knownKeep", knownKeep, \ "knownSplit", knownSplit | def split(self, childSize, otherMarkerId, turn=-1): print "split for", self, childSize, otherMarkerId, turn | |
print " abort!" return | raise RuntimeError, "certain not superset of knownKeep" | def split(self, childSize, otherMarkerId, turn=-1): print "split for", self, childSize, otherMarkerId, turn |
print "certain", certain, "knownSplit", knownSplit, \ "knownKeep", knownKeep | def split(self, childSize, otherMarkerId, turn=-1): print "split for", self, childSize, otherMarkerId, turn | |
print " abort!" return | raise RuntimeError, "certain not superset of knownSplit" | def split(self, childSize, otherMarkerId, turn=-1): print "split for", self, childSize, otherMarkerId, turn |
self.child1._updateParentContents() self.child2._updateParentContents() print " child1:", self.child1 print " child2:", self.child2 | self.child1._resplitDescendents() self.child2._resplitDescendents() | def split(self, childSize, otherMarkerId, turn=-1): print "split for", self, childSize, otherMarkerId, turn |
print "merge for", self, other | def merge(self, other, turn): """Recombine this legion and other, because it was not possible to move either one. The two legions must share the same parent. If either legion has the parent's markerId, then that legion will remain. Otherwise this legion will remain.""" print "merge for", self, other parent = self.pare... | |
def _updateChildContents(self, child): """Tell this parent legion the updated contents of one of its children.""" print "_updateChildContents for node", self, "child", child assert child in [self.child1, self.child2] self.revealCreatures(getCreatureNames( child.getCertainAtSplitOrRemovedCreatures())) | def _updateChildContents(self): """Tell this parent legion the updated contents of its children.""" names = [] for child in [self.child1, self.child2]: names.extend(getCreatureNames( child.getCertainAtSplitOrRemovedCreatures())) self.revealCreatures(names) | def _updateChildContents(self, child): """Tell this parent legion the updated contents of one of its children.""" print "_updateChildContents for node", self, "child", child assert child in [self.child1, self.child2] self.revealCreatures(getCreatureNames( child.getCertainAtSplitOrRemovedCreatures())) # XXX Resplitting ... |
def _updateParentContents(self): """Tell this child legion the updated known contents of its parent.""" print "_updateParentContents for node", self if self.getSibling().allCertain() and not self.allCertain(): pc = self.parent.getCertainCreatures() sc = self.getSibling().getCertainAtSplitOrRemovedCreatures() print "pc"... | def _resplitDescendents(self): """Recursively resplit all this legion's descendents.""" | def _updateParentContents(self): """Tell this child legion the updated known contents of its parent.""" print "_updateParentContents for node", self if self.getSibling().allCertain() and not self.allCertain(): pc = self.parent.getCertainCreatures() sc = self.getSibling().getCertainAtSplitOrRemovedCreatures() print "pc"... |
print "addCreature", self, ':', creatureName | def addCreature(self, creatureName): print "addCreature", self, ':', creatureName if (self.getHeight() >= 7 and self.child1 is None): raise RuntimeError, "Tried adding to 7-high legion" ci = CreatureInfo(creatureName, True, False) self.creatures.append(ci) | |
print "removeCreature", self, ':', creatureName | def removeCreature(self, creatureName): print "removeCreature", self, ':', creatureName if (self.getHeight() <= 0): raise RuntimeError, "Tried removing from 0-high legion" self.revealCreatures([creatureName]) ci = getCreatureInfo(self.creatures, creatureName) | |
print "removeCreatures", self, ':', creatureNames | def removeCreatures(self, creatureNames): print "removeCreatures", self, ':', creatureNames self.revealCreatures(creatureNames) for name in creatureNames: self.removeCreature(name) | |
ps.printNodes() | def testPredictSplits2(self): print "\ntest 2 begins" | |
turn = 8 | def testPredictSplits5(self): print "\ntest 5 begins" ps = PredictSplits("Gd", "Gd04", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.getLeaf("Gd04").revealCreatures(['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() assert(ps.getLeaf... | |
ps.dumpAsDot("turn%d.dot" % turn) | def testPredictSplits7(self): print "\ntest 7 begins" ps = PredictSplits("Gr", "Gr08", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() | |
ps.printNodes() ps.dumpAsDot("turn%d.dot" % turn) | def testPredictSplits7(self): print "\ntest 7 begins" ps = PredictSplits("Gr", "Gr08", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() | |
ps.printNodes() ps.dumpAsDot("turn%da.dot" % turn) | def testPredictSplits7(self): print "\ntest 7 begins" ps = PredictSplits("Gr", "Gr08", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() | |
ps.dumpAsDot("turn%db.dot" % turn) ps.printNodes() | def testPredictSplits7(self): print "\ntest 7 begins" ps = PredictSplits("Gr", "Gr08", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() | |
ps.printNodes() ps.dumpAsDot("turn%dc.dot" % turn) | ps.printLeaves() | def testPredictSplits7(self): print "\ntest 7 begins" ps = PredictSplits("Gr", "Gr08", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() |
ps.getLeaf("Gr07").revealCreatures(["Troll"]) | ps.getLeaf("Gr07").revealCreatures(["Ogre", "Ogre"]) | def testPredictSplits7(self): print "\ntest 7 begins" ps = PredictSplits("Gr", "Gr08", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() |
ps.dumpAsDot("turn%d.dot" % turn) | assert(not ps.getLeaf("Gr02").allCertain()) | def testPredictSplits7(self): print "\ntest 7 begins" ps = PredictSplits("Gr", "Gr08", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() |
assert(ps.getLeaf("Gr08").allCertain()) | assert(not ps.getLeaf("Gr08").allCertain()) | def testPredictSplits7(self): print "\ntest 7 begins" ps = PredictSplits("Gr", "Gr08", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() |
ps.getLeaf("Gr09").removeCreature(["Ogre", "Ogre"]) | ps.getLeaf("Gr09").removeCreatures(["Ogre", "Ogre"]) ps.getLeaf("Gr08").split(2, "Gr06", turn) | def testPredictSplits7(self): print "\ntest 7 begins" ps = PredictSplits("Gr", "Gr08", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() |
turn = 22 print "Turn", turn ps.printLeaves() turn = 23 print "Turn", turn ps.getLeaf("Gr06").revealCreatures(["Gorgon"]) ps.getLeaf("Gr06").addCreature("Gorgon") ps.getLeaf("Gr07").revealCreatures(["Troll", "Troll"]) ps.getLeaf("Gr07").addCreature("Ranger") ps.printLeaves() turn = 24 print "Turn", turn ps.getLeaf("G... | assert(ps.getLeaf("Gr04").allCertain()) assert(ps.getLeaf("Gr07").allCertain()) assert(ps.getLeaf("Gr08").allCertain()) assert(ps.getLeaf("Gr12").allCertain()) | def testPredictSplits7(self): print "\ntest 7 begins" ps = PredictSplits("Gr", "Gr08", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() |
ps.getLeaf("Gr02").revealCreatures(["Lion", "Centaur", "Centaur"]) | def testPredictSplits7(self): print "\ntest 7 begins" ps = PredictSplits("Gr", "Gr08", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() | |
assert(not ps.getLeaf("Gd11").allCertain()) | assert(ps.getLeaf("Gd11").allCertain()) | def testPredictSplits5(self): print "\ntest 5 begins" ps = PredictSplits("Gd", "Gd04", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.getLeaf("Gd04").revealCreatures(['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() assert(ps.getLeaf... |
print "\ntest 8 ends" | print "\ntest 5 ends" | def testPredictSplits5(self): print "\ntest 5 begins" ps = PredictSplits("Gd", "Gd04", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.getLeaf("Gd04").revealCreatures(['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() assert(ps.getLeaf... |
print "\ntest 9 ends" | print "\ntest 6 ends" | def testPredictSplits6(self): print "\ntest 6 begins" ps = PredictSplits("Gr", "Gr11", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.getLeaf("Gr11").revealCreatures(['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) ps.printLeaves() |
assert(not ps.getLeaf("Gd10").allCertain()) | assert(ps.getLeaf("Gd10").allCertain()) | def testPredictSplits8(self): print "\ntest 8 begins" ps = PredictSplits("Gd", "Gd03", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) |
assert(len(ps.getLeaf("Gd10").getCertainCreatures()) == 1) | def testPredictSplits8(self): print "\ntest 8 begins" ps = PredictSplits("Gd", "Gd03", ['Titan', 'Angel', 'Gargoyle', 'Gargoyle', 'Centaur', 'Centaur', 'Ogre', 'Ogre']) | |
tagname.replace(' ', ' ') | tagname = tagname.replace(' ', ' ') | def get_tags(entry, tagdict): """ Returns a list of tag objects from an entry. """ fcat = [] if entry.has_key('categories'): for tcat in entry.categories: qcat = encode(tcat[1]).strip() if ',' in qcat or '/' in qcat: qcat = qcat.replace(',', '/').split('/') else: qcat = [qcat] for zcat in qcat: tagname = zcat.lower() w... |
qcat = encode(tcat[1]).strip() | qcat = encode(tcat.term).strip() | def get_tags(entry, tagdict): """ Returns a list of tag objects from an entry. """ fcat = [] if entry.has_key('tags'): for tcat in entry.tags: qcat = encode(tcat[1]).strip() if ',' in qcat or '/' in qcat: qcat = qcat.replace(',', '/').split('/') else: qcat = [qcat] for zcat in qcat: tagname = zcat.lower() while ' ' in... |
return tstr.encode('utf-8', "xmlcharrefreplace") | try: return tstr.encode('utf-8', "xmlcharrefreplace") except UnicodeDecodeError: return tstr.decode('utf-8').encode('utf-8') | def encode(tstr): """ Encodes a unicode string in utf-8 """ if not tstr: return '' return tstr.encode('utf-8', "xmlcharrefreplace") |
if entry.has_key('categories'): for tcat in entry.categories: | if entry.has_key('tags'): for tcat in entry.tags: | def get_tags(entry, tagdict): """ Returns a list of tag objects from an entry. """ fcat = [] if entry.has_key('categories'): for tcat in entry.categories: qcat = encode(tcat[1]).strip() if ',' in qcat or '/' in qcat: qcat = qcat.replace(',', '/').split('/') else: qcat = [qcat] for zcat in qcat: tagname = zcat.lower() w... |
help_text=_('If this is disabled, ths feed will not be further updated.') ) | help_text=_('If disabled, this feed will not be further updated.') ) | for tdef in defs: if tdef.id != self.id: tdef.default_site = False tdef.save() |
self._loaded_names = {} | def do_pyload(self, rest): """pyload <filename> Load <filename> by searching first in the same directory as the running script, then by searching in the current working directory. The file should contain a variable named __pbp__ which is a list of the names to make available to the pbp interpreter. """ args = self._ge... | |
return s[:-4] + '...' return '...' + s[4:] | return s[:length-4] + ' ...' return '... ' + s[len(s)-length+4:] | def trunc(s, length, end=1): """Truncate a string s to length length, by cutting off the last (length-4) characters and replacing them with ' ...' With end=0, truncate from the front instead. """ if not s: return '' if len(s) > length: if end: return s[:-4] + '...' return '...' + s[4:] return s |
do_exit = do_quit = do_done = do_EOF | do_EOF = do_exit = do_quit = do_done | def do_done(self, rest): """Quit""" print 'Bye.' sys.exit(0) |
if res == args[0]: | if re.search(args[0], res): | def do_url(self, rest): """url [url] Show the url of the current page or test if it's equal to the argument""" args = self._getCountedArgs("url " + rest, 0, 1) try: res = self.browser.geturl() res.strip() except mechanize.BrowserStateError, e: raise error.PBPScriptError(e) if len(args) == 0: self.tprintln("The current... |
if res == args[0]: | if re.search(args[0], res): | def do_title(self, rest): """title [title] Show the title of the current page or test if it's equal to the argument. Surround multi words titles with single or double quotes (eg. 'my title')""" args = self._getCountedArgs("title " + rest, 0, 1) try: res = self.browser.title() except mechanize.BrowserStateError, e: rais... |
raise PBPUsageError("do " + rest) | raise error.PBPUsageError("do " + rest) | def do_do(self, rest): """do <python_callable> [arguments...] Call Python code loaded with pyload. Arguments will be passed to the callable as function arguments. """ args = shlex_split(rest) try: name = args.pop(0) except IndexError: raise PBPUsageError("do " + rest) ret = self._resolvePyloadedName(name, *args) if re... |
reactor.callFromThread(self.deferred.errback, error.PBPScriptError()) | e = getattr(self, 'last_failure', None) if e is None: e = error.PBPScriptError() reactor.callFromThread(self.deferred.errback, e) | def later(): t.timer = reactor.callLater(self.waiting, self._doneWaiting, t, s) |
if args[1]: | if len(args) > 1: | def do_submit(self, rest): """submit <form>[%submitspec] [stopat] Use the name=value pairs to set the form fields, then submit the form. Otherwise behave like go (see help go for details). If submit is given, use it as an exact string to identify the submit button (by name, type, or id in that order). |
kong32='Mozilla/5.0 (compatible; Konqueror/3.2.3; Linux 2.4.14; X11; i686)', | konq32='Mozilla/5.0 (compatible; Konqueror/3.2.3; Linux 2.4.14; X11; i686)', | def do_agent(self, rest): """agent (ie5|ie55|ie6|moz17|opera7|konq32|aol9|saf11|<your own string>) Change the User-agent header to pretend to be one of the above browsers or any string you want. ie5, moz17 etc. are shortcuts for the full string for that browser. (The shortcuts all pretend to be Windows XP except for ... |
minsLeft=int((sessionLength-lapse)/60) | if schedule=='pr': minsLeft=int((sessionLength-(time.time()-lastActiveLick))/60) else: minsLeft=int((sessionLength-lapse)/60) | def showdata(): minsLeft=int((sessionLength-lapse)/60) #print (sessionLength, lapse, lastActiveLick, minsLeft) mesg("B" + deviceId[-2:]+ "S"+str(sessionID) + " " + RatID[-4:] + " " + str(minsLeft) + "Left\n"+ "a" + str(act)+"i"+str(ina) + "r" + str(rew) + schedule + str(nextratio)) return time.time() |
print ("lapse", lapse) | def showdata(): minsLeft=int((sessionLength-lapse)/60) #print (sessionLength, lapse, lastActiveLick, minsLeft) mesg("B" + deviceId[-2:]+ "S"+str(sessionID) + " " + RatID[-4:] + " " + str(minsLeft) + "Left\n"+ "a" + str(act)+"i"+str(ina) + "r" + str(rew) + schedule + str(nextratio)) return time.time() | |
print ("prlaps", lapse) | def showdata(): minsLeft=int((sessionLength-lapse)/60) #print (sessionLength, lapse, lastActiveLick, minsLeft) mesg("B" + deviceId[-2:]+ "S"+str(sessionID) + " " + RatID[-4:] + " " + str(minsLeft) + "Left\n"+ "a" + str(act)+"i"+str(ina) + "r" + str(rew) + schedule + str(nextratio)) return time.time() | |
'immediate') | 'immediate', 'interactiveCount') | def wrapper(self, *args, **keywords): self.lock.acquire() try: method(self, *args, **keywords) finally: self.lock.release() |
isinstance(cmd, cmds.Pause) or \ isinstance(cmd, self.EndInteractive): | isinstance(cmd, cmds.Pause) or \ (isinstance(cmd, self.EndInteractive) and cmd.count == self.interactiveCount): | def collectCmds(self): """Collect commands.""" events = [] for cmd in self.mainItr: events.append(cmd) if isinstance(cmd, cmds.PlayVobu) or \ isinstance(cmd, cmds.Pause) or \ isinstance(cmd, self.EndInteractive): return events |
interactive operation.""" __slots__ = () | interactive operation. It carries the serial count of interactive operations stored in the pipeline.""" __slots__ = ('count') | def vobuHeader(self, src, buf): """The signal handler for the source's vobu-header signal.""" # Release the lock set by the playVobu operation. self.lock.release() |
def op(): | def interactiveWrapper(count): | def op(): """Call the iterator and send an `EndInteractive` operation at the end.""" yield itersched.Call(itr) yield self.EndInteractive() |
yield self.EndInteractive() self.machine.callIterator(op()) | end = self.EndInteractive() end.count = count yield end self.interactiveCount += 1 self.machine.callIterator(interactiveWrapper(self.interactiveCount)) | def op(): """Call the iterator and send an `EndInteractive` operation at the end.""" yield itersched.Call(itr) yield self.EndInteractive() |
if (self.cell.blockMode == \ dvdread.CELL_BLOCK_MODE_ANGLE_FIRST or \ self.cell.blockMode == \ dvdread.CELL_BLOCK_MODE_ANGLE_MIDDLE): cellNr += 1 nextMode = self.programChain.getCell(cellNr).blockMode while nextMode != dvdread.CELL_BLOCK_MODE_ANGLE_LAST: | if self.cell.blockMode == \ dvdread.CELL_BLOCK_MODE_ANGLE_FIRST or \ self.cell.blockMode == \ dvdread.CELL_BLOCK_MODE_ANGLE_MIDDLE: | def linkCell(self, cellNr, sectorNr=None): """Link to the specified cell. |
cellNr += 1 | while nextMode != dvdread.CELL_BLOCK_MODE_ANGLE_LAST: cellNr += 1 nextMode = self.programChain.getCell(cellNr).blockMode cellNr += 1 | def linkCell(self, cellNr, sectorNr=None): """Link to the specified cell. |
self.audio = 0 self.subpicture = 0x3e | self.audio = 0 self.subpicture = 0 | def __init__(self, info): self.info = info |
self.makeSubelem('queue', 'subtitle-queue') | def __init__(self, options, name='videodec'): | |
self.linkPads('subtitle-queue', 'src', 'mpeg2subt', 'subtitle') | def __init__(self, options, name='videodec'): | |
self.ghostify('subtitle-queue', 'sink', 'subtitle') | self.ghostify('mpeg2subt', 'subtitle', 'subtitle') | def __init__(self, options, name='videodec'): |
def __init__(self, name, pipelineSpec): gst.Bin.__init__(self, name) elem = gst.parse_launch(pipelineSpec) if isinstance(elem, gst.Bin): for subelem in elem.get_list(): elem.remove(subelem) self.add(subelem) else: self.add(elem) | def makeSubelem(self, type, name=None, **keywords): if name == None: name = type subelem = gst.element_factory_make(type, name) for (prop, value) in keywords.items(): subelem.set_property(prop, value) self.add(subelem) return subelem | def __init__(self, name, pipelineSpec): gst.Bin.__init__(self, name) |
self.add_ghost_pad(self.get_by_name(elemName).get_pad(padName), ghostName) class SoftwareAudio(ParsedBin): | self.add_pad(gst.GhostPad(ghostName, self.get_by_name(elemName).get_pad(padName))) def link(self, elemName1, elemName2): elem1 = self.get_by_name(elemName1) elem2 = self.get_by_name(elemName2) elem1.link(elem2) def linkPads(self, elemName1, padName1, elemName2, padName2): elem1 = self.get_by_name(elemName1) elem2 = ... | def ghostify(self, elemName, padName, ghostName=None): if not ghostName: ghostName = padName self.add_ghost_pad(self.get_by_name(elemName).get_pad(padName), ghostName) |
super(SoftwareAudio, self).__init__(name, """ ( capsselect name=capsselect ! seamless-a52dec ! audioconvert ! audioscale ! capsaggreg name=capsaggreg ! seamless-queue name=audioqueue ! { %(audioSink)s name=audiosink } capsselect.src%%d ! dvdlpcmdec ! audioconvert ! audioscale ! capsaggreg.sink%%d capsselect.src%%d ! ... | super(SoftwareAudio, self).__init__(name) self.makeSubelem('a52dec') self.makeSubelem('audioconvert') self.makeSubelem('queue') self.makeSubelem(options['audioSink'], 'audiosink') self.link('a52dec', 'audioconvert') self.link('audioconvert', 'queue') self.link('queue', 'audiosink') self.ghostify('a52dec', 'sink') ... | def __init__(self, options, name='audiodec'): super(SoftwareAudio, self).__init__(name, """ ( capsselect name=capsselect ! seamless-a52dec ! audioconvert ! audioscale ! capsaggreg name=capsaggreg ! seamless-queue name=audioqueue ! { %(audioSink)s name=audiosink } |
super(SpdifAudio, self).__init__(name, """ ( capsselect name=capsselect ! ac3iec958 ! capsaggreg name=capsaggreg ! seamless-queue max-size-bytes=40000 ! { alsasink name=audiosink } capsselect.src%d ! dvdlpcmdec ! audioconvert ! audioscale ! capsaggreg.sink%d capsselect.src%d ! dtsdec ! audioconvert ! audioscale ! cap... | super(SpdifAudio, self).__init__(name, """( fakesink name=capselect )""") | def __init__(self, options, name='audiodec'): super(SpdifAudio, self).__init__(name, """ ( capsselect name=capsselect ! ac3iec958 ! capsaggreg name=capsaggreg ! seamless-queue max-size-bytes=40000 ! { alsasink name=audiosink } |
audioElem.set_property('device', 'spdif:{AES0 0x0 AES1 0x82 AES2 0x0 AES3 0x2 CARD %(spdifCard)s}' % options) | def __init__(self, options, name='audiodec'): super(SpdifAudio, self).__init__(name, """ ( capsselect name=capsselect ! ac3iec958 ! capsaggreg name=capsaggreg ! seamless-queue max-size-bytes=40000 ! { alsasink name=audiosink } | |
self.clock = audioElem.get_clock() def getClock(self): return self.clock class SoftwareVideo(ParsedBin): | class SoftwareVideo(Bin): | def __init__(self, options, name='audiodec'): super(SpdifAudio, self).__init__(name, """ ( capsselect name=capsselect ! ac3iec958 ! capsaggreg name=capsaggreg ! seamless-queue max-size-bytes=40000 ! { alsasink name=audiosink } |
super(SoftwareVideo, self).__init__(name, """ ( mpeg2dec name=mpeg2dec ! { seamless-queue ! .video seamless-mpeg2subt name=mpeg2subt ! ffmpegcolorspace ! videoscale ! seamless-queue max-size-buffers=3 name=videoqueue ! { %(videoSink)s name=videosink } seamless-queue name=subtitle ! mpeg2subt.subtitle } ) """ % options... | super(SoftwareVideo, self).__init__(name) self.makeSubelem('mpeg2dec') self.makeSubelem('ffmpegcolorspace') self.makeSubelem('videoscale') self.makeSubelem('queue') self.makeSubelem(options['videoSink'], 'videosink') self.link('mpeg2dec', 'ffmpegcolorspace') self.link('ffmpegcolorspace', 'videoscale') self.link('vide... | def __init__(self, options, name='videodec'): super(SoftwareVideo, self).__init__(name, """ ( mpeg2dec name=mpeg2dec ! { seamless-queue ! .video seamless-mpeg2subt name=mpeg2subt ! ffmpegcolorspace ! videoscale ! seamless-queue max-size-buffers=3 name=videoqueue ! { %(videoSink)s name=videosink } |
self.ghostify('subtitle', 'sink', 'subtitle') class BackPlayer(ParsedBin): | class BackPlayer(Bin): | def __init__(self, options, name='videodec'): super(SoftwareVideo, self).__init__(name, """ ( mpeg2dec name=mpeg2dec ! { seamless-queue ! .video seamless-mpeg2subt name=mpeg2subt ! ffmpegcolorspace ! videoscale ! seamless-queue max-size-buffers=3 name=videoqueue ! { %(videoSink)s name=videosink } |
elemens.""" | elements.""" | def __init__(self, options, name='videodec'): super(SoftwareVideo, self).__init__(name, """ ( mpeg2dec name=mpeg2dec ! { seamless-queue ! .video seamless-mpeg2subt name=mpeg2subt ! ffmpegcolorspace ! videoscale ! seamless-queue max-size-buffers=3 name=videoqueue ! { %(videoSink)s name=videosink } |
super(BackPlayer, self).__init__(name, """ ( dvdblocksrc name=dvdblocksrc location=%(location)s ! seamless-dvddemux name=dvddemux ) """ % options) | super(BackPlayer, self).__init__(name) src = self.makeSubelem('dvdblocksrc', location=options['location']) demux = self.makeSubelem('dvddemux') demux.connect('pad_added', self.padAdded) self.link('dvdblocksrc', 'dvddemux') | def __init__(self, options, name='backplayer'): super(BackPlayer, self).__init__(name, """ ( dvdblocksrc name=dvdblocksrc location=%(location)s ! seamless-dvddemux name=dvddemux ) """ % options) |
class Pipeline(gst.Thread): | def padAdded(self, dvddemux, pad): print "+++ New dvddemux pad:", pad.get_name() class Pipeline(gst.Pipeline): | def getBlockSource(self): return self.get_by_name('dvdblocksrc') |
gst.Thread.__init__(self, name) | super(Pipeline, self).__init__(name) | def __init__(self, options, name="dvdplayer"): gst.Thread.__init__(self, name) |
self.backPlayer.link_pads('subtitle', self.videoSink, 'subtitle') | def __init__(self, options, name="dvdplayer"): gst.Thread.__init__(self, name) | |
if options.clockType == 'robust': self.clock = wrapclock.wrap(self.audioSink.getClock()) elif options.clockType == 'audiosink': self.clock = self.audioSink.getClock() elif options.clockType == 'system': self.clock = gst.system_clock_obtain() else: assert 0, 'Unexpected clock type' self.use_clock(self.clock) | def __init__(self, options, name="dvdplayer"): gst.Thread.__init__(self, name) | |
self.makeSubelem('queue', 'video-queue') | self.makeSubelem('queue', 'video-queue', max_size_bytes=1024 * 1024 * 32) | def __init__(self, options, name='videodec'): |
self.angle = angle | def setAngle(self, angle): """Set the current angle to the one specified.""" # FIXME: Implement this. yield NoOp | |
yield Chain(self.linkCell(cellNr + 1)) | if self.machine.angle >= 1 and \ (self.cell.blockMode == \ dvdread.CELL_BLOCK_MODE_ANGLE_FIRST or \ self.cell.blockMode == \ dvdread.CELL_BLOCK_MODE_ANGLE_MIDDLE): nextCellNr = cellNr + 1 nextMode = self.programChain.getCell(nextCellNr).blockMode while nextMode == dvdread.CELL_BLOCK_MODE_ANGLE_MIDDLE or \ nextMode ==... | def linkCell(self, cellNr, sectorNr=None): """Link to the specified cell. |
st = gst.Structure('application/x-gst-dvd'); | st = gst.Structure('application/x-gst-dvd') | def audio(physical): """Create and return a new audio event for the specified physical stream.""" st = gst.Structure('application/x-gst-dvd'); st.set_value('event', 'dvd-audio-stream-change') st.set_value('physical', physical, 'int') return gst.event_new_any(st) |
return gst.event_new_any(st) | return createCustom(st) | def audio(physical): """Create and return a new audio event for the specified physical stream.""" st = gst.Structure('application/x-gst-dvd'); st.set_value('event', 'dvd-audio-stream-change') st.set_value('physical', physical, 'int') return gst.event_new_any(st) |
return gst.Event(gst.EVENT_EOS) | return gst.event_new_eos() | def eos(): """Create and return an end of stream (EOS) event.""" return gst.Event(gst.EVENT_EOS) |
return gst.Event(gst.EVENT_FILLER) | return gst.event_new_filler() | def filler(): """Create and return a filler event.""" return gst.Event(gst.EVENT_FILLER) |
return gst.Event(gst.EVENT_FLUSH) | return gst.event_new_flush_start() def newsegment(update, startTime, endTime): """Create and return a newsegment event for the specified start and end times. Times are specified in nanoseconds.""" return gst.event_new_new_segment(update, 1.0, gst.FORMAT_TIME, startTime, endTime, 0) | def flush(): """Create and return a flush event.""" return gst.Event(gst.EVENT_FLUSH) |
st = gst.Structure('application/x-gst-dvd'); | st = gst.Structure('application/x-gst-dvd') | def highlight(area, button, palette): """Create and return a new highlight event based on the specified highlight area, button number, and color palette.""" (sx, sy, ex, ey) = area st = gst.Structure('application/x-gst-dvd'); st.set_value('event', 'dvd-spu-highlight') st.set_value('button', button) st.set_value('palet... |
return gst.event_new_any(st) | return createCustom(st) | def highlight(area, button, palette): """Create and return a new highlight event based on the specified highlight area, button number, and color palette.""" (sx, sy, ex, ey) = area st = gst.Structure('application/x-gst-dvd'); st.set_value('event', 'dvd-spu-highlight') st.set_value('button', button) st.set_value('palet... |
return gst.event_new_any(st) def nav(startTime, endTime): """Create and return a nav packet event for the specified start and end times.""" st = gst.Structure('application/x-gst-dvd') st.set_value('event', 'dvd-nav-packet') st.set_value('start_ptm', mpegTimeToGstTime(startTime), 'uint64') st.set_value('end_ptm', mpegT... | return createCustom(st) | def highlightReset(): """Create and return a new highlight reset event.""" st = gst.Structure('application/x-gst-dvd') st.set_value('event', 'dvd-spu-reset-highlight') return gst.event_new_any(st) |
st = gst.Structure('application/x-gst-dvd'); | st = gst.Structure('application/x-gst-dvd') | def stillFrame(): """Create and return a still frame event.""" st = gst.Structure('application/x-gst-dvd'); st.set_value('event', 'dvd-spu-still-frame') return gst.event_new_any(st) |
return gst.event_new_any(st) | return createCustom(st) | def stillFrame(): """Create and return a still frame event.""" st = gst.Structure('application/x-gst-dvd'); st.set_value('event', 'dvd-spu-still-frame') return gst.event_new_any(st) |
st = gst.Structure('application/x-gst-dvd'); | st = gst.Structure('application/x-gst-dvd') | def subpictureClut(clut): """Create and return a new subpicture CLUT event based on the specified color lookup table (an 16 position array).""" st = gst.Structure('application/x-gst-dvd'); st.set_value('event', 'dvd-spu-clut-change') # Each value is stored in a separate field. for i in range(16): st.set_value('clut%02... |
return gst.event_new_any(st) | return createCustom(st) | def subpictureClut(clut): """Create and return a new subpicture CLUT event based on the specified color lookup table (an 16 position array).""" st = gst.Structure('application/x-gst-dvd'); st.set_value('event', 'dvd-spu-clut-change') # Each value is stored in a separate field. for i in range(16): st.set_value('clut%02... |
st = gst.Structure('application/x-gst-dvd'); | st = gst.Structure('application/x-gst-dvd') | def subpicture(physical): """Create and return a new subpicture event for the specified physical stream.""" st = gst.Structure('application/x-gst-dvd'); st.set_value('event', 'dvd-spu-stream-change') st.set_value('physical', physical, 'int') return gst.event_new_any(st) |
return gst.event_new_any(st) | return createCustom(st) | def subpicture(physical): """Create and return a new subpicture event for the specified physical stream.""" st = gst.Structure('application/x-gst-dvd'); st.set_value('event', 'dvd-spu-stream-change') st.set_value('physical', physical, 'int') return gst.event_new_any(st) |
return gst.event_new_any(st) | return createCustom(st) | def subpictureHide(): """Create and return a new subpicture hide event.""" st = gst.Structure('application/x-gst-dvd') st.set_value('event', 'dvd-spu-hide') return gst.event_new_any(st) |
title.titleNr, menuType)) | title.titleNrInSet, menuType)) | def callMenu(self, menuType, rtn): """Save the current location and jump to the menu of the specified type in the current title. If 'rtn' is not zero, it specifies the cell number to return to when the saved state is resumed. |
return title.globalTitleNr | return title.titleNrInManager | def getSystem4(self): """Return the value of system register 4 (title_in_volume).""" title = self.currentTitle() if title != None: return title.globalTitleNr else: return 0 |
return title.titleNr | return title.titleNrInSet | def getSystem5(self): """Return the value of system register 5 (title_in_vts).""" title = self.currentTitle() if title != None: return title.titleNr else: return 0 |
'pendingCmds', | def wrapper(self, *args, **keywords): self.lock.acquire() try: method(self, *args, **keywords) finally: self.lock.release() | |
self.mainItr = iter(self.machine) self.lock = threading.RLock() | def __init__(self, machine, pipeline): self.machine = machine self.pipeline = pipeline | |
self.pendingCmds = [] | def __init__(self, machine, pipeline): self.machine = machine self.pipeline = pipeline | |
def collectCmds(self): """Collect commands.""" events = [] for cmd in self.mainItr: events.append(cmd) if isinstance(cmd, machine.PlayVobu) or \ isinstance(cmd, machine.Pause) or \ (isinstance(cmd, self.EndInteractive) and cmd.count == self.interactiveCount): return events return events | def collectCmds(self): """Collect commands.""" events = [] for cmd in self.mainItr: events.append(cmd) if isinstance(cmd, machine.PlayVobu) or \ isinstance(cmd, machine.Pause) or \ (isinstance(cmd, self.EndInteractive) and cmd.count == self.interactiveCount): return events |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.