Skip to content

Commit 2150870

Browse files
committed
Be more graceful if timewout during metadata scan
1 parent a6fcb21 commit 2150870

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

tools/plex-bootstraptest.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def alert_callback(data):
103103
""" Listen to the Plex notifier to determine when metadata scanning is complete.
104104
* state=1 means record processed, when no metadata source was set
105105
* state=5 means record processed, applicable only when metadata source was set
106+
{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}
106107
"""
107108
global processed_media
108109
print(data)
@@ -113,12 +114,13 @@ def alert_callback(data):
113114
if 'mediaState' not in entry and entry['type'] in expected_media_type:
114115
# state=5 means record processed, applicable only when metadata source was set
115116
if entry['state'] == 5:
116-
cnt = 1
117-
# Workaround for old Plex versions which not reports individual episodes' progress
118-
if entry['type'] == SEARCHTYPES['show']:
119-
show = server.library.sectionByID(str(entry['sectionID'])).get(entry['title'])
120-
cnt = show.leafCount
121-
bar.update(cnt)
117+
bar.update()
118+
# cnt = 1
119+
# # Workaround for old Plex versions which not reports individual episodes' progress
120+
# if entry['type'] == SEARCHTYPES['show']:
121+
# show = server.library.sectionByID(str(entry['sectionID'])).get(entry['title'])
122+
# cnt = show.leafCount
123+
# bar.update(cnt)
122124
# state=1 means record processed, when no metadata source was set
123125
elif entry['state'] == 1 and entry['type'] == SEARCHTYPES['photo']:
124126
bar.update()
@@ -130,7 +132,7 @@ def alert_callback(data):
130132
add_library_section(server, section)
131133
while bar.n < bar.total:
132134
if runtime >= opts.bootstrap_timeout:
133-
print('Metadata scan taking too long, probably something went really wrong')
135+
print('Metadata scan taking too long, but will continue anyway..')
134136
exit(1)
135137
time.sleep(3)
136138
runtime = time.time() - start

0 commit comments

Comments
 (0)