Spaces:
Sleeping
Sleeping
Commit
·
7e5e159
1
Parent(s):
766ff27
Cleanup
Browse files- Functions/video_player_functions.py +1 -1
- README.md +12 -6
- Resources/localization.py +3 -2
- app.py +2 -2
Functions/video_player_functions.py
CHANGED
|
@@ -33,4 +33,4 @@ def get_video_link_by_pointer(pointer):
|
|
| 33 |
|
| 34 |
|
| 35 |
def change_video_completion_status(is_complete, video_pointer):
|
| 36 |
-
default_app.database().child("videos").child(str(video_pointer)).child("complete").set(is_complete)
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
def change_video_completion_status(is_complete, video_pointer):
|
| 36 |
+
default_app.database().child("videos").child(str(video_pointer)).child("complete").set(is_complete)
|
README.md
CHANGED
|
@@ -13,22 +13,28 @@ hf_oauth: true
|
|
| 13 |
# Database structure
|
| 14 |
2 main endpoints: Videos and video_captions.
|
| 15 |
|
| 16 |
-
###
|
| 17 |
-
Contains a json object with YouTube links to the videos
|
|
|
|
| 18 |
|
| 19 |
Example entry:
|
| 20 |
```
|
| 21 |
-
0:
|
|
|
|
|
|
|
| 22 |
```
|
| 23 |
|
| 24 |
Keys are `integers`.
|
| 25 |
They define the order in which the videos show up on the page.
|
| 26 |
-
|
| 27 |
|
| 28 |
-
Values are
|
|
|
|
| 29 |
Format is flexible, can optionally include `https://` or a query string.
|
| 30 |
|
| 31 |
-
|
|
|
|
|
|
|
| 32 |
Editing/uploading new entries requires changing access rules.
|
| 33 |
|
| 34 |
### video_captions
|
|
|
|
| 13 |
# Database structure
|
| 14 |
2 main endpoints: Videos and video_captions.
|
| 15 |
|
| 16 |
+
### videos
|
| 17 |
+
Contains a json object with YouTube links to the videos and
|
| 18 |
+
a boolean for whether the captions for that video are complete.
|
| 19 |
|
| 20 |
Example entry:
|
| 21 |
```
|
| 22 |
+
0:
|
| 23 |
+
url: "https://www.youtube.com/watch?v=tkMg8g8vVUo"
|
| 24 |
+
complete: true
|
| 25 |
```
|
| 26 |
|
| 27 |
Keys are `integers`.
|
| 28 |
They define the order in which the videos show up on the page.
|
| 29 |
+
Videos for which the captions are complete will be skipped.
|
| 30 |
|
| 31 |
+
Values are json objects with `url` and `complete` keys. All keys are mandatory.
|
| 32 |
+
`url`s are video link `strings`.
|
| 33 |
Format is flexible, can optionally include `https://` or a query string.
|
| 34 |
|
| 35 |
+
`complete`s are booleans.
|
| 36 |
+
|
| 37 |
+
`url` is read-only, `complete` is writable.
|
| 38 |
Editing/uploading new entries requires changing access rules.
|
| 39 |
|
| 40 |
### video_captions
|
Resources/localization.py
CHANGED
|
@@ -41,7 +41,7 @@ STRINGS = {
|
|
| 41 |
"save_failed": "Save failed:",
|
| 42 |
"invalid_time_format": "Invalid time format:",
|
| 43 |
"error": "Error:",
|
| 44 |
-
"all_videos_transcribed": "All videos transcribed
|
| 45 |
},
|
| 46 |
"uk": {
|
| 47 |
# Header and login
|
|
@@ -80,10 +80,11 @@ STRINGS = {
|
|
| 80 |
"save_failed": "Помилка збереження:",
|
| 81 |
"invalid_time_format": "Невірний формат часу:",
|
| 82 |
"error": "Помилка:",
|
| 83 |
-
"all_videos_transcribed": "Усі відео
|
| 84 |
}
|
| 85 |
}
|
| 86 |
|
|
|
|
| 87 |
def get_string(key):
|
| 88 |
"""Get localized string by key"""
|
| 89 |
return STRINGS[LANGUAGE].get(key, key)
|
|
|
|
| 41 |
"save_failed": "Save failed:",
|
| 42 |
"invalid_time_format": "Invalid time format:",
|
| 43 |
"error": "Error:",
|
| 44 |
+
"all_videos_transcribed": "Save cancelled: All videos transcribed",
|
| 45 |
},
|
| 46 |
"uk": {
|
| 47 |
# Header and login
|
|
|
|
| 80 |
"save_failed": "Помилка збереження:",
|
| 81 |
"invalid_time_format": "Невірний формат часу:",
|
| 82 |
"error": "Помилка:",
|
| 83 |
+
"all_videos_transcribed": "Відміна збереження: Усі відео розмічено",
|
| 84 |
}
|
| 85 |
}
|
| 86 |
|
| 87 |
+
|
| 88 |
def get_string(key):
|
| 89 |
"""Get localized string by key"""
|
| 90 |
return STRINGS[LANGUAGE].get(key, key)
|
app.py
CHANGED
|
@@ -9,7 +9,7 @@ from Resources.localization import get_string
|
|
| 9 |
next_video_pointer = 0
|
| 10 |
user = "anonymous_user"
|
| 11 |
n_videos = 21
|
| 12 |
-
placeholder_link = "https://www.youtube.com/watch?v=
|
| 13 |
|
| 14 |
|
| 15 |
def get_username(profile: gr.OAuthProfile):
|
|
@@ -55,7 +55,7 @@ def save_entry(df, start_time, text, end_time, selected_row_idx, video_id):
|
|
| 55 |
if user == "anonymous_user":
|
| 56 |
return df, gr.update(visible=True), gr.Warning(get_string("please_sign_in"))
|
| 57 |
if next_video_pointer == -1:
|
| 58 |
-
return df, gr.update(visible=True), gr.
|
| 59 |
try:
|
| 60 |
start_time = float(start_time)
|
| 61 |
end_time = float(end_time)
|
|
|
|
| 9 |
next_video_pointer = 0
|
| 10 |
user = "anonymous_user"
|
| 11 |
n_videos = 21
|
| 12 |
+
placeholder_link = "https://www.youtube.com/watch?v=wTQjwG2-ePA"
|
| 13 |
|
| 14 |
|
| 15 |
def get_username(profile: gr.OAuthProfile):
|
|
|
|
| 55 |
if user == "anonymous_user":
|
| 56 |
return df, gr.update(visible=True), gr.Warning(get_string("please_sign_in"))
|
| 57 |
if next_video_pointer == -1:
|
| 58 |
+
return df, gr.update(visible=True), gr.Warning(get_string("all_videos_transcribed"))
|
| 59 |
try:
|
| 60 |
start_time = float(start_time)
|
| 61 |
end_time = float(end_time)
|