def getDuration(self): duration = self.get("duration") try: duration = float(duration) except ValueError: return 0 else: return format_date(make_date(0, 0, 0, int(duration) / 3600, duration / 60, int(duration % 60)), '%H:%M:%S')
def getDuration(self): duration = self.get("duration") try: duration = float(duration) except ValueError: return 0 else: return format_date( make_date(0, 0, 0, int(duration) / 3600, duration / 60, int(duration % 60)), '%H:%M:%S')
def makeMetaData(self, audiofile): self.attrs["mp3.version"] = audiofile.info.version self.attrs["mp3.layer"] = audiofile.info.layer self.attrs["mp3.bitrate"] = u"{} kBit/s".format(audiofile.info.bitrate / 1000) self.attrs["mp3.sample_rate"] = u"{} kHz".format(audiofile.info.sample_rate / 1000) _s = int(audiofile.info.length % 60) _m = audiofile.info.length / 60 _h = int(audiofile.info.length) / 3600 self.attrs["mp3.length"] = format_date(make_date(0, 0, 0, _h, _m, _s), '%Y-%m-%dT%H:%M:%S') if audiofile.tags: for key in audio_frames.keys(): if key in audiofile.tags.keys(): self.attrs["mp3." + audio_frames[key]] = unicode(audiofile.tags[key])
def makeMetaData(self, audiofile): self.set("mp3.version", audiofile.info.version) self.set("mp3.layer", audiofile.info.layer) self.set("mp3.bitrate", str(int(audiofile.info.bitrate) / 1000) + " kBit/s") self.set("mp3.sample_rate", str(float(audiofile.info.sample_rate) / 1000) + " kHz") _s = int(audiofile.info.length % 60) _m = audiofile.info.length / 60 _h = int(audiofile.info.length) / 3600 self.set("mp3.length", format_date(make_date(0, 0, 0, _h, _m, _s), '%Y-%m-%dT%H:%M:%S')) if audiofile.tags: for key in audio_frames.keys(): if key in audiofile.tags.keys(): self.set("mp3." + audio_frames[key], audiofile.tags[key])
def getWeekDay(self, day): dt = make_date(self.period_year, self.period_month, day) return dt.weekday()