Exemplo n.º 1
0
 def check_ffmpeg(self):
     """ 检查系统中是否安装了FFmpeg """
     temp_ff = FFmpeg()
     try:
         # 运行打印ffmpeg版本的命令验证是否安装了ffmpeg
         temp_ff.cmd = "ffmpeg -loglevel quiet"
         temp_ff.run()
     except Exception as e:
         if type(e) == FFExecutableNotFoundError:
             # 如果是FFExecutableNotFoundError,则说明 ffmpeg 没安装,结束程序
             log_print(log_str.ffmpeg_not_found)
             # 将日志写入数据库
             sliclog_obj = self.db.create_sliclog_obj(
                 self.start_time,
                 get_now_time(),
                 self.tasks_count,
                 self.complete_count,
                 self.currentstate,
                 log_str.ffmpeg_not_found,
             )
             self.session.add(sliclog_obj)
             self.session.commit()
             self.session.close()
             # 结束程序
             exit()
Exemplo n.º 2
0
        if "mutiget_by_alias" in _url:
            _response = entry['response']
            j = json.loads(_response['content']['text'])
            _title   = j["c"]['list'][0]["title"]
            logging.info(_title)
        logging.info(_url)
server.stop()
driver.quit()

i = int(input("Download From: "))
j = int(input("Download To: "))
for url_title in url_titles[i-1:j+1]:
    url = url_title[1]
    title = url_title[0]
    # os.system('ffmpeg -protocol_whitelist "file,https,crypto,tcp,tls" -i {} -codec copy "{}.mp4 >> download.log"'.format(url,title))
    try:
        ff = FFmpeg(inputs={url:'-protocol_whitelist "file,https,crypto,tcp,tls"'},
            outputs={'{}.mp4'.format(title):'-codec copy -loglevel error -y'})
        logging.info(ff.cmd())
        ff.run()
    except:
        logging.error(str(i) + ' ' + title + ' download failed')