Poste les marqueurs dûs aux flux plutôt que les marqueurs dûs au nom
This commit is contained in:
parent
2517d99909
commit
5424c90e50
1 changed files with 18 additions and 13 deletions
31
main.py
31
main.py
|
@ -458,7 +458,12 @@ def find_by_common(L1, L2, f_prop):
|
||||||
break
|
break
|
||||||
return found
|
return found
|
||||||
|
|
||||||
|
|
||||||
def probe_file(file_, domain):
|
def probe_file(file_, domain):
|
||||||
|
"""
|
||||||
|
Sonde le fichier <file_> du domaine <domain>,
|
||||||
|
afin de récupérer les informations des différents flux audio, vidéo et sous-titres.
|
||||||
|
"""
|
||||||
filename = domain['server'].replace('ftp://', 'ftp://'+domain['username']+':'+domain['password']+'@')+file_.path+'/'+file_.name
|
filename = domain['server'].replace('ftp://', 'ftp://'+domain['username']+':'+domain['password']+'@')+file_.path+'/'+file_.name
|
||||||
print("probe:", filename)
|
print("probe:", filename)
|
||||||
try:
|
try:
|
||||||
|
@ -492,6 +497,12 @@ def probe_file(file_, domain):
|
||||||
return streaminfo
|
return streaminfo
|
||||||
|
|
||||||
def post_probe(api, fileid, probe_data):
|
def post_probe(api, fileid, probe_data):
|
||||||
|
"""
|
||||||
|
Poste les données de sondage du fichier <fileid> via l'api,
|
||||||
|
ce qui inclut les marqueurs, les codecs et le container
|
||||||
|
"""
|
||||||
|
api.clear_file_language(fileid)
|
||||||
|
time.sleep(1)
|
||||||
name1 = None
|
name1 = None
|
||||||
for codec in probe_data['audio']:
|
for codec in probe_data['audio']:
|
||||||
if not name1:
|
if not name1:
|
||||||
|
@ -500,31 +511,25 @@ def post_probe(api, fileid, probe_data):
|
||||||
print('different audio codecs for file:', fileid)
|
print('different audio codecs for file:', fileid)
|
||||||
api.put_audio_codec(fileid, codec['name'])
|
api.put_audio_codec(fileid, codec['name'])
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
if 'lang' in codec:
|
||||||
|
api.post_file_language(fileid, value=codec['lang'])
|
||||||
if 'container' in probe_data:
|
if 'container' in probe_data:
|
||||||
api.put_audio_container(fileid, probe_data['container'])
|
api.put_audio_container(fileid, probe_data['container'])
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if len(probe_data['video']) > 0:
|
if len(probe_data['video']) > 0:
|
||||||
api.put_video_codec(fileid, probe_data['video'][0]['name'])
|
api.put_video_codec(fileid, probe_data['video'][0]['name'])
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
if 'width' in probe_data['video'][0] and 'height' in probe_data['video'][0]:
|
||||||
|
api.post_file_qualities(fileid, value=probe_data['video'][0]['width']+'x'+probe_data['video'][0]['height'])
|
||||||
|
time.sleep(1)
|
||||||
if 'container' in probe_data:
|
if 'container' in probe_data:
|
||||||
api.put_video_container(fileid, probe_data['container'])
|
api.put_video_container(fileid, probe_data['container'])
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
for sub in probe_data['sub']:
|
||||||
def post_markers(api, file_, fileid):
|
|
||||||
"""
|
|
||||||
Poste sur l'api par l'interface <api> tout les marqueurs
|
|
||||||
du fichier <file_>, indexé à l'ID <fileid>
|
|
||||||
"""
|
|
||||||
for lang in file_.markers['lang']:
|
|
||||||
api.post_file_language(fileid, value=lang)
|
|
||||||
time.sleep(1)
|
|
||||||
for qual in file_.markers['quality']:
|
|
||||||
api.post_file_qualities(fileid, value=qual)
|
|
||||||
time.sleep(1)
|
|
||||||
for sub in file_.markers['subtitle']:
|
|
||||||
api.post_file_subtitle(fileid, value=sub)
|
api.post_file_subtitle(fileid, value=sub)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""
|
"""
|
||||||
Fonction principale du programme, réalise toute les opérations
|
Fonction principale du programme, réalise toute les opérations
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue