Spaces:
Sleeping
Sleeping
Commit ·
db1120b
1
Parent(s): 261612d
add nav start/end buttons
Browse files- Resources/localization.py +4 -2
- app.py +15 -4
Resources/localization.py
CHANGED
|
@@ -28,7 +28,8 @@ STRINGS = {
|
|
| 28 |
"caption_text_label": "Caption Text",
|
| 29 |
"caption_text_placeholder": "Enter caption text...",
|
| 30 |
"end_time_label": "End Time (seconds)",
|
| 31 |
-
"
|
|
|
|
| 32 |
"save_entry_button": "Save Entry",
|
| 33 |
"update_entry_button": "Update Entry",
|
| 34 |
"add_entry_button_form": "Add Entry",
|
|
@@ -83,7 +84,8 @@ STRINGS = {
|
|
| 83 |
"caption_text_label": "Текст субтитру",
|
| 84 |
"caption_text_placeholder": "Введіть текст субтитру...",
|
| 85 |
"end_time_label": "Час кінця (секунди)",
|
| 86 |
-
"
|
|
|
|
| 87 |
"save_entry_button": "Зберегти запис",
|
| 88 |
"update_entry_button": "Оновити запис",
|
| 89 |
"add_entry_button_form": "Додати запис",
|
|
|
|
| 28 |
"caption_text_label": "Caption Text",
|
| 29 |
"caption_text_placeholder": "Enter caption text...",
|
| 30 |
"end_time_label": "End Time (seconds)",
|
| 31 |
+
"insert_time_button": "Insert",
|
| 32 |
+
"goto_time_button": "Go to",
|
| 33 |
"save_entry_button": "Save Entry",
|
| 34 |
"update_entry_button": "Update Entry",
|
| 35 |
"add_entry_button_form": "Add Entry",
|
|
|
|
| 84 |
"caption_text_label": "Текст субтитру",
|
| 85 |
"caption_text_placeholder": "Введіть текст субтитру...",
|
| 86 |
"end_time_label": "Час кінця (секунди)",
|
| 87 |
+
"insert_time_button": "Вставити",
|
| 88 |
+
"goto_time_button": "Перейти",
|
| 89 |
"save_entry_button": "Зберегти запис",
|
| 90 |
"update_entry_button": "Оновити запис",
|
| 91 |
"add_entry_button_form": "Додати запис",
|
app.py
CHANGED
|
@@ -204,14 +204,16 @@ with gr.Blocks(css=css, head=yt_init_js, fill_width=True) as main_page:
|
|
| 204 |
gr.Markdown(f"### {get_string('edit_caption_title')}")
|
| 205 |
gr.Markdown(f"**{get_string('start_time_label')}**")
|
| 206 |
with gr.Row():
|
| 207 |
-
start_time_input = gr.Textbox(show_label=False, value="0.000", interactive=False)
|
| 208 |
-
insert_start_time_button = gr.Button(get_string("
|
|
|
|
| 209 |
gr.Markdown(f"**{get_string('caption_text_label')}**")
|
| 210 |
text_input = gr.Textbox(show_label=False, placeholder=get_string("caption_text_placeholder"))
|
| 211 |
gr.Markdown(f"**{get_string('end_time_label')}**")
|
| 212 |
with gr.Row():
|
| 213 |
-
end_time_input = gr.Textbox(show_label=False, value="0.000", interactive=False)
|
| 214 |
-
insert_end_time_button = gr.Button(get_string("
|
|
|
|
| 215 |
with gr.Row():
|
| 216 |
save_entry_button = gr.Button(get_string("save_entry_button"), variant="primary")
|
| 217 |
preview_button = gr.Button(get_string("preview_button"), variant="secondary")
|
|
@@ -309,6 +311,15 @@ with gr.Blocks(css=css, head=yt_init_js, fill_width=True) as main_page:
|
|
| 309 |
js="() => window.ytPlayer ? +window.ytPlayer.getCurrentTime().toFixed(3) : 0"
|
| 310 |
)
|
| 311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
clear_button.click(
|
| 313 |
fn=clear_form,
|
| 314 |
outputs=[start_time_input, text_input, end_time_input, selected_row_idx, save_entry_button]
|
|
|
|
| 204 |
gr.Markdown(f"### {get_string('edit_caption_title')}")
|
| 205 |
gr.Markdown(f"**{get_string('start_time_label')}**")
|
| 206 |
with gr.Row():
|
| 207 |
+
start_time_input = gr.Textbox(show_label=False, value="0.000", interactive=False, scale=0, min_width=100)
|
| 208 |
+
insert_start_time_button = gr.Button(get_string("insert_time_button"), scale=1)
|
| 209 |
+
goto_start_time_button = gr.Button(get_string("goto_time_button"), scale=1)
|
| 210 |
gr.Markdown(f"**{get_string('caption_text_label')}**")
|
| 211 |
text_input = gr.Textbox(show_label=False, placeholder=get_string("caption_text_placeholder"))
|
| 212 |
gr.Markdown(f"**{get_string('end_time_label')}**")
|
| 213 |
with gr.Row():
|
| 214 |
+
end_time_input = gr.Textbox(show_label=False, value="0.000", interactive=False, scale=0, min_width=100)
|
| 215 |
+
insert_end_time_button = gr.Button(get_string("insert_time_button"), scale=1)
|
| 216 |
+
goto_end_time_button = gr.Button(get_string("goto_time_button"), scale=1)
|
| 217 |
with gr.Row():
|
| 218 |
save_entry_button = gr.Button(get_string("save_entry_button"), variant="primary")
|
| 219 |
preview_button = gr.Button(get_string("preview_button"), variant="secondary")
|
|
|
|
| 311 |
js="() => window.ytPlayer ? +window.ytPlayer.getCurrentTime().toFixed(3) : 0"
|
| 312 |
)
|
| 313 |
|
| 314 |
+
goto_start_time_button.click(
|
| 315 |
+
fn=None, inputs=[start_time_input], outputs=None,
|
| 316 |
+
js="(time) => { if (window.ytPlayer) { window.ytPlayer.seekTo(parseFloat(time), true); window.ytPlayer.pauseVideo(); } }"
|
| 317 |
+
)
|
| 318 |
+
goto_end_time_button.click(
|
| 319 |
+
fn=None, inputs=[end_time_input], outputs=None,
|
| 320 |
+
js="(time) => { if (window.ytPlayer) { window.ytPlayer.seekTo(parseFloat(time), true); window.ytPlayer.pauseVideo(); } }"
|
| 321 |
+
)
|
| 322 |
+
|
| 323 |
clear_button.click(
|
| 324 |
fn=clear_form,
|
| 325 |
outputs=[start_time_input, text_input, end_time_input, selected_row_idx, save_entry_button]
|