Spaces:
Running
Running
Commit
·
55b41e4
1
Parent(s):
5580bab
Bug fix 1
Browse files
app.py
CHANGED
|
@@ -110,27 +110,26 @@ def change_completion_status(completion_status):
|
|
| 110 |
|
| 111 |
def get_next_components(show_incomplete_only):
|
| 112 |
global next_video_pointer
|
| 113 |
-
if
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
next_video_link = get_video_link_by_pointer(next_video_pointer, show_incomplete_only)
|
| 116 |
next_video_pointer = (next_video_pointer + 1) % n_videos
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
next_video_pointer = -1
|
| 126 |
-
|
| 127 |
-
try:
|
| 128 |
-
next_video_id = youtube_link_to_id(next_video_link)
|
| 129 |
-
next_captions = request_captions_by_video_id(next_video_id)
|
| 130 |
-
return next_captions, next_video_id
|
| 131 |
-
except (ValueError, Exception) as e:
|
| 132 |
-
empty_captions = pd.DataFrame(columns=["Start", "Text", "End"])
|
| 133 |
-
return empty_captions, "error"
|
| 134 |
|
| 135 |
|
| 136 |
(start_captions, start_video_id) = get_next_components(True)
|
|
|
|
| 110 |
|
| 111 |
def get_next_components(show_incomplete_only):
|
| 112 |
global next_video_pointer
|
| 113 |
+
if next_video_pointer != -1:
|
| 114 |
+
next_video_link = get_video_link_by_pointer(next_video_pointer, show_incomplete_only)
|
| 115 |
+
next_video_pointer = (next_video_pointer + 1) % n_videos
|
| 116 |
+
|
| 117 |
+
for i in range(n_videos + 1):
|
| 118 |
+
if next_video_link is not None:
|
| 119 |
+
break
|
| 120 |
next_video_link = get_video_link_by_pointer(next_video_pointer, show_incomplete_only)
|
| 121 |
next_video_pointer = (next_video_pointer + 1) % n_videos
|
| 122 |
+
if next_video_link is None:
|
| 123 |
+
next_video_link = placeholder_link
|
| 124 |
+
next_video_pointer = -1
|
| 125 |
|
| 126 |
+
try:
|
| 127 |
+
next_video_id = youtube_link_to_id(next_video_link)
|
| 128 |
+
next_captions = request_captions_by_video_id(next_video_id)
|
| 129 |
+
return next_captions, next_video_id
|
| 130 |
+
except (ValueError, Exception) as e:
|
| 131 |
+
empty_captions = pd.DataFrame(columns=["Start", "Text", "End"])
|
| 132 |
+
return empty_captions, "error"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
|
| 135 |
(start_captions, start_video_id) = get_next_components(True)
|