Browse Source

Add url_extras kludge to embeds

master
The Dod 8 months ago
parent
commit
baf9a652d8
6 changed files with 30 additions and 11 deletions
  1. 2
    1
      app.py
  2. 4
    0
      static/embed.schema.json
  3. 12
    0
      static/media/video-embed.json
  4. 6
    4
      templates/chat.html
  5. 2
    2
      templates/embeds.html
  6. 4
    4
      templates/example.html

+ 2
- 1
app.py View File

53
     url = e.get("url")
53
     url = e.get("url")
54
     if not url:
54
     if not url:
55
         return None
55
         return None
56
-    for key in ["id", "description", "proportions"]:
56
+    for key in ["id", "description", "proportions", "url_extras"]:
57
         val = e.get(key)
57
         val = e.get(key)
58
         if not val:
58
         if not val:
59
             return None
59
             return None
75
     embeds = json.load(open("static/media/video-embed.json"))
75
     embeds = json.load(open("static/media/video-embed.json"))
76
     embeds = [preprocess_embed(e) for e in embeds]
76
     embeds = [preprocess_embed(e) for e in embeds]
77
     embeds = [e for e in embeds if e]
77
     embeds = [e for e in embeds if e]
78
+    print(json.dumps(embeds, indent=4))
78
     return embeds
79
     return embeds
79
 
80
 
80
 def deref_schema(val):
81
 def deref_schema(val):

+ 4
- 0
static/embed.schema.json View File

22
                   }
22
                   }
23
                 ]
23
                 ]
24
             },
24
             },
