def __init__(self, doc, options): global UPLIB_SHARE DocumentParser.__init__(self, doc, options) self.musictrack = options.get("musictrack") self.genre = None self.artwork = None if UPLIB_SHARE is None: c = configurator() UPLIB_SHARE = c.get("uplib-share")
def __init__(self, doc, options): global UPLIB_SHARE DocumentParser.__init__(self, doc, options) self.video = options.get("video") if not self.video: self.video = pyglet.media.load(doc) if not self.video.video_format: raise ValueError("Unknown video format encountered") self.size = self.get_video_size(self.video.video_format.width, self.video.video_format.height, self.video.video_format.sample_aspect) if (UPLIB_SHARE is None) or (self.NSAMPLES is None): c = configurator.default_configurator() UPLIB_SHARE = c.get("uplib-share") self.NSAMPLES = c.get_int("number-of-video-sample-frames", 5) duration = self.video.duration if duration: self.metadata['duration'] = str(duration) if have_hachoir: try: md = hachoir_metadata.extractMetadata(hachoir_parser.createParser( unicode(doc), doc)) d = {} for v in md: if v.values: d[v.key] = v.values[0].value v = d.get("last_modification") if v: self.metadata['last-modified'] = v.isoformat('Z') note("last-modified is %s", self.metadata['last-modified']) v = d.get("creation_date") or v if v: self.metadata['date'] = v.strftime("%m/%d/%Y") mime_type = d.get("mime_type") if mime_type: self.metadata['apparent-mime-type'] = mime_type except: pass # don't try to optimize away blank frames if we don't have many frames self.saveblanks = self.saveblanks or (self.NSAMPLES < 2)
def process (self): resultslist = list() for event, name, uid in self.__events: if event.name == "VEVENT": newoptions = {} newoptions.update(self.__options) newoptions["icsevent"] = event newoptions["icsuid"] = uid newoptions["icsname"] = name newoptions["format"] = "iCalendarEventParser" if hasattr(event, "dtstart"): identifier = "%s[%s @ %s]" % (self.doc, name, event.dtstart.value) else: identifier = "%s[%s]" % (self.doc, name) result = DocumentParser.parse_document(identifier, resultslist, options=newoptions) note("iCalendar: resultslist is %s", resultslist) return resultslist
def __init__(self, doc, options): DocumentParser.__init__(self, doc, options) self.checkocr = false self.__options = options.copy() self.__cards = options.get("parsed-cards")
def __init__(self, doc, options): DocumentParser.__init__(self, doc, options)