|
@@ -16,10 +16,12 @@ from base64 import b64decode
|
|
|
from threading import Thread
|
|
|
from multiprocessing import Process
|
|
|
from argparse import ArgumentParser
|
|
|
+from subprocess import Popen, PIPE
|
|
|
import logging as log
|
|
|
import firebase_admin
|
|
|
import mutagen.mp3
|
|
|
import OpenSSL.SSL
|
|
|
+import subprocess
|
|
|
import requests
|
|
|
import dateutil
|
|
|
import sqlite3
|
|
@@ -438,6 +440,13 @@ def cloud_download(ad_key=None):
|
|
|
with open(out_file, "wb") as fp:
|
|
|
fp.write(response.content)
|
|
|
tp = (out_file, md5sum,)
|
|
|
+ p = Popen(['ffprobe', '-v', 'error', '-select_streams', 'a:0', '-show_entries', 'stream=codec_name', '-of', 'default=nokey=1:noprint_wrappers=1', out_file], stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
|
|
+ rc = p.returncode
|
|
|
+ if rc != 'mp3\n':
|
|
|
+ log.info('[process_segment] file {} is not mp3'.format(out_file))
|
|
|
+ subprocess.call(['mv', out_file, out_file + '.old'])
|
|
|
+ subprocess.call(['ffmpeg', '-hide_banner', '-loglevel', 'panic', '-i', out_file + '.old', '-f', 'mp3', out_file])
|
|
|
+ subprocess.call(['rm', '-rf', out_file + '.old'])
|
|
|
cloud_cache[ad_key] = tp
|
|
|
return tp
|
|
|
|