sgbaird commited on
Commit
2f7fc44
·
verified ·
1 Parent(s): ba694bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -23
app.py CHANGED
@@ -37,28 +37,13 @@ SENSOR_COMMAND_TOPIC = f"command/picow/{PICO_ID}/as7341/read"
37
  SENSOR_DATA_TOPIC = f"color-mixing/picow/{PICO_ID}/as7341"
38
 
39
  channel_id = "UCHBzCfYpGwoqygH9YNh9A6g"
40
- playlist_id = "PL8uZlc2CEpelFebA8UgFMQP4Y1d5X_pME"
41
-
42
- video_id = get_latest_video_id(channel_id, playlist_id = playlist_id)
43
- print(f"[DEBUG]video id: {video_id}")
44
-
45
- def refresh_video():
46
- video_id = get_latest_video_id(channel_id, playlist_id = "PL8uZlc2CEpelf9jikjX0cCCEzOVtHaPDA")
47
- print(f"[DEBUG]video id: {video_id}")
48
- iframe_html = f'''
49
- <div style="position: relative; width: 100%; padding-top: 56.25%;">
50
- <iframe
51
- style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
52
- src="https://www.youtube.com/embed/{video_id}"
53
- title="OT-2 Livestream"
54
- frameborder="0"
55
- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
56
- referrerpolicy="strict-origin-when-cross-origin"
57
- allowfullscreen>
58
- </iframe>
59
- </div>
60
- '''
61
- return iframe_html
62
 
63
 
64
  start_prefect_worker()
@@ -467,7 +452,7 @@ with gr.Blocks(title="OT-2 Liquid Color Matching Experiment Queue") as demo:
467
  gr.Markdown("### YouTube Livestream")
468
 
469
  def refresh_iframe():
470
- video_id = get_latest_video_id(channel_id, playlist_id = "PL8uZlc2CEpelf9jikjX0cCCEzOVtHaPDA")
471
  print(f"[DEBUG]video id: {video_id}")
472
  return f'''
473
  <div style="position: relative; width: 100%; padding-top: 56.25%;">
 
37
  SENSOR_DATA_TOPIC = f"color-mixing/picow/{PICO_ID}/as7341"
38
 
39
  channel_id = "UCHBzCfYpGwoqygH9YNh9A6g"
40
+
41
+ # Single source of truth for the playlist you care about
42
+ PLAYLIST_ID = "PL8uZlc2CEpelFebA8UgFMQP4Y1d5X_pME"
43
+
44
+ # Optional: initial fetch/log (not strictly required by Gradio app)
45
+ video_id = get_latest_video_id(channel_id, playlist_id=PLAYLIST_ID)
46
+ print(f"[DEBUG] initial video id: {video_id}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
 
49
  start_prefect_worker()
 
452
  gr.Markdown("### YouTube Livestream")
453
 
454
  def refresh_iframe():
455
+ video_id = get_latest_video_id(channel_id, playlist_id = PLAYLIST_ID)
456
  print(f"[DEBUG]video id: {video_id}")
457
  return f'''
458
  <div style="position: relative; width: 100%; padding-top: 56.25%;">