rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
return cls.strptime(rfctime, '%a, %d %b %Y %H:%M:%S %Z').strip() | return cls.strptime(rfctime.strip(), '%a, %d %b %Y %H:%M:%S %Z') | def fromRfc(cls, rfctime): return cls.strptime(rfctime, '%a, %d %b %Y %H:%M:%S %Z').strip() |
_parselevel = staticmethod(_parselevel) | def _parselevel(lstr=None): bwlist = ( 'important','general','record','playback','channel','osd', 'file','schedule','network','commflag','audio','libav', 'jobqueue','siparser','eit','vbi','database','dsmcc', 'mheg','upnp','socket','xmltv','dvbcam','media','idle', 'channelscan','extra','timestamp') if lstr: level = Myt... | |
curhigh,curlow = self.splitInt(self.pos) offhigh,offlow = self.splitInt(offset) | curhigh,curlow = self.control.splitInt(self.pos) offhigh,offlow = self.control.splitInt(offset) | 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 <... |
width_height = re.compile(u'''^(.+?)[ ]\[?([0-9]+)x([0-9]+)[^\\/]*$''', re.UNICODE) | width_height = re.compile(u'''^(.+?)\[?([0-9]+)x([0-9]+)\\,[^\\/]''', re.UNICODE) | def getVideoDetails(videofilename, screenshot=False): '''Using ffmpeg (if it can be found) get a video file's details return False if ffmpeg is cannot be found return empty dictionary if the file is not a video return dictionary of the Video's details ''' ffmpeg_details = {u'video': u'', u'audio': u'', u'duration': 0, ... |
cmd = u'ffmpeg -i "%s" -y -f image2 -ss %d -sameq -t 0.001 -s %d*%d "%s"' | cmd = u'ffmpeg -i "%s" -y -f image2 -ss %d -sameq -vframes 1 -s %d*%d "%s"' | def takeScreenShot(videofile, screenshot_filename, size_limit=False, just_demensions=False): '''Take a screen shot 1/8th of the way into a video file return the fully qualified screen shot name >>> True - If the screenshot was created >>> False - If ffmpeg could not find details for the video file ''' try: ffmpeg_detai... |
video_details = self.videoDetails(item['id']) | video_details = self.videoDetails(item['id'], urllib.quote(item['title'].encode("utf-8"))) | def searchTitle(self, title, pagenumber, pagelen): '''Key word video search of the MTV web site return an array of matching item dictionaries return ''' url = self.config[u'urls'][u'video.search'] % (urllib.quote_plus(title.encode("utf-8")), pagenumber , pagelen,) if self.config['debug_enabled']: print url print |
def videoDetails(self, url): | def videoDetails(self, url, title=u''): | def videoDetails(self, url): '''Using the passed URL retrieve the video meta data details return a dictionary of video metadata details return ''' if self.config['debug_enabled']: print url print |
metadata['video'] = e.get('url') | index = e.get('url').rindex(u':') metadata['video'] = self.mtvHtmlPath % (title, e.get('url')[index+1:]) | def videoDetails(self, url): '''Using the passed URL retrieve the video meta data details return a dictionary of video metadata details return ''' if self.config['debug_enabled']: print url print |
sys.stdout.write(unicode(items)) | sys.stdout.write(eTree.tostring(items, encoding='UTF-8', method="xml", xml_declaration=True, pretty_print=True, )) | def queryXML(self, url): """Display a Movie query in XML format: http://www.mythtv.org/wiki/MythTV_Universal_Metadata_Format Returns nothing """ try: queryResult = eTree.parse(url, parser=self.xmlParser) except Exception, errmsg: sys.stderr.write(u"! Error: Invalid XML was received from themoviedb.org (%s)\n" % errmsg)... |
sys.stdout.write(unicode(items)) | sys.stdout.write(eTree.tostring(items, encoding='UTF-8', method="xml", xml_declaration=True, pretty_print=True, )) | def videoXML(self, url): """Display a Movie details in XML format: http://www.mythtv.org/wiki/MythTV_Universal_Metadata_Format Returns nothing """ try: videoResult = eTree.parse(url, parser=self.xmlParser) except Exception, errmsg: sys.stderr.write(u"! Error: Invalid XML was received from themoviedb.org (%s)\n" % errms... |
except OSError: logger.critical(u"Trying to copy the Miro file (%s) to the file (%s).\n This maybe a permissions error (mirobridge.py does not have permission to write to the directory)." % (filename ,sym_filepath)) | except OSError, e: logger.critical(u"Trying to copy the Miro file (%s) to the file (%s).\nError(%s)\nThis maybe a permissions error (mirobridge.py does not have permission to write to the directory)." % (filename ,sym_filepath, e)) | def setSymbolic(filename, storagegroupkey, symbolic_name, allow_symlink=False): '''Convert the file into a symbolic name according to it's storage group (there may be no storage group for the key). Check if a symbolic link exists and replace the link with a copy of the file. except for video files. Abort if the file do... |
except OSError: logger.critical(u"Trying to create the Miro file (%s) symlink (%s).\n This maybe a permissions error (mirobridge.py does not have permission to write to the directory)." % sym_filepath) | except OSError, e: logger.critical(u"Trying to create the Miro file (%s) symlink (%s).\nError(%s)\nThis maybe a permissions error (mirobridge.py does not have permission to write to the directory)." % (sym_filepath, e)) | def setSymbolic(filename, storagegroupkey, symbolic_name, allow_symlink=False): '''Convert the file into a symbolic name according to it's storage group (there may be no storage group for the key). Check if a symbolic link exists and replace the link with a copy of the file. except for video files. Abort if the file do... |
except OSError: logger.critical(u"Create Miro Mythvideo directory (%s).\nThis may be due to a permissions error." % (miro_path)) | except OSError, e: logger.critical(u"Create Miro Mythvideo directory (%s).\nError(%s)\nThis may be due to a permissions error." % (miro_path, e)) | def createMiroMythVideoDirectory(): '''If the "Miro" directory does not exist in MythVideo then create it. abort if there is an issue creating the directory ''' global localhostname, vid_graphics_dirs, storagegroups, channel_id, flat, simulation, verbose # Check that a MIRO video directory exists # if not then create ... |
except OSError: logger.critical(u"File (%s) copy to (%s) failed.\nThis may be due to a permissions error." % (miro_cover, miro_icon_filename)) | except OSError, e: logger.critical(u"File (%s) copy to (%s) failed.\nError(%s)\nThis may be due to a permissions error." % (miro_cover, miro_icon_filename, e)) | def createMiroMythVideoDirectory(): '''If the "Miro" directory does not exist in MythVideo then create it. abort if there is an issue creating the directory ''' global localhostname, vid_graphics_dirs, storagegroups, channel_id, flat, simulation, verbose # Check that a MIRO video directory exists # if not then create ... |
except OSError: logger.critical(u"Creation of MythVideo 'Miro' directory (%s) failed.\nThis may be due to a permissions error." % (miro_path)) | except OSError, e: logger.critical(u"Creation of MythVideo 'Miro' directory (%s) failed.\nError(%s)\nThis may be due to a permissions error." % (miro_path, e)) | def createMiroMythVideoDirectory(): '''If the "Miro" directory does not exist in MythVideo then create it. abort if there is an issue creating the directory ''' global localhostname, vid_graphics_dirs, storagegroups, channel_id, flat, simulation, verbose # Check that a MIRO video directory exists # if not then create ... |
except OSError: logger.critical(u"Creation of MythVideo 'Miro' subdirectory path (%s) failed.\nThis may be due to a permissions error." % (path)) | except OSError, e: logger.critical(u"Creation of MythVideo 'Miro' subdirectory path (%s) failed.\nError(%s)\nThis may be due to a permissions error." % (path, e)) | def createMiroChannelSubdirectory(item): '''Create the Miro Channel subdirectory in MythVideo abort if the subdirectory cannot be made ''' global localhostname, vid_graphics_dirs, storagegroups, channel_id, flat, simulation, verbose miro = u'Miro' path = u"%s%s/%s" % (vid_graphics_dirs[u'mythvideo'], miro, sanitiseFil... |
except OSError: logger.critical(u"Copying subdirectory cache icon(%s) cover file(%s) failed.\nThis may be due to a permissions error." % (item[u'channel_icon'], cover_filename_path)) | except OSError, e: logger.critical(u"Copying subdirectory cache icon(%s) cover file(%s) failed.\nError(%s)\nThis may be due to a permissions error." % (item[u'channel_icon'], cover_filename_path, e)) | def createMiroChannelSubdirectory(item): '''Create the Miro Channel subdirectory in MythVideo abort if the subdirectory cannot be made ''' global localhostname, vid_graphics_dirs, storagegroups, channel_id, flat, simulation, verbose miro = u'Miro' path = u"%s%s/%s" % (vid_graphics_dirs[u'mythvideo'], miro, sanitiseFil... |
except OSError: logger.info(u"Miro video file has been removed (%s) outside of mirobridge" % (storagegroups[u'default']+record[u'basename'],)) | except OSError, e: logger.info(u"Miro video file has been removed (%s) outside of mirobridge\nError(%s)" % (storagegroups[u'default']+record[u'basename'], e)) | 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... |
except OSError: logger.critical(u"Copying an icon file(%s) to coverart file(%s) failed.\nThis may be due to a permissions error." (item[u'channel_icon'], coverart_filename)) | except OSError, e: logger.critical(u"Copying an icon file(%s) to coverart file(%s) failed.\nError(%s)\nThis may be due to a permissions error." (item[u'channel_icon'], coverart_filename, e)) | 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... |
except OSError: logger.critical(u"Creating screenshot file(%s) as(%s) failed.\nThis may be due to a permissions error." (item[u'screenshot'], screenshot_recorded)) | except OSError, e: logger.critical(u"Creating screenshot file(%s) as(%s) failed.\nError(%s)\nThis may be due to a permissions error." (item[u'screenshot'], screenshot_recorded, e)) | 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... |
logger.critical(u"Starting Miro Frontend and Backend failed: (%s)" % app.cli_events.startup_failure[0]) print_text(app.cli_events.startup_failure[1]) | logger.critical(u"Starting Miro Frontend and Backend failed: (%s)\n(%s)" % (app.cli_events.startup_failure[0], app.cli_events.startup_failure[1])) | 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... |
self.deadline = deadline | self._deadline = deadline | def __init__(self, host, port, deadline=10.0, test=True): self.isConnected = False self.host = host self.port = int(port) self.log = MythLog('Python Frontend Connection') self.deadline = deadline self.connect(test) |
felist = [cls(addr, port, False) for addr,port in felist] | felist = [cls(addr, port, test=False) for addr,port in felist] | def testList(cls, felist): felist = [cls(addr, port, False) for addr,port in felist] for fe in felist: try: fe._test(2.0) except MythError, e: pass yield fe |
fe._test(2.0) | t = time() fe._test(t + 2.0) | def testList(cls, felist): felist = [cls(addr, port, False) for addr,port in felist] for fe in felist: try: fe._test(2.0) except MythError, e: pass yield fe |
self.socket.setdeadline(self.deadline) | self.socket.setdeadline(self._deadline) | def connect(self, test=True): if self.isConnected: return True self.socket = deadlinesocket(socket.AF_INET, socket.SOCK_STREAM) self.socket.setdeadline(self.deadline) self.socket.log = self.log try: self.socket.connect((self.host, self.port)) except: raise MythFEError(MythError.FE_CONNECTION, self.host, self.port) self... |
for item in etree.fromstring(xml).getiterator('item'): | try: xml = etree.fromstring(xml) except: raise StopIteration for item in xml.getiterator('item'): | def _processMetadata(self, xml): for item in etree.fromstring(xml).getiterator('item'): yield self.cls(item) |
valid_langs = '' for lang in valid_languages: valid_langs+= lang+', ' valid_langs=valid_langs[:-2] sys.stderr.write("! Specified language(%s) must match one of the following languages supported by thetvdb.com wiki:\n(%s)\nDefaulting to English 'en' and ignoring specified language code.\n" % (opts.language, valid_langs)... | def main(): parser = OptionParser(usage=u"%prog usage: ttvdb -hdruviomMPFBDS [parameters]\n <series name or 'series and season number' or 'series and season number and episode number'>\n\nFor details on using ttvdb with Mythvideo see the ttvdb wiki page at:\nhttp://www.mythtv.org/wiki/Ttvdb.py") parser.add_option( "-... | |
return self._DictIterator(2,self) | return self._DictIterator(2) | def __iter__(self): return self._DictIterator(2,self) |
return self._DictIterator(1,self) | return self._DictIterator(1) | def iterkeys(self): """ obj.iterkeys() -> an iterator over the keys of obj ordered by self.field_order """ return self._DictIterator(1,self) |
return self._DictIterator(2,self) | return self._DictIterator(2) | def itervalues(self): """ obj.itervalues() -> an iterator over the values of obj ordered by self.field_order """ return self._DictIterator(2,self) |
return self._DictIterator(3,self) | return self._DictIterator(3) | def iteritems(self): """ obj.iteritems() -> an iterator of over the (key,value) pairs of obj ordered by self.field_order """ return self._DictIterator(3,self) |
def get(self,key): return self._data[key] | def get(self, key, default=None): return self._data.get(key, default) | def get(self,key): return self._data[key] |
def __iter__(self): return self._DictIterator(1,self) | def __iter__(self): return self._DictIterator(1) | def __iter__(self): return self._DictIterator(1,self) |
(key, value, self._host)) | (key, value, host)) | def __setitem__(self, key, value): if key not in self._data: self.__getitem__(key) c = self._db.cursor(self._log) if self._data[key] is None: c.execute("""INSERT INTO settings (value, data, hostname) VALUES (%s,%s,%s)""", (key, value, self._host)) else: if self._host == 'NULL': where = 'IS NULL' wheredat = (value, key)... |
from MythTV import MythDB, DBData, Video, MythVideo, MythBE, FileOps, MythError, MythLog | from MythTV import MythDB, DBData, Video, MythVideo, MythBE, MythError, MythLog | def __getattr__(self, attr): """Delegate everything but write to the stream""" return getattr(self.out, attr) |
table = 'videotypes' where = 'intid=%s' setwheredat = 'self.intid,' logmodule = 'Python VideoType' | _table = 'videotypes' _where = 'intid=%s' _setwheredat = 'self.intid,' _logmodule = 'Python VideoType' | def __getattr__(self, attr): """Delegate everything but write to the stream""" return getattr(self.out, attr) |
self.__dict__['where'] = 'extension=%s' self.__dict__['wheredat'] = 'self.extension,' | self.__dict__['_where'] = 'extension=%s' self.__dict__['_wheredat'] = 'self.extension,' | def __init__(self, id=None, ext=None, db=None, raw=None): if raw is not None: DBData.__init__(self, db=db, raw=raw) elif id is not None: DBData.__init__(self, data=(id,), db=db) elif ext is not None: self.__dict__['where'] = 'extension=%s' self.__dict__['wheredat'] = 'self.extension,' DBData.__init__(self, data=(ext,),... |
hash_value = FileOps(mythbeconn.hostname).getHash(filename, u'Videos') | hash_value = mythbeconn.getHash(filename, u'Videos') | def hashFile(self, name): '''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 ''' filename = self.rtnRelativePath(name, u'mythvideo') # Use the MythVideo hashing protocol when the video is in a storage groups i... |
progs = MythBE(backend=mythbeconn.hostname, db=mythbeconn.db).getUpcomingRecordings() | progs = mythbeconn.getUpcomingRecordings() | def _getScheduledRecordedProgramList(self): '''Find all Scheduled and Recorded programs return array of found programs, if none then empty array is returned ''' programs=[] |
recordedlist = MythBE(backend=mythbeconn.hostname, db=mythbeconn.db).getRecordings() | recordedlist = mythbeconn.getRecordings() | def _getScheduledRecordedProgramList(self): '''Find all Scheduled and Recorded programs return array of found programs, if none then empty array is returned ''' programs=[] |
self.log(MythLog.ALL, event) | self.log(MythLog.ALL-MythLog.EXTRA, event) | def eventMonitor(self, event=None): if event is None: return re.compile('BACKEND_MESSAGE') self.log(MythLog.ALL, event) |
self._evalwheredat(intid) | self._evalwheredat([intid]) | def _create_autoincrement(self, data=None): """ obj.create(data=None) -> self |
from MythTV import MythDB, DBData, Video, MythVideo, MythBE, MythError, MythLog | from MythTV import MythDB, DBData, Video, MythVideo, MythBE, MythError, MythLog, RecordedProgram | def __getattr__(self, attr): """Delegate everything but write to the stream""" return getattr(self.out, attr) |
print u"\n! Warning - Creating an instance caused an error for one of: MythDBConn or MythVideo, error(%s)\n" % e | print u"\n! Warning - Creating an instance caused an error for one of: MythDB or MythVideo, error(%s)\n" % e | def __getattr__(self, attr): """Delegate everything but write to the stream""" return getattr(self.out, attr) |
@staticmethod def getAll(db=None): db = MythDB(db) c = db.cursor() c.execute("""SELECT * FROM videotypes""") types = [] for row in c.fetchall(): types.append(VideoTypes(db=db, raw=row)) c.close() return types | def __getattr__(self, attr): """Delegate everything but write to the stream""" return getattr(self.out, attr) | |
def __init__(self, id=None, ext=None, db=None, raw=None): if raw is not None: DBData.__init__(self, db=db, raw=raw) elif id is not None: | def __init__(self, id=None, ext=None, db=None): if id is not None: | def __init__(self, id=None, ext=None, db=None, raw=None): if raw is not None: DBData.__init__(self, db=db, raw=raw) elif id is not None: DBData.__init__(self, data=(id,), db=db) elif ext is not None: self.__dict__['_where'] = 'extension=%s' self.__dict__['_wheredat'] = 'self.extension,' DBData.__init__(self, data=(ext,... |
if records: for record in records: if record.groupname in storagegroupnames.keys(): dirname = record.dirname try: dirname = unicode(record.dirname, 'utf8') except (UnicodeDecodeError): sys.stderr.write(u"\n! Error: The local Storage group (%s) directory contained\ncharacters that caused a UnicodeDecodeError. This stor... | for record in records: if record.groupname in storagegroupnames.keys(): dirname = record.dirname try: dirname = unicode(record.dirname, 'utf8') except (UnicodeDecodeError): sys.stderr.write(u"\n! Error: The local Storage group (%s) directory contained\ncharacters that caused a UnicodeDecodeError. This storage group ha... | def getStorageGroups(): '''Populate the storage group dictionary with the local host's storage groups. return nothing ''' records = mythdb.getStorageGroup(hostname=localhostname) if records: for record in records: # Only include Video, coverfile, banner, fanart, screenshot and trailers storage groups if record.groupnam... |
records = VideoTypes.getAll() | records = VideoTypes.getAllEntries(mythdb) | def _addMythtvUserFileTypes(self): """Add video file types to the jamu list from the "videotypes" table """ # Get videotypes table field names: try: records = VideoTypes.getAll() except MythError, e: sys.stderr.write(u"\n! Error: Reading videotypes MythTV table: %s\n" % e.args[0]) return False |
if records: for record in records: if record.f_ignore: if record.extension in self.config['video_file_exts']: self.config['video_file_exts'].remove(record.extension) if record.extension.lower() in self.config['video_file_exts']: self.config['video_file_exts'].remove(record.extension.lower()) else: if not record.extens... | for record in records: if record.f_ignore: if record.extension in self.config['video_file_exts']: self.config['video_file_exts'].remove(record.extension) if record.extension.lower() in self.config['video_file_exts']: self.config['video_file_exts'].remove(record.extension.lower()) else: if not record.extension in self.... | def _addMythtvUserFileTypes(self): """Add video file types to the jamu list from the "videotypes" table """ # Get videotypes table field names: try: records = VideoTypes.getAll() except MythError, e: sys.stderr.write(u"\n! Error: Reading videotypes MythTV table: %s\n" % e.args[0]) return False |
recordedlist = mythbeconn.getRecordings() | recordedlist = list(mythdb.searchRecorded(hostname=localhostname)) | def _getScheduledRecordedProgramList(self): '''Find all Scheduled and Recorded programs return array of found programs, if none then empty array is returned ''' programs=[] |
for recordedProgram in recordedlist: try: recordedRecord = recordedProgram.getRecorded() except MythError, e: sys.stderr.write(u"\n! Error: Getting recorded table record: %s\n" % e.args[0]) return programs | for recordedRecord in recordedlist: | def _getScheduledRecordedProgramList(self): '''Find all Scheduled and Recorded programs return array of found programs, if none then empty array is returned ''' programs=[] |
recordedDetails = recordedRecord.getRecordedProgram() | recordedDetails = dict(RecordedProgram.fromRecorded(recordedRecord)) | def _getScheduledRecordedProgramList(self): '''Find all Scheduled and Recorded programs return array of found programs, if none then empty array is returned ''' programs=[] |
if not recordedDetails: | if not len(recordedDetails): | def _getScheduledRecordedProgramList(self): '''Find all Scheduled and Recorded programs return array of found programs, if none then empty array is returned ''' programs=[] |
if not recordedDetails.subtitle: recordedprogram[recordedDetails.title]= u'%d' % recordedDetails.airdate | if not recordedDetails['subtitle']: recordedprogram[recordedDetails['title']]= u'%d' % recordedDetails['airdate'] | def _getScheduledRecordedProgramList(self): '''Find all Scheduled and Recorded programs return array of found programs, if none then empty array is returned ''' programs=[] |
except IOError: | except IOError, errormsg: | def _grabUrl(self, url): try: urlhandle = urllib.urlopen(url) except IOError: raise TmdHttpError(errormsg) return urlhandle.read() |
self.cast = () self.genre = () self.country = () | self.cast = [] self.genre = [] self.country = [] | def __init__(self, opts, jobid=None): if jobid: self.job = Job(jobid) self.chanid = self.job.chanid self.starttime = int("%04d%02d%02d%02d%02d%02d" \ % self.job.starttime.timetuple()[0:6]) self.job.update(status=3) else: self.job = None self.chanid = opts.chanid self.rtime = opts.starttime |
rate = float(tsize*4)/(time.time()-htime.pop()) | rate = float(tsize*4)/(time.time()-htime.pop(0)) | def copy(self): if self.opts.skip: self.vid.hash = self.vid.getHash() return if self.opts.sim: return |
self.job.setComment("%02d%% complete - %s seconds remaining" %\ | self.job.setComment("%02d%% complete - %d seconds remaining" %\ | def copy(self): if self.opts.skip: self.vid.hash = self.vid.getHash() return if self.opts.sim: return |
showName = show.attrib['title'] | showName = show.text | def updateTheWB(self, create=False): ''' Create or update the thewb.xml user preferences file return nothing ''' # Read the default user preferences file url = u'file://%s/nv_python_libs/configs/XML/defaultUserPrefs/thewb.xml' % (baseProcessingDir, ) if not os.path.isfile(url[7:]): raise TheWBConfigFileError(self.error... |
if self.userPrefs.find('treeviewURLS').get('globalmax'): userTheWB.find('treeviewURLS').attrib['globalmax'] = self.userPrefs.find('treeviewURLS').attrib['globalmax'] | def updateTheWB(self, create=False): ''' Create or update the thewb.xml user preferences file return nothing ''' # Read the default user preferences file url = u'file://%s/nv_python_libs/configs/XML/defaultUserPrefs/thewb.xml' % (baseProcessingDir, ) if not os.path.isfile(url[7:]): raise TheWBConfigFileError(self.error... | |
searchVar = u'%s/%s' % (urllib.quote(title.encode("utf-8")).replace(u' ', u'+'), pagenumber) | searchVar = u'?q=%s' % (urllib.quote(title.encode("utf-8")).replace(u' ', u'+')) | def searchTitle(self, title, pagenumber, pagelen, ignoreError=False): '''Key word video search of the TheWB web site return an array of matching item elements return ''' orgURL = self.thewb_config.find('searchURLS').xpath(".//href")[0].text |
searchVar = u'%s/%s' % (urllib.quote(title).replace(u' ', u'+'), pagenumber) | searchVar = u'?q=%s' % (urllib.quote(title).replace(u' ', u'+')) | def searchTitle(self, title, pagenumber, pagelen, ignoreError=False): '''Key word video search of the TheWB web site return an array of matching item elements return ''' orgURL = self.thewb_config.find('searchURLS').xpath(".//href")[0].text |
resultTree = self.common.getUrlData(self.thewb_config.find('searchURLS'), pageFilter=self.thewb_config.find('searchURLS').xpath(".//pageFilter")[0].text) | resultTree = self.common.getUrlData(self.thewb_config.find('searchURLS'), pageFilter=None) | def searchTitle(self, title, pagenumber, pagelen, ignoreError=False): '''Key word video search of the TheWB web site return an array of matching item elements return ''' orgURL = self.thewb_config.find('searchURLS').xpath(".//href")[0].text |
thumbNailFilter = etree.XPath('.//div[@class="episodethumb"]/img') descFilter = etree.XPath('.//div[@class="episodecontent"]/p') linkFilter = etree.XPath('.//div[@class="episodecontent"]/p//a[@href!="javascript:;"]') | thumbNailFilter = etree.XPath('.//div[@class="overlay_thumb_area"]//img') textFilter = etree.XPath('.//div[@class="overlay-bg-middle"]/p') titleFilter = etree.XPath('.//div[@class="overlay_thumb_area"]//a[@title!=""]/@title') descFilter = etree.XPath('.//div[@class="overlay-bg-middle"]/p[@class="overlay_extra overlay_s... | def searchTitle(self, title, pagenumber, pagelen, ignoreError=False): '''Key word video search of the TheWB web site return an array of matching item elements return ''' orgURL = self.thewb_config.find('searchURLS').xpath(".//href")[0].text |
if len(linkFilter(result)): | if linkFilter(result) != None: | def searchTitle(self, title, pagenumber, pagelen, ignoreError=False): '''Key word video search of the TheWB web site return an array of matching item elements return ''' orgURL = self.thewb_config.find('searchURLS').xpath(".//href")[0].text |
title = linkFilter(result)[0].text link = self.common.ampReplace(u'http://www.thewb.com'+linkFilter(result)[0].attrib['href']) descriptionElement = descFilter(result)[0] | title = titleFilter(result)[0].strip() link = u'file://%s/nv_python_libs/configs/HTML/thewb.html?videocode=%s' % (baseProcessingDir, result.attrib['id'].replace(u'video_', u'')) etree.SubElement(thewbItem, "{http://www.mythtv.org/wiki/MythNetvision_Grabber_Script_Format}customhtml").text = 'true' descriptionElement = t... | def searchTitle(self, title, pagenumber, pagelen, ignoreError=False): '''Key word video search of the TheWB web site return an array of matching item elements return ''' orgURL = self.thewb_config.find('searchURLS').xpath(".//href")[0].text |
if not eText.startswith(u'Season ') and not eText.startswith(u'EP '): description=eText continue else: infoList = eText.split(u',') if not len(infoList): | if eText.startswith(u'Season ') or eText.startswith(u'EP'): sed = self.getSeasonEpisode(eText) if not len(sed): | def searchTitle(self, title, pagenumber, pagelen, ignoreError=False): '''Key word video search of the TheWB web site return an array of matching item elements return ''' orgURL = self.thewb_config.find('searchURLS').xpath(".//href")[0].text |
s_e = infoList[0].replace(u'Season',u'').replace(u'EP',u'').strip().split(u' ') if len(s_e) == 1 and can_int(s_e[0].strip()): infoList[0] = u'Ep(%02d)' % int(s_e[0].strip()) episodeNum = s_e[0].strip() elif len(s_e) == 3 and can_int(s_e[0].strip()) and can_int(s_e[2].strip()): infoList[0] = u'S%02dE%02d' % (int(s_e[0].... | infoList = u'S%02dE%02d' % (int(sed[0]), int(sed[1])) seasonNum = u'%d' % int(sed[0]) episodeNum = u'%d' % int(sed[1]) if len(sed) == 5: videoSeconds = int(sed[2])*3600+int(sed[3])*60+int(sed[4]) itemDwnLink(thewbItem)[0].attrib['duration'] = unicode(videoSeconds) elif len(sed) == 4: videoSeconds = int(sed[2])*60+int(... | def searchTitle(self, title, pagenumber, pagelen, ignoreError=False): '''Key word video search of the TheWB web site return an array of matching item elements return ''' orgURL = self.thewb_config.find('searchURLS').xpath(".//href")[0].text |
tmptitle = u'%s: %s %s' % (title[:index].strip(), infoList[0].strip(), title[index:].strip()) | tmptitle = u'%s: %s %s' % (title[:index].strip(), infoList, title[index+1:].strip()) | def searchTitle(self, title, pagenumber, pagelen, ignoreError=False): '''Key word video search of the TheWB web site return an array of matching item elements return ''' orgURL = self.thewb_config.find('searchURLS').xpath(".//href")[0].text |
tmptitle = u'%s %s' % (title, infoList[0].strip()) if not len(infoList) > 1: continue videoSeconds = False videoDuration = infoList[1].strip().replace(u'(', u'').replace(u')', u'').split(u':') try: if len(videoDuration) == 1: videoSeconds = int(videoDuration[0]) elif len(videoDuration) == 2: videoSeconds = int(videoDur... | tmptitle = u'%s: %s' % (title.strip(), infoList) | def searchTitle(self, title, pagenumber, pagelen, ignoreError=False): '''Key word video search of the TheWB web site return an array of matching item elements return ''' orgURL = self.thewb_config.find('searchURLS').xpath(".//href")[0].text |
description = self.common.massageText(description.strip()) | description = self.common.massageText(descFilter(result)[0].strip()) | def searchTitle(self, title, pagenumber, pagelen, ignoreError=False): '''Key word video search of the TheWB web site return an array of matching item elements return ''' orgURL = self.thewb_config.find('searchURLS').xpath(".//href")[0].text |
for feedType in [u'treeviewURLS', u'showDirectories', ]: if self.userPrefs.find(feedType) == None: continue if not len(self.userPrefs.find(feedType).xpath('./url')): continue for rssFeed in self.userPrefs.xpath("//%s/url[@enabled='true']" % feedType): if feedType == u'showDirectories': link = rssFeedsUrl+rssFeed.text e... | for feedType in self.userPrefs.findall('showDirectories'): for rssFeed in self.userPrefs.xpath("//showDirectories/url[@enabled='true']"): link = rssFeedsUrl+rssFeed.text | def displayTreeView(self): '''Gather the The WB feeds then get a max page of videos meta data in each of them Display the results and exit ''' # Get the user preferences that specify which shows and formats they want to be in the treeview try: self.getUserPreferences() except Exception, e: sys.stderr.write(u'%s\n' % e)... |
link = self.common.ampReplace(self.linkFilter(thewbItem)[0].text) | tmpLink = self.linkFilter(thewbItem)[0].text.strip() link = self.common.ampReplace(u'file://%s/nv_python_libs/configs/HTML/thewb.html?videocode=%s' % (baseProcessingDir, tmpLink[tmpLink.rfind(u'/')+1:])) etree.SubElement(newItem, "{http://www.mythtv.org/wiki/MythNetvision_Grabber_Script_Format}customhtml").text = 'true... | def createItems(self, showItems, result, urlName, showName, urlMax=None): '''Create a dictionary of MNV compliant RSS items from the results of a RSS feed show search. Also merge with any items that were found by using the Web search. Identical items use the RSS feed item data over the search item as RSS provides bette... |
if description == None: | if not description: | def createItems(self, showItems, result, urlName, showName, urlMax=None): '''Create a dictionary of MNV compliant RSS items from the results of a RSS feed show search. Also merge with any items that were found by using the Web search. Identical items use the RSS feed item data over the search item as RSS provides bette... |
if eText.startswith(u'Season: ') or eText.startswith(u'EP: '): s_e = eText.replace(u'Season:',u'').replace(u', Episode:',u'').replace(u'EP:',u'').strip().split(u' ') if len(s_e) == 1 and can_int(s_e[0].strip()): eText = u'Ep(%02d)' % int(s_e[0].strip()) episodeNum = s_e[0].strip() elif len(s_e) == 2 and can_int(s_e[0].... | try: if eText.startswith(u'Season: ') or eText.startswith(u'EP: '): s_e = eText.replace(u'Season:',u'').replace(u', Episode:',u'').replace(u'EP:',u'').strip().split(u' ') if len(s_e) == 1 and can_int(s_e[0].strip()): eText = u'Ep(%02d)' % int(s_e[0].strip()) episodeNum = s_e[0].strip() elif len(s_e) == 2 and can_int(s_... | def createItems(self, showItems, result, urlName, showName, urlMax=None): '''Create a dictionary of MNV compliant RSS items from the results of a RSS feed show search. Also merge with any items that were found by using the Web search. Identical items use the RSS feed item data over the search item as RSS provides bette... |
elif eText.startswith(u'Running Time: '): videoDuration = eText.replace(u'Running Time: ', u'').strip().split(u':') if not len(videoDuration): continue videoSeconds = False try: if len(videoDuration) == 1: videoSeconds = int(videoDuration[0]) elif len(videoDuration) == 2: videoSeconds = int(videoDuration[0])*60+int(vid... | def createItems(self, showItems, result, urlName, showName, urlMax=None): '''Create a dictionary of MNV compliant RSS items from the results of a RSS feed show search. Also merge with any items that were found by using the Web search. Identical items use the RSS feed item data over the search item as RSS provides bette... | |
self.db.ping(True) | if MySQLdb.__version__ >= (1,2,2): self.db.ping(True) else: self.db.ping() | def cursor(self, log=None, type=MythDBCursor): self.db.ping(True) c = self.db.cursor(type) if log: c.log = log else: c.log = self.log return c |
for f in cls._ref+[cls._cref[-1]]: | for f in cls._ref+cls._cref[:1]: | def _setClassDefs(cls, db=None): db = DBCache(db) rfields = list(db.tablefields[cls._table[0]]) crfields = list(db.tablefields[cls._table[1]]) |
def findfile(file, sgroup, db=None): """ findfile(file, sgroup, db=None) -> StorageGroup object | def findfile(filename, sgroup, db=None): """ findfile(filename, sgroup, db=None) -> StorageGroup object | def findfile(file, sgroup, db=None): """ findfile(file, sgroup, db=None) -> StorageGroup object Will search through all matching storage groups, searching for file. Returns matching storage group upon success. """ db = DBCache(db) for sg in db.getStorageGroup(groupname=sgroup): # search given group if not sg.local: co... |
if record['subtitle']: | if record['subtitle'] and prog.airdate != None: | def _getScheduledRecordedProgramList(self): '''Find all Scheduled and Recorded programs return array of found programs, if none then empty array is returned ''' programs=[] |
else: | elif prog.airdate != None: | def _getScheduledRecordedProgramList(self): '''Find all Scheduled and Recorded programs return array of found programs, if none then empty array is returned ''' programs=[] |
record['originalairdate'] = prog.airdate[:4] | record['originalairdate'] = prog.airdate.year | def _getScheduledRecordedProgramList(self): '''Find all Scheduled and Recorded programs return array of found programs, if none then empty array is returned ''' global localhostname programs=[] |
signal.signal(signal.SIGALRM, alrm | signal.signal(signal.SIGALRM, alrm) | def alrm(): raise MythBEError('Socket Timeout Reached') |
return self.itervalues() | return self.DictIterator(2,self) | def __iter__(self): return self.itervalues() |
self.field = 0 self.iterdata = self.keys() return self | return self.DictIterator(1,self) | def iterkeys(self): """ obj.iterkeys() -> an iterator over the keys of obj ordered by self.field_order """ self.field = 0 self.iterdata = self.keys() return self |
self.field = 0 self.iterdata = self.values() return self | return self.DictIterator(2,self) | def itervalues(self): """ obj.itervalues() -> an iterator over the values of obj ordered by self.field_order """ self.field = 0 self.iterdata = self.values() return self |
self.field = 0 self.iterdata = self.items() return self def next(self): res = self.iterdata[self.field] self.field += 1 if self.field == len(self.iterdata): del self.field del self.iterdata raise StopIteration return res | return self.DictIterator(3,self) | def iteritems(self): """ obj.iteritems() -> an iterator of over the (key,value) pairs of obj ordered by self.field_order """ self.field = 0 self.iterdata = self.items() return self |
return list(self.field_order) | return list(self.iterkeys()) | def keys(self): """obj.keys() -> list of self.field_order""" return list(self.field_order) |
return [self.data[key] for key in self.field_order] | return list(self.itervalues()) | def values(self): """obj.values() -> list of values, ordered by self.field_order""" return [self.data[key] for key in self.field_order] |
return [(key, self.data[key]) for key in self.field_order] | return list(self.iteritems()) | def items(self): """ obj.items() -> list of (key,value) pairs, ordered by self.field_order """ return [(key, self.data[key]) for key in self.field_order] |
if path: | if path is not None: | def __init__(self, path=None, setting=None, db=None): MythDBBase.__init__(self, db=db) self.log = MythLog(self.logmodule, db=self) self.path = '' if path: self.path = path elif setting: self.path = self.settings[socket.gethostname()][setting] self.returncode = 0 self.stderr = '' |
elif setting: self.path = self.settings[socket.gethostname()][setting] | elif setting is not None: host = socket.gethostname() self.path = self.settings[host][setting] if self.path is None: raise MythDBError(MythError.DB_SETTING, setting, host) else: raise MythError('Invalid input to Grabber()') | def __init__(self, path=None, setting=None, db=None): MythDBBase.__init__(self, db=db) self.log = MythLog(self.logmodule, db=self) self.path = '' if path: self.path = path elif setting: self.path = self.settings[socket.gethostname()][setting] self.returncode = 0 self.stderr = '' |
sqlstatement="""SELECT value, data FROM settings WHERE value IN('DBSchemaVer') | sqlstatement="""SELECT value, data FROM settings WHERE value IN( 'DBSchemaVer', 'ISO639Language0', 'ISO639Language1') | 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=%s AND valu... |
'ISO639Language0', 'ISO639Language1', | 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=%s AND valu... | |
tmdbXpath['lastUpdated'] = self.lastUpdated | self.buildFuncDict() for key in self.FuncDict.keys(): tmdbXpath[key] = self.FuncDict[key] | def queryXML(self, url): """Display a Movie query in XML format: http://www.mythtv.org/wiki/MythTV_Universal_Metadata_Format Returns nothing """ try: queryResult = eTree.parse(url, parser=self.xmlParser) except Exception, errmsg: sys.stderr.write(u"! Error: Invalid XML was received from themoviedb.org (%s)\n" % errmsg)... |
tmdbXpath['lastUpdated'] = self.lastUpdated tmdbXpath['supportedJobs'] = self.supportedJobs tmdbXpath['verifyName'] = self.verifyName tmdbXpath['translateName'] = self.translateName tmdbXpath['makeImageElements'] = self.makeImageElements | self.buildFuncDict() for key in self.FuncDict.keys(): tmdbXpath[key] = self.FuncDict[key] | def videoXML(self, url): """Display a Movie details in XML format: http://www.mythtv.org/wiki/MythTV_Universal_Metadata_Format Returns nothing """ try: videoResult = eTree.parse(url, parser=self.xmlParser) except Exception, errmsg: sys.stderr.write(u"! Error: Invalid XML was received from themoviedb.org (%s)\n" % errms... |
cfg.read(useroptions) | cfg.readfp(codecs.open(useroptions, "r", "utf8")) | def setUseroptions(self, useroptions): """ Change variables through a user supplied configuration file return False and exit the script if there are issues with the configuration file values """ if useroptions[0]=='~': useroptions=os.path.expanduser("~")+useroptions[1:] if os.path.isfile(useroptions) == False: sys.s... |
print "Please choose from the following available frontends:" | if len(frontends) == 0: print "No frontends detected" sys.exit() | def main(w): curses.halfdelay(10) frontend.connect() y,x = w.getmaxyx() mem = w.derwin(4,20,9,0) query_mem(mem) load = w.derwin(5,20,5,0) query_load(load) conn = w.derwin(4,20,2,0) align(2,conn,1,frontend.host) align(2,conn,2,"%s:%d" % frontend.socket.getpeername()) conn.border() time = w.derwin(3,20,0,0) query_tim... |
raise | print "This input will only accept a number. Use Crtl-C to exit" | def main(w): curses.halfdelay(10) frontend.connect() y,x = w.getmaxyx() mem = w.derwin(4,20,9,0) query_mem(mem) load = w.derwin(5,20,5,0) query_load(load) conn = w.derwin(4,20,2,0) align(2,conn,1,frontend.host) align(2,conn,2,"%s:%d" % frontend.socket.getpeername()) conn.border() time = w.derwin(3,20,0,0) query_tim... |
metadata = Video(id=intid, db=mythvideo) | metadata = Video(intid, db=mythvideo) | def _moveVideoFiles(self, target_destination_array): """Copy files or directories to a destination directory. If the -F filename option is set then rename TV series during the move process. The move will be interactive for identifying a movie's IMDB number or TV series if the -i option was also set. If there is a probl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.