25
+            "url_extras": {
26
+                "type": "string"
27
+            },
25
             "proportions": {
28
             "proportions": {
26
                 "type": "string",
29
                 "type": "string",
27
                 "enum": [ "16x9", "4x3" ]
30
                 "enum": [ "16x9", "4x3" ]
33
         "required": [
36
         "required": [
34
             "id",
37
             "id",
35
             "url",
38
             "url",
39
+            "url_extras",
36
             "proportions",
40
             "proportions",
37
             "description"
41
             "description"
38
         ]
42
         ]

+ 12
- 0
static/media/video-embed.json View File

2
     {
2
     {
3
         "id": "the_great_bell_chant",
3
         "id": "the_great_bell_chant",
4
         "url": "https://vimeo.com/6518109",
4
         "url": "https://vimeo.com/6518109",
5
+        "url_extras": "&h=605a2f1f84",
5
         "proportions": "16x9",
6
         "proportions": "16x9",
6
         "description": "The Great Bell Chant (The End of Suffering). Read by Thich Nath Hanh, chanted by brother Phap Niem. Buddhist. good as guided meditation. heal the soul. "
7
         "description": "The Great Bell Chant (The End of Suffering). Read by Thich Nath Hanh, chanted by brother Phap Niem. Buddhist. good as guided meditation. heal the soul. "
7
     },
8
     },
8
     {
9
     {
9
         "id": "hallelujah_leonard_cohen",
10
         "id": "hallelujah_leonard_cohen",
10
         "url": "https://www.youtube.com/watch?v=YrLk4vdY28Q",
11
         "url": "https://www.youtube.com/watch?v=YrLk4vdY28Q",
12
+        "url_extras": "",
11
         "proportions": "16x9",
13
         "proportions": "16x9",
12
         "description": "Hallelujah, Hallelujah by Leonard Cohen. Live in London. prayer. Your faith was strong but you needed proof... maybe there's god up there..."
14
         "description": "Hallelujah, Hallelujah by Leonard Cohen. Live in London. prayer. Your faith was strong but you needed proof... maybe there's god up there..."
13
     },
15
     },
14
     {
16
     {
15
         "id": "Be_present_guided_meditation_tnh",
17
         "id": "Be_present_guided_meditation_tnh",
16
         "url": "https://www.youtube.com/watch?v=KRiJN1su3RY",
18
         "url": "https://www.youtube.com/watch?v=KRiJN1su3RY",
19
+        "url_extras": "",
17
         "proportions": "16x9",
20
         "proportions": "16x9",
18
         "description": "Be present. Short guided meditation. 5 minutes. Thich Nhat Hanh"
21
         "description": "Be present. Short guided meditation. 5 minutes. Thich Nhat Hanh"
19
     },
22
     },
20
     {
23
     {
21
         "id": "Notice_Suffering_guided_meditation_tnh",
24
         "id": "Notice_Suffering_guided_meditation_tnh",
22
         "url": "https://www.youtube.com/watch?v=B_ZnE8hs7c4",
25
         "url": "https://www.youtube.com/watch?v=B_ZnE8hs7c4",
26
+        "url_extras": "",
23
         "proportions": "16x9",
27
         "proportions": "16x9",
24
         "description": "Notice when others are Suffering .... and Offer True Presence. Practice Deep Breathing to restore yourself .... so You can Help. Thich Nhat Hanh"
28
         "description": "Notice when others are Suffering .... and Offer True Presence. Practice Deep Breathing to restore yourself .... so You can Help. Thich Nhat Hanh"
25
     },
29
     },
26
     {
30
     {
27
         "id": "coping_with_grief",
31
         "id": "coping_with_grief",
28
         "url": "https://www.youtube.com/watch?v=gsYL4PC0hyk",
32
         "url": "https://www.youtube.com/watch?v=gsYL4PC0hyk",
33
+        "url_extras": "",
29
         "proportions": "16x9",
34
         "proportions": "16x9",
30
         "description": "coping with death, stages, rollercoaster for better or worse, it\u2019s natural, don't be afraid of the pain"
35
         "description": "coping with death, stages, rollercoaster for better or worse, it\u2019s natural, don't be afraid of the pain"
31
     },
36
     },
32
     {
37
     {
33
         "id": "the_evening_thread",
38
         "id": "the_evening_thread",
34
         "url": "https://vimeo.com/349941340",
39
         "url": "https://vimeo.com/349941340",
40
+        "url_extras": "&h=3ecc399ec9#t=1m50s",
35
         "proportions": "4x3",
41
         "proportions": "4x3",
36
         "description": "old lady departing from her daughter or granddaughter, preparing together a small box of memories, she\u2019s flying away as an angel after handing her legacy to the young"
42
         "description": "old lady departing from her daughter or granddaughter, preparing together a small box of memories, she\u2019s flying away as an angel after handing her legacy to the young"
37
     },
43
     },
38
     {
44
     {
39
         "id": "Guided_Meditation_Pain_Relief_Healing",
45
         "id": "Guided_Meditation_Pain_Relief_Healing",
40
         "url": "https://www.youtube.com/watch?v=A33hN1tDopY",
46
         "url": "https://www.youtube.com/watch?v=A33hN1tDopY",
47
+        "url_extras": "&start=6",
41
         "proportions": "16x9",
48
         "proportions": "16x9",
42
         "description": "This meditation is designed to help reduce chronic pain. The relaxation response will counteract the effects of stress and help to reduce pain. Relaxation techniques are safe for anyone to use and do not have the side effects of pain medication."
49
         "description": "This meditation is designed to help reduce chronic pain. The relaxation response will counteract the effects of stress and help to reduce pain. Relaxation techniques are safe for anyone to use and do not have the side effects of pain medication."
43
     },
50
     },
44
     {
51
     {
45
         "id": "2_Minute_Guided_Meditation_for_Spring",
52
         "id": "2_Minute_Guided_Meditation_for_Spring",
46
         "url": "https://www.youtube.com/watch?v=-V3OU_NF4qs",
53
         "url": "https://www.youtube.com/watch?v=-V3OU_NF4qs",
54
+        "url_extras": "",
47
         "proportions": "16x9",
55
         "proportions": "16x9",
48
         "description": "2 Minute Guided Mindful Meditation for Spring: Take a quick break to enjoy this spring-inspired guided meditation."
56
         "description": "2 Minute Guided Mindful Meditation for Spring: Take a quick break to enjoy this spring-inspired guided meditation."
49
     },
57
     },
50
     {
58
     {
51
         "id": "2_Minute_Guided_Meditation_for_Winter",
59
         "id": "2_Minute_Guided_Meditation_for_Winter",
52
         "url": "https://www.youtube.com/watch?v=ZJGgpfx01KE",
60
         "url": "https://www.youtube.com/watch?v=ZJGgpfx01KE",
61
+        "url_extras": "",
53
         "proportions": "16x9",
62
         "proportions": "16x9",
54
         "description": "2 Minute Guided Mindful Meditation for Winter: Take a quick break to enjoy this winter scene guided meditation."
63
         "description": "2 Minute Guided Mindful Meditation for Winter: Take a quick break to enjoy this winter scene guided meditation."
55
     },
64
     },
56
     {
65
     {
57
         "id": "One_minute_guided_meditation",
66
         "id": "One_minute_guided_meditation",
58
         "url": "https://www.youtube.com/watch?v=w-KD1rFZgDg",
67
         "url": "https://www.youtube.com/watch?v=w-KD1rFZgDg",
68
+        "url_extras": "",
59
         "proportions": "16x9",
69
         "proportions": "16x9",
60
         "description": "One minute guided meditation: Take time to slow down... Deep breathing and guided meditation will relieve stress in the body and mind."
70
         "description": "One minute guided meditation: Take time to slow down... Deep breathing and guided meditation will relieve stress in the body and mind."
61
     },
71
     },
62
     {
72
     {
63
         "id": "tibetan_bowl_resonance",
73
         "id": "tibetan_bowl_resonance",
64
         "url": "https://www.youtube.com/watch?v=R8k6elHnFvo",
74
         "url": "https://www.youtube.com/watch?v=R8k6elHnFvo",
75
+        "url_extras": "",
65
         "proportions": "16x9",
76
         "proportions": "16x9",
66
         "description": "Tibetan bowl resonance for inner peace: Healing sounds. Meditative. East asian tradition. Self reflection. Let the soothing vibrations of these ancient Tibetan bowls wash over you, creating a harmonious space within."
77
         "description": "Tibetan bowl resonance for inner peace: Healing sounds. Meditative. East asian tradition. Self reflection. Let the soothing vibrations of these ancient Tibetan bowls wash over you, creating a harmonious space within."
67
     },
78
     },
68
     {
79
     {
69
         "id": "hello_stranger",
80
         "id": "hello_stranger",
70
         "url": "https://vimeo.com/190063150",
81
         "url": "https://vimeo.com/190063150",
82
+        "url_extras": "&h=f9d621f128",
71
         "proportions": "16x9",
83
         "proportions": "16x9",
72
         "description": "Hello stranger: Intimate, deals with being shy, loneliness, shame, not being connected to self, reaching out, seeking close relations, humorous, teasing, humble, touching"
84
         "description": "Hello stranger: Intimate, deals with being shy, loneliness, shame, not being connected to self, reaching out, seeking close relations, humorous, teasing, humble, touching"
73
     }
85
     }

+ 6
- 4
templates/chat.html View File

45
                                             {% endif %}
45
                                             {% endif %}
46
                                         <div class="scrollable">
46
                                         <div class="scrollable">
47
                                             {% if embed %}
47
                                             {% if embed %}
48
+{# @{{ embed.url_extras }}@ #}
48
                                                 {% if embed.type == "youtube" %}
49
                                                 {% if embed.type == "youtube" %}
49
                                                     <div class="iframe-container-{{embed.proportions}}">
50
                                                     <div class="iframe-container-{{embed.proportions}}">
50
-                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}?controls=0" allowfullscreen="allowfullscreen"></iframe>
51
+                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}?controls=0{{ embed.url_extras }}" allowfullscreen="allowfullscreen"></iframe>
51
 						    </div>
52
 						    </div>
52
                                                 {% elif embed.type == "vimeo" %}
53
                                                 {% elif embed.type == "vimeo" %}
53
                                                     <div class="iframe-container-{{embed.proportions}}">
54
                                                     <div class="iframe-container-{{embed.proportions}}">
54
-                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}?title=0&amp;byline=0&amp;portrait=0" allowfullscreen="allowfullscreen"></iframe>
55
+                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}?title=0&amp;byline=0&amp;portrait=0{{ embed.url_extras }}" allowfullscreen="allowfullscreen"></iframe>
55
 						    </div>
56
 						    </div>
56
                                                 {% endif %}
57
                                                 {% endif %}
57
                                             {% endif %}
58
                                             {% endif %}
70
                                             {% endif %}
71
                                             {% endif %}
71
                                             <div class="scrollable">
72
                                             <div class="scrollable">
72
                                                 {% if moment.embed %}
73
                                                 {% if moment.embed %}
74
+{# @{{ moment.embed.url_extras }}@ #}
73
                                                     {% if moment.embed.type == "youtube" %}
75
                                                     {% if moment.embed.type == "youtube" %}
74
                                                         <div class="iframe-container-{{moment.embed.proportions}}">
76
                                                         <div class="iframe-container-{{moment.embed.proportions}}">
75
-                                                          <iframe src="https://www.youtube.com/embed/{{ moment.embed.code }}?controls=0" allowfullscreen="allowfullscreen"></iframe>
77
+                                                          <iframe src="https://www.youtube.com/embed/{{ moment.embed.code }}?controls=0{{ moment.embed.url_extras }}" allowfullscreen="allowfullscreen"></iframe>
76
 							</div>
78
 							</div>
77
                                                     {% elif moment.embed.type == "vimeo" %}
79
                                                     {% elif moment.embed.type == "vimeo" %}
78
                                                         <div class="iframe-container-{{moment.embed.proportions}}">
80
                                                         <div class="iframe-container-{{moment.embed.proportions}}">
79
-                                                          <iframe src="https://player.vimeo.com/video/{{ moment.embed.code }}?title=0&amp;byline=0&amp;portrait=0" allowfullscreen="allowfullscreen"></iframe>
81
+                                                          <iframe src="https://player.vimeo.com/video/{{ moment.embed.code }}?title=0&amp;byline=0&amp;portrait=0{{ moment.embed.url_extras }}" allowfullscreen="allowfullscreen"></iframe>
80
 							</div>
82
 							</div>
81
                                                     {% endif %}
83
                                                     {% endif %}
82
                                                 {% endif %}
84
                                                 {% endif %}

+ 2
- 2
templates/embeds.html View File

41
                                             <div class="scrollable">
41
                                             <div class="scrollable">
42
                                                 {% if embed.type == "youtube" %}
42
                                                 {% if embed.type == "youtube" %}
43
                                                     <div class="iframe-container-{{embed.proportions}}">
43
                                                     <div class="iframe-container-{{embed.proportions}}">
44
-                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}?controls=0" allowfullscreen="allowfullscreen"></iframe>
44
+                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}?controls=0{{ embed.url_extras }}" allowfullscreen="allowfullscreen"></iframe>
45
 						    </div>
45
 						    </div>
46
                                                 {% elif embed.type == "vimeo" %}
46
                                                 {% elif embed.type == "vimeo" %}
47
                                                     <div class="iframe-container-{{embed.proportions}}">
47
                                                     <div class="iframe-container-{{embed.proportions}}">
48
-                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}?title=0&amp;byline=0&amp;portrait=0" allowfullscreen="allowfullscreen"></iframe>
48
+                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}?title=0&amp;byline=0&amp;portrait=0{{ embed.url_extras }}" allowfullscreen="allowfullscreen"></iframe>
49
 						    </div>
49
 						    </div>
50
                                                 {% endif %}
50
                                                 {% endif %}
51
 					        <p>{{ embed.description }}</p>
51
 					        <p>{{ embed.description }}</p>

+ 4
- 4
templates/example.html View File

41
                                             {% if embed %}
41
                                             {% if embed %}
42
                                                 {% if embed.type == "youtube" %}
42
                                                 {% if embed.type == "youtube" %}
43
                                                     <div class="iframe-container-{{embed.proportions}}">
43
                                                     <div class="iframe-container-{{embed.proportions}}">
44
-                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}?controls=0" allowfullscreen="allowfullscreen"></iframe>
44
+                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}?controls=0{{ embed.url_extras }}" allowfullscreen="allowfullscreen"></iframe>
45
                                                     </div>
45
                                                     </div>
46
                                                 {% elif embed.type == "vimeo" %}
46
                                                 {% elif embed.type == "vimeo" %}
47
                                                     <div class="iframe-container-{{embed.proportions}}">
47
                                                     <div class="iframe-container-{{embed.proportions}}">
48
-                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}?title=0&amp;byline=0&amp;portrait=0" allowfullscreen="allowfullscreen"></iframe>
48
+                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}?title=0&amp;byline=0&amp;portrait=0{{ embed.url_extras }}" allowfullscreen="allowfullscreen"></iframe>
49
                                                     </div>
49
                                                     </div>
50
                                                 {% endif %}
50
                                                 {% endif %}
51
                                             {% endif %}
51
                                             {% endif %}
66
                                                 {% if moment.embed %}
66
                                                 {% if moment.embed %}
67
                                                     {% if moment.embed.type == "youtube" %}
67
                                                     {% if moment.embed.type == "youtube" %}
68
                                                         <div class="iframe-container-{{moment.embed.proportions}}">
68
                                                         <div class="iframe-container-{{moment.embed.proportions}}">
69
-                                                          <iframe src="https://www.youtube.com/embed/{{ moment.embed.code }}" allowfullscreen="allowfullscreen"></iframe>
69
+                                                          <iframe src="https://www.youtube.com/embed/{{ moment.embed.code }}?controls=0{{ embed.url_extras }}" allowfullscreen="allowfullscreen"></iframe>
70
 							</div>
70
 							</div>
71
                                                     {% elif moment.embed.type == "vimeo" %}
71
                                                     {% elif moment.embed.type == "vimeo" %}
72
                                                         <div class="iframe-container-{{moment.embed.proportions}}">
72
                                                         <div class="iframe-container-{{moment.embed.proportions}}">
73
-                                                          <iframe src="https://player.vimeo.com/video/{{ moment.embed.code }}" allowfullscreen="allowfullscreen"></iframe>
73
+                                                          <iframe src="https://player.vimeo.com/video/{{ moment.embed.code }}?title=0&amp;byline=0&amp;portrait=0{{ moment.embed.url_extras }}" allowfullscreen="allowfullscreen"></iframe>
74
 							</div>
74
 							</div>
75
                                                     {% endif %}
75
                                                     {% endif %}
76
                                                 {% endif %}
76
                                                 {% endif %}

Loading…
Cancel
Save