Garde en mémoire les films non postés
This commit is contained in:
parent
3b7d260011
commit
8f531febc5
1 changed files with 17 additions and 11 deletions
28
main.py
28
main.py
|
@ -222,27 +222,31 @@ def visit_folder(domain, api, rules, tok):
|
|||
print('film '+film.title+' not added')
|
||||
raise Exception('end')
|
||||
|
||||
# Poste tout les films locaux
|
||||
# Poste tout les films locaux (doit faire une reqête Tmdb, qui peut ne pas marcher)
|
||||
i = 0
|
||||
Lcannot_post = []
|
||||
for film in Lunref:
|
||||
i += 1
|
||||
print('['+str(i)+'/'+str(len(Lunref))+']'+'post:', film.title, str(film.info.get('YEAR')))
|
||||
try:
|
||||
posted = False
|
||||
if 'YEAR' in film.info:
|
||||
if 'YEAR' in film.info: # tente avec l'année spécifié en premier
|
||||
resp = api.post_film(title=film.title, year=film.info['YEAR'])
|
||||
if "id" in resp:
|
||||
print('post: path=',domain['server']+film.path)
|
||||
resp = api.post_file(path=domain['server']+film.path, name=film.name, type='film', type_id=resp["id"])
|
||||
if 'id' in resp:
|
||||
post_markers(api, film, resp['id'])
|
||||
if "id" in resp: # id du film
|
||||
posted = True
|
||||
if not posted:
|
||||
resp = api.post_film(title=film.title)
|
||||
if "id" in resp:
|
||||
resp = api.post_file(path=domain['server']+film.path, name=film.name, type='film', type_id=resp["id"])
|
||||
if 'id' in resp:
|
||||
post_markers(api, film, resp['id'])
|
||||
if "id" in resp: # id du film
|
||||
posted = True
|
||||
|
||||
if posted:
|
||||
print('post: path=',domain['server']+film.path)
|
||||
resp = api.post_file(path=domain['server']+film.path, name=film.name, type='film', type_id=resp["id"])
|
||||
if 'id' in resp: # id du file
|
||||
post_markers(api, film, resp['id'])
|
||||
else:
|
||||
Lcannot_post.append(film)
|
||||
|
||||
print('response:', resp)
|
||||
time.sleep(1)
|
||||
except Exception as e:
|
||||
|
@ -250,6 +254,8 @@ def visit_folder(domain, api, rules, tok):
|
|||
print('film '+film.title+' not posted')
|
||||
raise Exception('end')
|
||||
|
||||
# TODO: traiter les films non postés
|
||||
|
||||
print('visit finished')
|
||||
|
||||
def post_markers(api, file_, fileid):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue