rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.playlist_layout.addWidget(self.dir_view) | filter_text = QtGui.QLineEdit() filter_text.textEdited.connect(self._filter_playlist) self.playlist_layout.addWidget(filter_text) | def _setup_widgets(self): self.dir_view = QtGui.QTreeView() self.dir_view.setSelectionMode( QtGui.QAbstractItemView.ContiguousSelection) media_filter = ["*%s" % extension for extension in self.playlist_model.media_file_extensions] self.dir_model = SimpleDirModel(filter=media_filter) self.dir_view.setModel(self.dir_mode... |
self.splitter.addWidget(self.playlist_view) | self.splitter.addWidget(self.playlist_widget) | def _setup_widgets(self): self.dir_view = QtGui.QTreeView() self.dir_view.setSelectionMode( QtGui.QAbstractItemView.ContiguousSelection) media_filter = ["*%s" % extension for extension in self.playlist_model.media_file_extensions] self.dir_model = SimpleDirModel(filter=media_filter) self.dir_view.setModel(self.dir_mode... |
"Play", self.media_object.play, "media-playback-start", | "Play", self.play_pause, "media-playback-start", | def _setup_toolbars(self): controls_toolbar = self.addToolBar("Controls") |
self.connect(self.media_object, QtCore.SIGNAL("stateChanged(Phonon::State, Phonon::State)"), self.play_pause) | self.media_object.stateChanged.connect(self.play_pause_icon) | def _setup_toolbars(self): controls_toolbar = self.addToolBar("Controls") |
for file in files: | for file_ in files: | def _add_media(self): # TODO - can we just show media files here? files = QtGui.QFileDialog().getOpenFileNames(self, "Add Media") for file in files: row = self.playlist_model.rowCount() self.playlist_model.insertRows(row) self.playlist_model.setData( self.playlist_model.index(row, PlaylistModel.FILE), QtCore.QVariant(f... |
QtCore.QVariant(file)) | QtCore.QVariant(file_)) | def _add_media(self): # TODO - can we just show media files here? files = QtGui.QFileDialog().getOpenFileNames(self, "Add Media") for file in files: row = self.playlist_model.rowCount() self.playlist_model.insertRows(row) self.playlist_model.setData( self.playlist_model.index(row, PlaylistModel.FILE), QtCore.QVariant(f... |
def play_pause(self, new_state, old_state): if new_state in [phonon.Phonon.PausedState, phonon.Phonon.ErrorState, phonon.Phonon.StoppedState]: | def play_pause_icon(self, new_state, old_state): if new_state in self.NOT_PLAYING_STATES: | def play_pause(self, new_state, old_state): if new_state in [phonon.Phonon.PausedState, phonon.Phonon.ErrorState, phonon.Phonon.StoppedState]: self.play_pause_action.setIcon(kdeui.KIcon("media-playback-start")) self.connect(self.play_pause_action, QtCore.SIGNAL("triggered()"), self.media_object.play) else: self.play_pa... |
self.connect(self.play_pause_action, QtCore.SIGNAL("triggered()"), self.media_object.play) | self.play_pause_action.setText("Play") | def play_pause(self, new_state, old_state): if new_state in [phonon.Phonon.PausedState, phonon.Phonon.ErrorState, phonon.Phonon.StoppedState]: self.play_pause_action.setIcon(kdeui.KIcon("media-playback-start")) self.connect(self.play_pause_action, QtCore.SIGNAL("triggered()"), self.media_object.play) else: self.play_pa... |
self.connect(self.play_pause_action, QtCore.SIGNAL("triggered()"), self.media_object.pause) | self.play_pause_action.setText("Pause") def play_pause(self): if self.media_object.state() in self.NOT_PLAYING_STATES: self.media_object.play() else: self.media_object.pause() | def play_pause(self, new_state, old_state): if new_state in [phonon.Phonon.PausedState, phonon.Phonon.ErrorState, phonon.Phonon.StoppedState]: self.play_pause_action.setIcon(kdeui.KIcon("media-playback-start")) self.connect(self.play_pause_action, QtCore.SIGNAL("triggered()"), self.media_object.play) else: self.play_pa... |
file = self.playlist_model.data(file_index).toString() | file_ = self.playlist_model.data(file_index).toString() | def play(self, index): if index.isValid(): selected_row = index.row() elif self.playlist_model.rowCount() > 0: # TODO - be smarter selected_row = 0 else: # TODO - should we do something better here? return file_index = self.playlist_model.createIndex( selected_row, PlaylistModel.FILE) self.playlist_model.setData( file_... |
media_source = phonon.Phonon.MediaSource(file) | media_source = phonon.Phonon.MediaSource(file_) | def play(self, index): if index.isValid(): selected_row = index.row() elif self.playlist_model.rowCount() > 0: # TODO - be smarter selected_row = 0 else: # TODO - should we do something better here? return file_index = self.playlist_model.createIndex( selected_row, PlaylistModel.FILE) self.playlist_model.setData( file_... |
file = self.playlist_model.data(next_index).toString() media_source = phonon.Phonon.MediaSource(file) | file_ = self.playlist_model.data(next_index).toString() media_source = phonon.Phonon.MediaSource(file_) | def queue_next_track(self): next_index = self.playlist_model.createIndex( self.playlist_model.active_track_row + 1, PlaylistModel.FILE) if not next_index.isValid(): return self.playlist_model.active_track_row += 1 file = self.playlist_model.data(next_index).toString() media_source = phonon.Phonon.MediaSource(file) self... |
file = os.path.split(unicode(source.url().toString()))[-1] self.setWindowTitle(u"%s - Ersatz" % file) | file_ = os.path.split(unicode(source.url().toString()))[-1] self.setWindowTitle(u"%s - Ersatz" % file_) def _filter_playlist(self, filter_text): print filter_text | def update_title(self, source): file = os.path.split(unicode(source.url().toString()))[-1] self.setWindowTitle(u"%s - Ersatz" % file) |
license = kdecore.KAboutData.License_GPL copyright = kdecore.ki18n("(c) 2009 Carlos Corbacho") | license_ = kdecore.KAboutData.License_GPL copyright_ = kdecore.ki18n("(c) 2009 Carlos Corbacho") | def get_about_data(): app_name = "ersatz" catalog = "" program_name = kdecore.ki18n("Ersatz") version = "0.1" description = kdecore.ki18n("A simple Media Player") license = kdecore.KAboutData.License_GPL copyright = kdecore.ki18n("(c) 2009 Carlos Corbacho") text = kdecore.ki18n("none") home_page = "www.strangeworlds.co... |
app_name, catalog, program_name, version, description, license, copyright, text, home_page, bug_email) | app_name, catalog, program_name, version, description, license_, copyright_, text, home_page, bug_email) | def get_about_data(): app_name = "ersatz" catalog = "" program_name = kdecore.ki18n("Ersatz") version = "0.1" description = kdecore.ki18n("A simple Media Player") license = kdecore.KAboutData.License_GPL copyright = kdecore.ki18n("(c) 2009 Carlos Corbacho") text = kdecore.ki18n("none") home_page = "www.strangeworlds.co... |
print rules | debug(rules) | def load_iptables(a, family=socket.AF_INET, socket_type=socket.SOCK_STREAM, socket_rule=False, explicit_on_ip=False): header = """ |
print " | debug(" | def run_sockets(a, family=socket.AF_INET, socket_type=socket.SOCK_STREAM, socket_rule=False, explicit_on_ip=False, sockets=()): skip_irrelevant = False load_iptables(a, family, socket_type, socket_rule, explicit_on_ip) open_sockets = [] relevant = False success = True for addrs in sockets: for addr in addrs: print ... |
def __setstate(self, dat): | def __setstate__(self, dat): | def __setstate(self, dat): for k,v in dat.items(): self.__dict__[k] = v |
'MythArchiveTcrequantCmd', | 'MythArchiveM2VRequantiserCmd', | def getDefaultParametersFromMythTVDB(): """Reads settings from MythTV database""" write( "Obtaining MythTV settings from MySQL database for hostname " + configHostname) #TVFormat is not dependant upon the hostname. sqlstatement="""select value, data from settings where value in('DBSchemaVer') or (hostname='""" + conf... |
ms = int(time[9:11]) | ms = int(time[9:11]) * 90 | def ts2pts(time): h = int(time[0:2]) * 3600 * 90000 m = int(time[3:5]) * 60 * 90000 s = int(time[6:8]) * 90000 ms = int(time[9:11]) return h + m + s + ms |
def runTcrequant(source,destination,percentage): checkCancelFlag() write (path_tcrequant[0] + " %s %s %s" % (source,destination,percentage)) result=os.spawnlp(os.P_WAIT, path_tcrequant[0],path_tcrequant[1], "-i",source, "-o",destination, "-d","2", "-f","%s" % percentage) | def runM2VRequantiser(source,destination,factor): mega=1024.0*1024.0 M2Vsize0 = os.path.getsize(source) write("Initial M2Vsize is %.2f Mb , target is %.2f Mb" % ( (float(M2Vsize0)/mega), (float(M2Vsize0)/(factor*mega)) )) command = path_M2VRequantiser[0] command += " %.5f " % factor command += " %s " % M2Vsize0 comm... | def deMultiplexMPEG2File(folder, mediafile, video, audio1, audio2): if getFileType(folder) == "mpegts": command = "mythreplex --demux --fix_sync -t TS -o %s " % (folder + "/stream") command += "-v %d " % (video[VIDEO_ID]) if audio1[AUDIO_ID] != -1: if audio1[AUDIO_CODEC] == 'MP2': command += "-a %d " % (audio1[AUDIO_... |
fatalError("Failed while running tcrequant") | fatalError("Failed while running M2VRequantiser. Command was %s" % command) | def runTcrequant(source,destination,percentage): checkCancelFlag() write (path_tcrequant[0] + " %s %s %s" % (source,destination,percentage)) result=os.spawnlp(os.P_WAIT, path_tcrequant[0],path_tcrequant[1], "-i",source, "-o",destination, "-d","2", "-f","%s" % percentage) if result<>0: fatalError("Failed while running ... |
totalvideosize+=os.path.getsize(file) / 1024 / 1024 | totalvideosize+=os.path.getsize(file) | def calculateFileSizes(files): """ Returns the sizes of all video, audio and menu files""" filecount=0 totalvideosize=0 totalaudiosize=0 totalmenusize=0 for node in files: filecount+=1 #Generate a temp folder name for this file folder=getItemTempPath(filecount) #Process this file file=os.path.join(folder,"stream.mv2")... |
totalaudiosize+=os.path.getsize(os.path.join(folder,"stream0.ac3")) / 1024 / 1024 | totalaudiosize+=os.path.getsize(os.path.join(folder,"stream0.ac3")) | def calculateFileSizes(files): """ Returns the sizes of all video, audio and menu files""" filecount=0 totalvideosize=0 totalaudiosize=0 totalmenusize=0 for node in files: filecount+=1 #Generate a temp folder name for this file folder=getItemTempPath(filecount) #Process this file file=os.path.join(folder,"stream.mv2")... |
totalaudiosize+=os.path.getsize(os.path.join(folder,"stream0.mp2")) / 1024 / 1024 | totalaudiosize+=os.path.getsize(os.path.join(folder,"stream0.mp2")) | def calculateFileSizes(files): """ Returns the sizes of all video, audio and menu files""" filecount=0 totalvideosize=0 totalaudiosize=0 totalmenusize=0 for node in files: filecount+=1 #Generate a temp folder name for this file folder=getItemTempPath(filecount) #Process this file file=os.path.join(folder,"stream.mv2")... |
totalaudiosize+=os.path.getsize(os.path.join(folder,"stream1.ac3")) / 1024 / 1024 | totalaudiosize+=os.path.getsize(os.path.join(folder,"stream1.ac3")) | def calculateFileSizes(files): """ Returns the sizes of all video, audio and menu files""" filecount=0 totalvideosize=0 totalaudiosize=0 totalmenusize=0 for node in files: filecount+=1 #Generate a temp folder name for this file folder=getItemTempPath(filecount) #Process this file file=os.path.join(folder,"stream.mv2")... |
totalaudiosize+=os.path.getsize(os.path.join(folder,"stream1.mp2")) / 1024 / 1024 | totalaudiosize+=os.path.getsize(os.path.join(folder,"stream1.mp2")) | def calculateFileSizes(files): """ Returns the sizes of all video, audio and menu files""" filecount=0 totalvideosize=0 totalaudiosize=0 totalmenusize=0 for node in files: filecount+=1 #Generate a temp folder name for this file folder=getItemTempPath(filecount) #Process this file file=os.path.join(folder,"stream.mv2")... |
totalmenusize+=os.path.getsize(os.path.join(getTempPath(),"chaptermenu-%s.mpg" % filecount)) / 1024 / 1024 | totalmenusize+=os.path.getsize(os.path.join(getTempPath(),"chaptermenu-%s.mpg" % filecount)) | def calculateFileSizes(files): """ Returns the sizes of all video, audio and menu files""" filecount=0 totalvideosize=0 totalaudiosize=0 totalmenusize=0 for node in files: filecount+=1 #Generate a temp folder name for this file folder=getItemTempPath(filecount) #Process this file file=os.path.join(folder,"stream.mv2")... |
totalmenusize+=os.path.getsize(os.path.join(getTempPath(),"details-%s.mpg" % filecount)) / 1024 / 1024 | totalmenusize+=os.path.getsize(os.path.join(getTempPath(),"details-%s.mpg" % filecount)) | def calculateFileSizes(files): """ Returns the sizes of all video, audio and menu files""" filecount=0 totalvideosize=0 totalaudiosize=0 totalmenusize=0 for node in files: filecount+=1 #Generate a temp folder name for this file folder=getItemTempPath(filecount) #Process this file file=os.path.join(folder,"stream.mv2")... |
totalmenusize+=os.path.getsize(os.path.join(getTempPath(),"menu-%s.mpg" % filecount)) / 1024 / 1024 | totalmenusize+=os.path.getsize(os.path.join(getTempPath(),"menu-%s.mpg" % filecount)) | def calculateFileSizes(files): """ Returns the sizes of all video, audio and menu files""" filecount=0 totalvideosize=0 totalaudiosize=0 totalmenusize=0 for node in files: filecount+=1 #Generate a temp folder name for this file folder=getItemTempPath(filecount) #Process this file file=os.path.join(folder,"stream.mv2")... |
def total_mv2_brl(files,rate): tvsize=0 filecount=0 for node in files: filecount+=1 folder=getItemTempPath(filecount) progduration=getLengthOfVideo(filecount) file=os.path.join(folder,"stream.mv2") progvsize=os.path.getsize(file) progvbitrate=progvsize/progduration if progvbitrate>rate : tvsize+=progduration*rate else:... | def calculateFileSizes(files): """ Returns the sizes of all video, audio and menu files""" filecount=0 totalvideosize=0 totalaudiosize=0 totalmenusize=0 for node in files: filecount+=1 #Generate a temp folder name for this file folder=getItemTempPath(filecount) #Process this file file=os.path.join(folder,"stream.mv2")... | |
write( "Total size of video files, before multiplexing, is %s Mbytes, audio is %s MBytes, menus are %s MBytes." % (totalvideosize,totalaudiosize,totalmenusize)) dvdrsize-=totalaudiosize dvdrsize-=totalmenusize totalvideosize=totalvideosize*1.08 if dvdrsize<0: fatalError("Audio and menu files are greater than the s... | write( "Total video %.2f Mb, audio %.2f Mb, menus %.2f Mb." % (totalvideosize/mega,totalaudiosize/mega,totalmenusize/mega)) mv2space=((dvdrsize*mega-totalmenusize)/fudge_pack)-totalaudiosize if mv2space<0: fatalError("Audio and menu files are too big. No room for video. Giving up!") if totalvideosize>mv2space: wri... | def performMPEG2Shrink(files,dvdrsize): checkCancelFlag() totalvideosize,totalaudiosize,totalmenusize=calculateFileSizes(files) #Report findings write( "Total size of video files, before multiplexing, is %s Mbytes, audio is %s MBytes, menus are %s MBytes." % (totalvideosize,totalaudiosize,totalmenusize)) #Subtract t... |
runTcrequant(os.path.join(getItemTempPath(filecount),"stream.mv2"),os.path.join(getItemTempPath(filecount),"video.small.m2v"),scalepercentage) os.remove(os.path.join(getItemTempPath(filecount),"stream.mv2")) os.rename(os.path.join(getItemTempPath(filecount),"video.small.m2v"),os.path.join(getItemTempPath(filecount),"st... | folder=getItemTempPath(filecount) file=os.path.join(folder,"stream.mv2") vsize+=os.path.getsize(file) duration+=getLengthOfVideo(filecount) vrLo=0.0 vrHi=3.0*float(vsize)/duration vrate=vrLo vrinc=vrHi-vrLo count=0 while count<30 : count+=1 vrinc=vrinc*0.5 vrtest=vrate+vrinc testsize=total_mv2_brl(files,... | def performMPEG2Shrink(files,dvdrsize): checkCancelFlag() totalvideosize,totalaudiosize,totalmenusize=calculateFileSizes(files) #Report findings write( "Total size of video files, before multiplexing, is %s Mbytes, audio is %s MBytes, menus are %s MBytes." % (totalvideosize,totalaudiosize,totalmenusize)) #Subtract t... |
dvdrsize-=totalvideosize write( "Video will fit onto DVD. %s MBytes of space remaining on recordable DVD." % dvdrsize) | write( "Unpackaged total %.2f Mb. About %.0f Mb will be unused." % ((allfiles/mega),(mv2space-totalvideosize)/mega)) | def performMPEG2Shrink(files,dvdrsize): checkCancelFlag() totalvideosize,totalaudiosize,totalmenusize=calculateFileSizes(files) #Report findings write( "Total size of video files, before multiplexing, is %s Mbytes, audio is %s MBytes, menus are %s MBytes." % (totalvideosize,totalaudiosize,totalmenusize)) #Subtract t... |
vob.setAttribute("file",os.path.join(getItemTempPath(itemnum),"final.mpg")) | vob.setAttribute("file",os.path.join(getItemTempPath(itemnum),"final.vob")) | def createDVDAuthorXML(screensize, numberofitems): """Creates the xml file for dvdauthor to use the MythBurn menus.""" #Get the main menu node (we must only have 1) menunode=themeDOM.getElementsByTagName("menu") if menunode.length!=1: fatalError("Cannot find the menu element in the theme file") menunode=menunode[0] m... |
vob.setAttribute("file", os.path.join(getItemTempPath(itemNum), "final.mpg")) | vob.setAttribute("file", os.path.join(getItemTempPath(itemNum), "final.vob")) | def createDVDAuthorXMLNoMenus(screensize, numberofitems): """Creates the xml file for dvdauthor containing no menus.""" # creates a simple DVD with no menus that chains the videos one after the other # can contain an intro movie and each title can have a details page # displayed before each title write( "Creating DVD... |
os.path.join(folder,'final.mpg'), | os.path.join(folder,'final.vob'), | def processJob(job): """Starts processing a MythBurn job, expects XML nodes to be passed as input.""" global wantIntro, wantMainMenu, wantChapterMenu, wantDetailsPage global themeDOM, themeName, themeFonts media=job.getElementsByTagName("media") if media.length==1: themeName=job.attributes["theme"].value #Check th... |
global path_dvdauthor, path_mkisofs, path_growisofs, path_tcrequant, addSubtitles | global path_dvdauthor, path_mkisofs, path_growisofs, path_M2VRequantiser, addSubtitles | def main(): global sharepath, scriptpath, cpuCount, videopath, gallerypath, musicpath global videomode, temppath, logpath, dvddrivepath, dbVersion, preferredlang1 global preferredlang2, useFIFO, encodetoac3, alwaysRunMythtranscode global copyremoteFiles, mainmenuAspectRatio, chaptermenuAspectRatio, dateformat global ti... |
path_tcrequant = [defaultsettings["MythArchiveTcrequantCmd"], os.path.split(defaultsettings["MythArchiveTcrequantCmd"])[1]] | path_M2VRequantiser = [defaultsettings["MythArchiveM2VRequantiserCmd"], os.path.split(defaultsettings["MythArchiveM2VRequantiserCmd"])[1]] | def main(): global sharepath, scriptpath, cpuCount, videopath, gallerypath, musicpath global videomode, temppath, logpath, dvddrivepath, dbVersion, preferredlang1 global preferredlang2, useFIFO, encodetoac3, alwaysRunMythtranscode global copyremoteFiles, mainmenuAspectRatio, chaptermenuAspectRatio, dateformat global ti... |
sys.stderr.write(self.error_messages['MTVUrlError'] % (url, errormsg)) | sys.stderr.write(self.error_messages['MtvUrlError'] % (url, errormsg)) | def getVideosForURL(self, url, dictionaries): '''Get the video metadata for url search return the video dictionary of directories and their video mata data ''' initial_length = len(dictionaries) |
def getPendingRecordings(self): """ Returns a list of Program objects which are scheduled to be recorded. """ programs = [] res = self.backendCommand('QUERY_GETALLPENDING').split(BACKEND_SEP) has_conflict = int(res.pop(0)) num_progs = int(res.pop(0)) for i in range(num_progs): programs.append(Program(res[i * PROGRAM_FI... | def _getPrograms(self, query, recstatus=None, header=0): | def getPendingRecordings(self): """ Returns a list of Program objects which are scheduled to be recorded. """ programs = [] res = self.backendCommand('QUERY_GETALLPENDING').split(BACKEND_SEP) has_conflict = int(res.pop(0)) num_progs = int(res.pop(0)) for i in range(num_progs): programs.append(Program(res[i * PROGRAM_FI... |
res = self.getPendingRecordings() for p in res: if p.recstatus == p.WILLRECORD: programs.append(p) programs.sort(sort_programs_by_starttime) return programs | res = self.backendCommand(query).split(BACKEND_SEP) for i in range(header): res.pop(0) num_progs = int(res.pop(0)) for i in range(num_progs): offs = i * PROGRAM_FIELDS programs.append(Program(res[offs:offs+PROGRAM_FIELDS], db=self.db)) if recstatus: for i in reversed(range(num_progs)): if programs[i].recstatus != rec... | def sort_programs_by_starttime(x, y): if x.starttime > y.starttime: return 1 elif x.starttime == y.starttime: return 0 else: return -1 |
programs = [] res = self.backendCommand('QUERY_RECORDINGS Play').split(BACKEND_SEP) num_progs = int(res.pop(0)) for i in range(num_progs): programs.append(Program(res[i * PROGRAM_FIELDS:(i*PROGRAM_FIELDS) + PROGRAM_FIELDS], db=self.db)) return programs | return self._getPrograms('QUERY_RECORDINGS Play') | def getRecordings(self): """ Returns a list of all Program objects which have already recorded """ programs = [] res = self.backendCommand('QUERY_RECORDINGS Play').split(BACKEND_SEP) num_progs = int(res.pop(0)) for i in range(num_progs): programs.append(Program(res[i * PROGRAM_FIELDS:(i*PROGRAM_FIELDS) + PROGRAM_FIELDS... |
programs = [] res = self.backendCommand('QUERY_GETEXPIRING').split(BACKEND_SEP) num_progs = int(res.pop(0)) for i in range(num_progs): programs.append(Program(res[i * PROGRAM_FIELDS:(i*PROGRAM_FIELDS) + PROGRAM_FIELDS], db=self.db)) return programs | return self._getPrograms('QUERY_GETEXPIRING') | def getExpiring(self): """ Returns a tuple of all Program objects nearing expiration """ programs = [] res = self.backendCommand('QUERY_GETEXPIRING').split(BACKEND_SEP) num_progs = int(res.pop(0)) for i in range(num_progs): programs.append(Program(res[i * PROGRAM_FIELDS:(i*PROGRAM_FIELDS) + PROGRAM_FIELDS], db=self.db)... |
timeout = self.timeout | timerem = self.timeout else: timerem = timeout | def backendCommand(self, data=None, timeout=None): """ obj.backendCommand(data=None, timeout=None) -> response string |
while True: | while timerem >= 0: | def backendCommand(self, data=None, timeout=None): """ obj.backendCommand(data=None, timeout=None) -> response string |
DBDataWriteAI.update(*args, **keywords) | DBDataWriteAI.update(self, *args, **keywords) | def update(self, *args, **keywords): DBDataWriteAI.update(*args, **keywords) FileOps(db=self._db).reschedule(self.recordid, wait) |
elementList.append(etree.XML(u'<listItem>%s</listItem>' % value)) | elementList.append(etree.XML(u'<listItem>%s</listItem>' % self.massageText(value))) | def stringToList(self, context, arg): ''' Split a string into substrings and return each as an element. Example: tvdbXpath:stringToCategories(string(./Genre), '|') return a list of elements with each substrings text value ''' if not arg: return [] elementList = [] tmpString = arg tmpList1 = tmpString.split('|') tmpList... |
if tokens[0] == "ok>": write("found stream %s" % tokens[2], False) streamIds.append(int(tokens[2], 16)) sortedstreamIds = [] sortedstreamIds = sorted(streamIds) streamIds = sortedstreamIds if len(streamIds) == 0: for line in logdata: if line.startswith("-> found PES-ID"): index = line.find("(SubID 0x") if index > 0:... | if tokens[0] == "++>": if tokens[1] == "Mpg": if tokens[2] == "Video:": write("found MPEG video stream %s" % tokens[4], False) streamIds.append(int(tokens[4], 16)) if tokens[2] == "Audio:": write("found MPEG audio stream %s" % tokens[4], False) streamIds.append(int(tokens[4], 16)) if tokens[1] == "AC3/DTS": write("fou... | def renameProjectXFiles(folder, pxbasename): write("renameProjectXFiles start -----------------------------------------", False) logf = open(os.path.join(folder, pxbasename + "_log.txt")) logdata = logf.readlines() logf.close() # find stream PIDs streamIds = [] for line in logdata: tokens = line.split() if len(tokens... |
chapters="" thumbList="" | chapters=[] thumbList=[] | def createVideoChapters(itemnum, numofchapters, lengthofvideo, getthumbnails): """Returns numofchapters chapter marks even spaced through a certain time period""" # if there are user defined thumb images already available use them infoDOM = xml.dom.minidom.parse(os.path.join(getItemTempPath(itemnum),"info.xml")) thumb... |
chapters+=time.strftime("%H:%M:%S",time.gmtime(starttime)) | chapters.append(time.strftime("%H:%M:%S",time.gmtime(starttime))) | def createVideoChapters(itemnum, numofchapters, lengthofvideo, getthumbnails): """Returns numofchapters chapter marks even spaced through a certain time period""" # if there are user defined thumb images already available use them infoDOM = xml.dom.minidom.parse(os.path.join(getItemTempPath(itemnum),"info.xml")) thumb... |
thumbList+="%s," % thumboffset | thumbList.append(str(thumboffset)) | def createVideoChapters(itemnum, numofchapters, lengthofvideo, getthumbnails): """Returns numofchapters chapter marks even spaced through a certain time period""" # if there are user defined thumb images already available use them infoDOM = xml.dom.minidom.parse(os.path.join(getItemTempPath(itemnum),"info.xml")) thumb... |
thumbList+="%s," % starttime | thumbList.append(str(starttime)) | def createVideoChapters(itemnum, numofchapters, lengthofvideo, getthumbnails): """Returns numofchapters chapter marks even spaced through a certain time period""" # if there are user defined thumb images already available use them infoDOM = xml.dom.minidom.parse(os.path.join(getItemTempPath(itemnum),"info.xml")) thumb... |
thumbList+="%s," % starttime if numofchapters>1: chapters+="," | thumbList.append(str(starttime)) | def createVideoChapters(itemnum, numofchapters, lengthofvideo, getthumbnails): """Returns numofchapters chapter marks even spaced through a certain time period""" # if there are user defined thumb images already available use them infoDOM = xml.dom.minidom.parse(os.path.join(getItemTempPath(itemnum),"info.xml")) thumb... |
self.cast = self._Cast((self.intid,), self._db) self.genre = self._Genre((self.intid,), self._db) self.country = self._Country((self.intid,), self._db) | if wheredat is None: wheredat = [self.intid] self.cast = self._Cast(wheredat, self._db) self.genre = self._Genre(wheredat, self._db) self.country = self._Country(wheredat, self._db) | def _evalwheredat(self, wheredat=None): DBDataWriteAI._evalwheredat(self, wheredat) self._fill_cm() self._cat_toname() self.cast = self._Cast((self.intid,), self._db) self.genre = self._Genre((self.intid,), self._db) self.country = self._Country((self.intid,), self._db) self.markup = self._Markup((self.filename,), self... |
title = filename[filename.rindex('/')+1:] | title = filename.rsplit('/',1)[-1] | def parseFilename(self): filename = self.filename filename = filename[:filename.rindex('.')] for old in ('%20','_','.'): filename = filename.replace(old, ' ') |
def delete(self): | def delete(self, wait=False): | def delete(self): DBDataWriteAI.delete(self) FileOps(db=self._db).reschedule(self.recordid) |
FileOps(db=self._db).reschedule(self.recordid) | FileOps(db=self._db).reschedule(self.recordid, wait) | def delete(self): DBDataWriteAI.delete(self) FileOps(db=self._db).reschedule(self.recordid) |
MythDB, Video, MythVideo, MythBE, FileOps, MythError, MythLog | MythDB, Video, MythVideo, MythBE, MythError, MythLog | def __getattr__(self, attr): """Delegate everything but write to the stream""" return getattr(self.out, attr) |
logger.critical(u'''Creating an instance caused an error for one of: MythDBConn or MythVideo, error(%s) | logger.critical(u'''Creating an instance caused an error for one of: MythDB or MythVideo, error(%s) | def __getattr__(self, attr): """Delegate everything but write to the stream""" return getattr(self.out, attr) |
if (self.where is None) or \ (self.wheredat is None) or \ (self.data is None): | if (self._where is None) or \ (self._wheredat is None) or \ (self._data is None): | def delete(self): """ Delete video entry from database. """ if (self.where is None) or \ (self.wheredat is None) or \ (self.data is None): return c = self.db.cursor() query = """DELETE FROM %s WHERE %s""" % (self.table, self.where) self.log(self.log.DATABASE, query, str(self.wheredat)) try: c.execute(query, self.whered... |
c = self.db.cursor() query = """DELETE FROM %s WHERE %s""" % (self.table, self.where) self.log(self.log.DATABASE, query, str(self.wheredat)) | c = self._db.cursor() query = """DELETE FROM %s WHERE %s""" % (self._table, self._where) self._log(self._log.DATABASE, query, str(self._wheredat)) | def delete(self): """ Delete video entry from database. """ if (self.where is None) or \ (self.wheredat is None) or \ (self.data is None): return c = self.db.cursor() query = """DELETE FROM %s WHERE %s""" % (self.table, self.where) self.log(self.log.DATABASE, query, str(self.wheredat)) try: c.execute(query, self.whered... |
c.execute(query, self.wheredat) | c.execute(query, self._wheredat) | def delete(self): """ Delete video entry from database. """ if (self.where is None) or \ (self.wheredat is None) or \ (self.data is None): return c = self.db.cursor() query = """DELETE FROM %s WHERE %s""" % (self.table, self.where) self.log(self.log.DATABASE, query, str(self.wheredat)) try: c.execute(query, self.whered... |
hash_value = FileOps(mythbeconn.hostname).getHash(filename, u'Videos') | hash_value = mythbeconn.getHash(filename, u'Videos') | def hashFile(filename): '''Create metadata hash values for mythvideo files return a hash value return u'' if the was an error with the video file or the video file length was zero bytes ''' # Use the MythVideo hashing protocol when the video is in a storage groups if filename[0] != u'/': hash_value = FileOps(mythbeconn... |
if (self.where is None) or \ (self.wheredat is None) or \ (self.data is None): | if (self._where is None) or \ (self._wheredat is None) or \ (self._data is None): | def delete(self): """ Delete video entry from database. """ if (self.where is None) or \ (self.wheredat is None) or \ (self.data is None): return c = self.db.cursor() query = """DELETE FROM %s WHERE %s""" % (self.table, self.where) self.log(self.log.DATABASE, query, str(self.wheredat)) try: c.execute(query, self.whered... |
c = self.db.cursor() query = """DELETE FROM %s WHERE %s""" % (self.table, self.where) self.log(self.log.DATABASE, query, str(self.wheredat)) | c = self._db.cursor() query = """DELETE FROM %s WHERE %s""" % (self._table, self._where) self._log(self._log.DATABASE, query, str(self._wheredat)) | def delete(self): """ Delete video entry from database. """ if (self.where is None) or \ (self.wheredat is None) or \ (self.data is None): return c = self.db.cursor() query = """DELETE FROM %s WHERE %s""" % (self.table, self.where) self.log(self.log.DATABASE, query, str(self.wheredat)) try: c.execute(query, self.whered... |
c.execute(query, self.wheredat) | c.execute(query, self._wheredat) | def delete(self): """ Delete video entry from database. """ if (self.where is None) or \ (self.wheredat is None) or \ (self.data is None): return c = self.db.cursor() query = """DELETE FROM %s WHERE %s""" % (self.table, self.where) self.log(self.log.DATABASE, query, str(self.wheredat)) try: c.execute(query, self.whered... |
logger.critical(u"All Mythvideo only configuration (%s) directories (%s) must be a subrirectory of the MythVideo base directory (%s)." % (key, channel_mythvideo_only[key], vid_graphics_dirs[u'mythvideo'])) | logger.critical(u"All Mythvideo only configuration (%s) directories (%s) must be a subdirectory of the MythVideo base directory (%s)." % (key, channel_mythvideo_only[key], vid_graphics_dirs[u'mythvideo'])) | def setUseroptions(): """ Change variables through a user supplied configuration file abort the script if there are issues with the configuration file values """ global simulation, verbose, channel_icon_override, channel_watch_only, channel_mythvideo_only global vid_graphics_dirs, tv_channels, movie_trailers, filena... |
recorded_array = MythDB(mythdb).searchRecorded(chanid=channel_id, hostname=localhostname) | recorded_array = mythdb.searchRecorded(chanid=channel_id, hostname=localhostname) | def getOldrecordedOrphans(): """Retrieves the Miro oldrecorded records for localhostname. Match them against the Miro recorded records and identify any orphaned oldrecorded records. Those records mean a MythTV user deleted the Miro video from the Watched Recordings screen or from MythVideo. Delete the orphaned records ... |
oldrecorded_array = MythDB(mythdb).searchOldRecorded(chanid=channel_id, ) | oldrecorded_array = mythdb.searchOldRecorded(chanid=channel_id, ) | def getOldrecordedOrphans(): """Retrieves the Miro oldrecorded records for localhostname. Match them against the Miro recorded records and identify any orphaned oldrecorded records. Those records mean a MythTV user deleted the Miro video from the Watched Recordings screen or from MythVideo. Delete the orphaned records ... |
recorded = MythDB(mythdb).searchRecorded(chanid=channel_id, hostname=localhostname) | recorded = mythdb.searchRecorded(chanid=channel_id, hostname=localhostname) | def getPlayedMiroVideos(): '''From the MythTV database recorded records identify all "played" Miro Video files. return None if there were either no Miro recorded records or none that were in "watched" status return an array of subtitles of those Miro video files that were "watched" ''' global localhostname, vid_graphic... |
recorded = MythDB(mythdb).searchRecorded(chanid=channel_id, hostname=localhostname) | recorded = mythdb.searchRecorded(chanid=channel_id, hostname=localhostname) | def updateMythRecorded(items): '''Add and delete MythTV (Watch Recordings) Miro recorded records. Add and delete symbolic links to coverart/Miro icons. Abort if processing failed return True if processing was successful ''' global localhostname, vid_graphics_dirs, storagegroups, channel_id, simulation, imagemagick glob... |
for oldrecorded in MythDB(mythdb).searchOldRecorded(title=record[u'title'], subtitle=record[u'subtitle'] ): | for oldrecorded in mythdb.searchOldRecorded(title=record[u'title'], subtitle=record[u'subtitle'] ): | def updateMythVideo(items): '''Add and delete MythVideo records for played Miro Videos. Add and delete symbolic links to Miro Videos, to coverart/Miro icons, banners and Miro screenshots and fanart. NOTE: banner and fanart graphics were provided with the script and are used only if present. Abort if processing failed r... |
parser.add_option( "-i", "--import_opml", metavar="CONFIGFILEPATH", default="", dest="import_opml", | parser.add_option( "-i", "--import_opml", metavar="OPMLFILEPATH", default="", dest="import_opml", | def main(): """Support mirobridge from the command line returns True """ global localhostname, simulation, verbose, storagegroups, ffmpeg, channel_id, channel_num global flat, download_sleeptime, channel_watch_only, channel_mythvideo_only, channel_new_watch_copy global vid_graphics_dirs, imagemagick, statistics, requir... |
for name in os.listdir(dirName): if name.startswith(fileBaseName): try: if simulation: logger.info(u"Simulation: Remove screenshot file (%s)" % (u"%s/%s" % (dirName, name))) else: os.remove(u"%s/%s" % (dirName, name)) except OSError: pass break | try: for name in os.listdir(dirName): if name.startswith(fileBaseName): try: if simulation: logger.info(u"Simulation: Remove screenshot file (%s)" % (u"%s/%s" % (dirName, name))) else: os.remove(u"%s/%s" % (dirName, name)) except OSError: pass break except UnicodeDecodeError: pass | def getOldrecordedOrphans(): """Retrieves the Miro oldrecorded records for localhostname. Match them against the Miro recorded records and identify any orphaned oldrecorded records. Those records mean a MythTV user deleted the Miro video from the Watched Recordings screen or from MythVideo. Delete the orphaned records ... |
for name in os.listdir(dirName): if name.startswith(fileBaseName): try: if simulation: logger.info(u"Simulation: Remove unique cover art file (%s)" % (u"%s/%s" % (dirName, name))) else: os.remove(u"%s/%s" % (dirName, name)) except OSError: pass break | try: for name in os.listdir(dirName): if name.startswith(fileBaseName): try: if simulation: logger.info(u"Simulation: Remove unique cover art file (%s)" % (u"%s/%s" % (dirName, name))) else: os.remove(u"%s/%s" % (dirName, name)) except OSError: pass break except UnicodeDecodeError: pass | def getOldrecordedOrphans(): """Retrieves the Miro oldrecorded records for localhostname. Match them against the Miro recorded records and identify any orphaned oldrecorded records. Those records mean a MythTV user deleted the Miro video from the Watched Recordings screen or from MythVideo. Delete the orphaned records ... |
f = open(name, "rb") | f = open(filename, "rb") | def hashFile(filename): '''Create metadata hash values for mythvideo files return a hash value return u'' if the was an error with the video file or the video file length was zero bytes ''' # Use the MythVideo hashing protocol when the video is in a storage groups if filename[0] != u'/': hash_value = FileOps(mythbeconn... |
return Program(res[1:], db=cls.db) | return Program(res[1:], db=self.db) | def getRecording(self, chanid, starttime): """FileOps.getRecording(chanid, starttime) -> Program object""" res = self.backendCommand('QUERY_RECORDING TIMESLOT %d %d' \ % (chanid, starttime)).split(BACKEND_SEP) if res[0] == 'ERROR': return None else: return Program(res[1:], db=cls.db) |
if 'st' not in sdict: | if ('st' not in sdict) or ('location' not in sdict): | def search(self, timeout=5.0, filter=None): """ obj.search(timeout=5.0, filter=None) -> response dicts |
fp.write(config) | fp.write(etree.tostring(doc)) | def _writeXML(self, dbconn): doc = etree.Element('Configuration') upnpnode = doc.makeelement('UPnP') doc.append(upnpnode) |
return fe.send('play','filename myth://Videos@%s/%s' % | return fe.send('play','file myth://Videos@%s/%s' % | def _playOnFe(self, fe): return fe.send('play','filename myth://Videos@%s/%s' % (self.host, self.filename)) |
u+ u'''(?P<seasno>[0-9]+)/(?P<epno>[0-9]+).+$''', | def __init__(self, interactive = False, debug = False): """Initialize default configuration settings """ self.config = {} # Set all default variables self.config['interactive'] = interactive self.config['debug_enabled'] = debug self.config['flags_options'] = False self.config['local_language'] = u'en' self.config['simu... | |
self._releaseCallback(self.id) | self._releaseCallback(self.id, self.connection) | def _release(self): if self._releaseCallback is not None: self._releaseCallback(self.id) |
self._pool.pop() | conn = self._pool.pop() conn.close() | def resizePool(self, size): if size < 1: size = 1 diff = size - self._poolsize self._poolsize = size |
self._inuse.popitem() | key,conn = self._inuse.popitem() conn.close() | def resizePool(self, size): if size < 1: size = 1 diff = size - self._poolsize self._poolsize = size |
def release(self, id): | def release(self, id, conn): | def release(self, id): try: conn = self._inuse.pop(id) self._pool.append(conn) except KeyError: pass |
pass | conn.close() self.log(MythLog.DATABASE, 'Closing spare database connection') | def release(self, id): try: conn = self._inuse.pop(id) self._pool.append(conn) except KeyError: pass |
self.send("exit") | self.socket.send("exit") | def disconnect(self): if not self.isConnected: return self.send("exit") self.socket.close() self.socket = None self.isConnected = False |
self.pos = self.joinInt(int(res[0]),int(res[1])) | self.pos = self.control.joinInt(int(res[0]),int(res[1])) | def seek(self, offset, whence=0): """ FileTransfer.seek(offset, whence=0) -> None Seek 'offset' number of bytes whence == 0 - from start of file 1 - from current position 2 - from end of file """ if whence == 0: if offset < 0: offset = 0 if offset > self.size: offset = self.size elif whence == 1: if offset + self.pos <... |
def execute(self, query, args=()): | def execute(self, query, args=None): | def execute(self, query, args=()): self.ping() self.log_query(query, args) try: return MySQLdb.cursors.Cursor.execute(self, query, args) except Exception, e: raise MythDBError(MythDBError.DB_RAW, e.args) |
return MySQLdb.cursors.Cursor.execute(self, query, args) | if args: return MySQLdb.cursors.Cursor.execute(self, query, args) else: return MySQLdb.cursors.Cursor.execute(self, query) | def execute(self, query, args=()): self.ping() self.log_query(query, args) try: return MySQLdb.cursors.Cursor.execute(self, query, args) except Exception, e: raise MythDBError(MythDBError.DB_RAW, e.args) |
if directory == 'banner' and program['subtitle'] == '': | if directory == 'banner' and not program['subtitle']: | def _downloadScheduledRecordedGraphics(self): '''Get Scheduled and Recorded programs and Miro vidoes get their graphics if not already downloaded return (nothing is returned) ''' global localhostname |
urlFilter = etree.XPath('//sourceURL[@url=$url]', namespaces=self.common.namespaces) | urlFilter = etree.XPath('//sourceURL[@url=$url and @name=$name]', namespaces=self.common.namespaces) | def getUserPreferences(self): '''Read the mashups_config.xml and user preference xxxxxMashup.xml file. If the xxxxxMashup.xml file does not exist then copy the default. return nothing ''' # Get mashups_config.xml self.getMashupsConfig() |
defaultSourceURL = urlFilter(defaultPrefs, url=url) | name = sourceURL.attrib['name'] defaultSourceURL = urlFilter(defaultPrefs, url=url, name=name) | def getUserPreferences(self): '''Read the mashups_config.xml and user preference xxxxxMashup.xml file. If the xxxxxMashup.xml file does not exist then copy the default. return nothing ''' # Get mashups_config.xml self.getMashupsConfig() |
sys.stderr.write("! Warning: Series (%s) not found\n" % ( series_name ) ) sys.exit(1) | sys.exit(0) | def searchseries(t, opts, series_season_ep): global SID series_name='' if opts.configure != "" and override.has_key(series_season_ep[0].lower()): series_name=override[series_season_ep[0].lower()][0] # Override series name else: series_name=series_season_ep[0] # Leave the series name alone try: # Search for the series o... |
if len(series_season_ep)>2: sys.stderr.write("! Warning: For Series (%s), season (%s) or Episode (%s) not found \n" % ( series_name, series_season_ep[1], series_season_ep[2] ) ) else: sys.stderr.write("! Warning: For Series (%s), season (%s) not found \n" % ( series_name, series_season_ep[1] ) ) sys.exit(1) | sys.exit(0) | def searchseries(t, opts, series_season_ep): global SID series_name='' if opts.configure != "" and override.has_key(series_season_ep[0].lower()): series_name=override[series_season_ep[0].lower()][0] # Override series name else: series_name=series_season_ep[0] # Leave the series name alone try: # Search for the series o... |
sys.stderr.write( "! Warning: Error contacting www.thetvdb.com:\n%s\n" % (errormsg) ) sys.exit(1) | sys.exit(0) | def searchseries(t, opts, series_season_ep): global SID series_name='' if opts.configure != "" and override.has_key(series_season_ep[0].lower()): series_name=override[series_season_ep[0].lower()][0] # Override series name else: series_name=series_season_ep[0] # Leave the series name alone try: # Search for the series o... |
sys.exit(1) | sys.exit(0) | def searchseries(t, opts, series_season_ep): global SID series_name='' if opts.configure != "" and override.has_key(series_season_ep[0].lower()): series_name=override[series_season_ep[0].lower()][0] # Override series name else: series_name=series_season_ep[0] # Leave the series name alone try: # Search for the series o... |
dbconn['DBPort'] = int(dbconn['DBPort']) if dbconn['DBPort'] == 0: | if 'DBPort' in dbconn: if dbconn['DBPort'] == '0': dbconn['DBPort'] = 3306 else: dbconn['DBPort'] = int(dbconn['DBPort']) else: | def __init__(self, db=None, args=None, **dbconn): self.db = None self.log = MythLog(self.logmodule) self.settings = None if db is not None: # load existing database connection self.log(MythLog.DATABASE, "Loading existing connection", str(db.dbconn)) dbconn.update(db.dbconn) if args is not None: # load user defined argu... |
if dbconn['LocalHostName'] is None: | if 'LocalHostName' in dbconn: if dbconn['LocalHostName'] is None: dbconn['LocalHostName'] = gethostname() else: | def __init__(self, db=None, args=None, **dbconn): self.db = None self.log = MythLog(self.logmodule) self.settings = None if db is not None: # load existing database connection self.log(MythLog.DATABASE, "Loading existing connection", str(db.dbconn)) dbconn.update(db.dbconn) if args is not None: # load user defined argu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.