def __est_size(self, full_path, tsn='', mime=''): # Size is estimated by taking audio and video bit rate adding 2% vInfo = transcode.video_info(full_path) if not mime: compat = False mimetypes = ['video/x-tivo-mpeg'] if self.use_ts(tsn, full_path): mimetypes = ['video/x-tivo-mpeg', 'video/x-tivo-mpeg-ts'] for mimet in mimetypes: compat = transcode.tivo_compatible_video(vInfo, tsn, mimet)[0] if compat: break else: compat = transcode.tivo_compatible_video(vInfo, tsn, mime)[0] if compat: return int(os.path.getsize(unicode(full_path, 'utf-8'))*1.1) else: # Must be re-encoded audioBPS = config.getMaxAudioBR(tsn) * 1000 #audioBPS = config.strtod(config.getAudioBR(tsn)) videoBPS = transcode.select_videostr(full_path, tsn) bitrate = audioBPS + videoBPS return int((self.__duration(full_path) / 1000) * (bitrate * 1.02 / 8))
def __est_size(self, full_path, tsn="", mime=""): # Size is estimated by taking audio and video bit rate adding 2% if transcode.tivo_compatible(full_path, tsn, mime)[0]: return int(os.stat(unicode(full_path, "utf-8")).st_size) else: # Must be re-encoded audioBPS = config.getMaxAudioBR(tsn) * 1000 # audioBPS = config.strtod(config.getAudioBR(tsn)) videoBPS = transcode.select_videostr(full_path, tsn) bitrate = audioBPS + videoBPS return int((self.__duration(full_path) / 1000) * (bitrate * 1.02 / 8))
def __est_size(self, full_path, tsn='', mime=''): # Size is estimated by taking audio and video bit rate adding 2% if transcode.tivo_compatible(full_path, tsn, mime)[0]: return os.path.getsize(unicode(full_path, 'utf-8')) else: # Must be re-encoded audioBPS = config.getMaxAudioBR(tsn) * 1000 #audioBPS = config.strtod(config.getAudioBR(tsn)) videoBPS = transcode.select_videostr(full_path, tsn) bitrate = audioBPS + videoBPS return int( (self.__duration(full_path) / 1000) * (bitrate * 1.02 / 8))