mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-22 11:43:13 +00:00
Be more graceful if timewout during metadata scan
This commit is contained in:
parent
a6fcb21c12
commit
21508703be
1 changed files with 9 additions and 7 deletions
|
@ -103,6 +103,7 @@ def create_section(server, section, opts):
|
||||||
""" Listen to the Plex notifier to determine when metadata scanning is complete.
|
""" Listen to the Plex notifier to determine when metadata scanning is complete.
|
||||||
* state=1 means record processed, when no metadata source was set
|
* state=1 means record processed, when no metadata source was set
|
||||||
* state=5 means record processed, applicable only when metadata source was set
|
* state=5 means record processed, applicable only when metadata source was set
|
||||||
|
{u'StatusNotification': [{u'notificationName': u'LIBRARY_UPDATE', u'description': u'Extra information may still be downloading from the Internet', u'title': u'Library scan complete'}], u'type': u'status', u'size': 1}
|
||||||
"""
|
"""
|
||||||
global processed_media
|
global processed_media
|
||||||
print(data)
|
print(data)
|
||||||
|
@ -113,12 +114,13 @@ def create_section(server, section, opts):
|
||||||
if 'mediaState' not in entry and entry['type'] in expected_media_type:
|
if 'mediaState' not in entry and entry['type'] in expected_media_type:
|
||||||
# state=5 means record processed, applicable only when metadata source was set
|
# state=5 means record processed, applicable only when metadata source was set
|
||||||
if entry['state'] == 5:
|
if entry['state'] == 5:
|
||||||
cnt = 1
|
bar.update()
|
||||||
# Workaround for old Plex versions which not reports individual episodes' progress
|
# cnt = 1
|
||||||
if entry['type'] == SEARCHTYPES['show']:
|
# # Workaround for old Plex versions which not reports individual episodes' progress
|
||||||
show = server.library.sectionByID(str(entry['sectionID'])).get(entry['title'])
|
# if entry['type'] == SEARCHTYPES['show']:
|
||||||
cnt = show.leafCount
|
# show = server.library.sectionByID(str(entry['sectionID'])).get(entry['title'])
|
||||||
bar.update(cnt)
|
# cnt = show.leafCount
|
||||||
|
# bar.update(cnt)
|
||||||
# state=1 means record processed, when no metadata source was set
|
# state=1 means record processed, when no metadata source was set
|
||||||
elif entry['state'] == 1 and entry['type'] == SEARCHTYPES['photo']:
|
elif entry['state'] == 1 and entry['type'] == SEARCHTYPES['photo']:
|
||||||
bar.update()
|
bar.update()
|
||||||
|
@ -130,7 +132,7 @@ def create_section(server, section, opts):
|
||||||
add_library_section(server, section)
|
add_library_section(server, section)
|
||||||
while bar.n < bar.total:
|
while bar.n < bar.total:
|
||||||
if runtime >= opts.bootstrap_timeout:
|
if runtime >= opts.bootstrap_timeout:
|
||||||
print('Metadata scan taking too long, probably something went really wrong')
|
print('Metadata scan taking too long, but will continue anyway..')
|
||||||
exit(1)
|
exit(1)
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
runtime = time.time() - start
|
runtime = time.time() - start
|
||||||
|
|
Loading…
Reference in a new issue