Spaces:
Running
Running
Commit
·
b35af45
1
Parent(s):
17e1a9e
Complete editing button
Browse files- .gitignore +1 -0
- Functions/video_player_functions.py +9 -2
- app.py +16 -5
.gitignore
CHANGED
|
@@ -83,6 +83,7 @@ http-client.private.env.json
|
|
| 83 |
.idea/ApifoxUploaderProjectSetting.xml
|
| 84 |
|
| 85 |
# Manually added
|
|
|
|
| 86 |
Resources/upload.py
|
| 87 |
Resources/users.json
|
| 88 |
Resources/key.json
|
|
|
|
| 83 |
.idea/ApifoxUploaderProjectSetting.xml
|
| 84 |
|
| 85 |
# Manually added
|
| 86 |
+
video_loader.py
|
| 87 |
Resources/upload.py
|
| 88 |
Resources/users.json
|
| 89 |
Resources/key.json
|
Functions/video_player_functions.py
CHANGED
|
@@ -26,5 +26,12 @@ def get_video_embed_by_id(video_id):
|
|
| 26 |
|
| 27 |
|
| 28 |
def get_video_link_by_pointer(pointer):
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
|
| 28 |
def get_video_link_by_pointer(pointer):
|
| 29 |
+
video = default_app.database().child("videos").child(str(pointer)).get().val()
|
| 30 |
+
while video["complete"]:
|
| 31 |
+
pointer += 1
|
| 32 |
+
video = default_app.database().child("videos").child(str(pointer)).get().val()
|
| 33 |
+
return video["url"], pointer
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def change_video_completion_status(is_complete, video_pointer):
|
| 37 |
+
default_app.database().child("videos").child(str(video_pointer)).child("complete").set(is_complete)
|
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
-
from Functions.video_player_functions import youtube_link_to_id, get_video_link_by_pointer, get_youtube_player_html
|
| 4 |
from Functions.caption_editor_functions import request_captions_by_video_id, save_captions_to_db
|
| 5 |
from Resources.css import css
|
| 6 |
from Resources.js import yt_init_js
|
|
@@ -99,13 +99,18 @@ def cancel_edit():
|
|
| 99 |
return gr.update(visible=False)
|
| 100 |
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
def get_next_components():
|
| 103 |
global next_video_pointer
|
| 104 |
-
next_video_link = get_video_link_by_pointer(next_video_pointer)
|
| 105 |
-
next_video_pointer
|
| 106 |
if next_video_link is None:
|
| 107 |
-
next_video_link = get_video_link_by_pointer(0)
|
| 108 |
-
next_video_pointer = 1
|
| 109 |
|
| 110 |
try:
|
| 111 |
next_video_id = youtube_link_to_id(next_video_link)
|
|
@@ -155,6 +160,7 @@ with gr.Blocks(css=css, head=yt_init_js, fill_width=True) as main_page:
|
|
| 155 |
wrap=True
|
| 156 |
)
|
| 157 |
add_entry_button = gr.Button(get_string("add_entry_button"), variant="secondary")
|
|
|
|
| 158 |
|
| 159 |
with gr.Row():
|
| 160 |
with gr.Group(visible=False) as editing_panel:
|
|
@@ -211,6 +217,11 @@ with gr.Blocks(css=css, head=yt_init_js, fill_width=True) as main_page:
|
|
| 211 |
outputs=[editing_panel, start_time_input, text_input, end_time_input, selected_row_idx, save_entry_button]
|
| 212 |
)
|
| 213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
add_entry_button.click(
|
| 215 |
fn=show_add_entry_form,
|
| 216 |
outputs=[editing_panel, start_time_input, text_input, end_time_input, selected_row_idx, save_entry_button]
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
+
from Functions.video_player_functions import youtube_link_to_id, get_video_link_by_pointer, get_youtube_player_html, change_video_completion_status
|
| 4 |
from Functions.caption_editor_functions import request_captions_by_video_id, save_captions_to_db
|
| 5 |
from Resources.css import css
|
| 6 |
from Resources.js import yt_init_js
|
|
|
|
| 99 |
return gr.update(visible=False)
|
| 100 |
|
| 101 |
|
| 102 |
+
def change_completion_status(completion_status):
|
| 103 |
+
global next_video_pointer
|
| 104 |
+
change_video_completion_status(completion_status, next_video_pointer - 1)
|
| 105 |
+
|
| 106 |
+
|
| 107 |
def get_next_components():
|
| 108 |
global next_video_pointer
|
| 109 |
+
next_video_link, link_pointer = get_video_link_by_pointer(next_video_pointer)
|
| 110 |
+
next_video_pointer = link_pointer + 1
|
| 111 |
if next_video_link is None:
|
| 112 |
+
next_video_link, link_pointer = get_video_link_by_pointer(0)
|
| 113 |
+
next_video_pointer = link_pointer + 1
|
| 114 |
|
| 115 |
try:
|
| 116 |
next_video_id = youtube_link_to_id(next_video_link)
|
|
|
|
| 160 |
wrap=True
|
| 161 |
)
|
| 162 |
add_entry_button = gr.Button(get_string("add_entry_button"), variant="secondary")
|
| 163 |
+
editing_complete_checkbox = gr.Checkbox(label=get_string("editing_complete_checkbox"))
|
| 164 |
|
| 165 |
with gr.Row():
|
| 166 |
with gr.Group(visible=False) as editing_panel:
|
|
|
|
| 217 |
outputs=[editing_panel, start_time_input, text_input, end_time_input, selected_row_idx, save_entry_button]
|
| 218 |
)
|
| 219 |
|
| 220 |
+
editing_complete_checkbox.input(
|
| 221 |
+
fn=change_completion_status,
|
| 222 |
+
inputs=editing_complete_checkbox
|
| 223 |
+
)
|
| 224 |
+
|
| 225 |
add_entry_button.click(
|
| 226 |
fn=show_add_entry_form,
|
| 227 |
outputs=[editing_panel, start_time_input, text_input, end_time_input, selected_row_idx, save_entry_button]
|