Bladeren bron

Add url_extras kludge to embeds

master
The Dod 8 maanden geleden
bovenliggende
commit
baf9a652d8
6 gewijzigde bestanden met toevoegingen van 30 en 11 verwijderingen
  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 Bestand weergeven

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

+ 4
- 0
static/embed.schema.json Bestand weergeven

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

+ 12
- 0
static/media/video-embed.json Bestand weergeven

@@ -2,72 +2,84 @@
2 2
     {
3 3
         "id": "the_great_bell_chant",
4 4
         "url": "https://vimeo.com/6518109",
5
+        "url_extras": "&h=605a2f1f84",
5 6
         "proportions": "16x9",
6 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 10
         "id": "hallelujah_leonard_cohen",
10 11
         "url": "https://www.youtube.com/watch?v=YrLk4vdY28Q",
12
+        "url_extras": "",
11 13
         "proportions": "16x9",
12 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 17
         "id": "Be_present_guided_meditation_tnh",
16 18
         "url": "https://www.youtube.com/watch?v=KRiJN1su3RY",
19
+        "url_extras": "",
17 20
         "proportions": "16x9",
18 21
         "description": "Be present. Short guided meditation. 5 minutes. Thich Nhat Hanh"
19 22
     },
20 23
     {
21 24
         "id": "Notice_Suffering_guided_meditation_tnh",
22 25
         "url": "https://www.youtube.com/watch?v=B_ZnE8hs7c4",
26
+        "url_extras": "",
23 27
         "proportions": "16x9",
24 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 31
         "id": "coping_with_grief",
28 32
         "url": "https://www.youtube.com/watch?v=gsYL4PC0hyk",
33
+        "url_extras": "",
29 34
         "proportions": "16x9",
30 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 38
         "id": "the_evening_thread",
34 39
         "url": "https://vimeo.com/349941340",
40
+        "url_extras": "&h=3ecc399ec9#t=1m50s",
35 41
         "proportions": "4x3",
36 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 45
         "id": "Guided_Meditation_Pain_Relief_Healing",
40 46
         "url": "https://www.youtube.com/watch?v=A33hN1tDopY",
47
+        "url_extras": "&start=6",
41 48
         "proportions": "16x9",
42 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 52
         "id": "2_Minute_Guided_Meditation_for_Spring",
46 53
         "url": "https://www.youtube.com/watch?v=-V3OU_NF4qs",
54
+        "url_extras": "",
47 55
         "proportions": "16x9",
48 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 59
         "id": "2_Minute_Guided_Meditation_for_Winter",
52 60
         "url": "https://www.youtube.com/watch?v=ZJGgpfx01KE",
61
+        "url_extras": "",
53 62
         "proportions": "16x9",
54 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 66
         "id": "One_minute_guided_meditation",
58 67
         "url": "https://www.youtube.com/watch?v=w-KD1rFZgDg",
68
+        "url_extras": "",
59 69
         "proportions": "16x9",
60 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 73
         "id": "tibetan_bowl_resonance",
64 74
         "url": "https://www.youtube.com/watch?v=R8k6elHnFvo",
75
+        "url_extras": "",
65 76
         "proportions": "16x9",
66 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 80
         "id": "hello_stranger",
70 81
         "url": "https://vimeo.com/190063150",
82
+        "url_extras": "&h=f9d621f128",
71 83
         "proportions": "16x9",
72 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 Bestand weergeven

@@ -45,13 +45,14 @@
45 45
                                             {% endif %}
46 46
                                         <div class="scrollable">
47 47
                                             {% if embed %}
48
+{# @{{ embed.url_extras }}@ #}
48 49
                                                 {% if embed.type == "youtube" %}
49 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 52
 						    </div>
52 53
                                                 {% elif embed.type == "vimeo" %}
53 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 56
 						    </div>
56 57
                                                 {% endif %}
57 58
                                             {% endif %}
@@ -70,13 +71,14 @@
70 71
                                             {% endif %}
71 72
                                             <div class="scrollable">
72 73
                                                 {% if moment.embed %}
74
+{# @{{ moment.embed.url_extras }}@ #}
73 75
                                                     {% if moment.embed.type == "youtube" %}
74 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 78
 							</div>
77 79
                                                     {% elif moment.embed.type == "vimeo" %}
78 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 82
 							</div>
81 83
                                                     {% endif %}
82 84
                                                 {% endif %}

+ 2
- 2
templates/embeds.html Bestand weergeven

@@ -41,11 +41,11 @@
41 41
                                             <div class="scrollable">
42 42
                                                 {% if embed.type == "youtube" %}
43 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 45
 						    </div>
46 46
                                                 {% elif embed.type == "vimeo" %}
47 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 49
 						    </div>
50 50
                                                 {% endif %}
51 51
 					        <p>{{ embed.description }}</p>

+ 4
- 4
templates/example.html Bestand weergeven

@@ -41,11 +41,11 @@
41 41
                                             {% if embed %}
42 42
                                                 {% if embed.type == "youtube" %}
43 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 45
                                                     </div>
46 46
                                                 {% elif embed.type == "vimeo" %}
47 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 49
                                                     </div>
50 50
                                                 {% endif %}
51 51
                                             {% endif %}
@@ -66,11 +66,11 @@
66 66
                                                 {% if moment.embed %}
67 67
                                                     {% if moment.embed.type == "youtube" %}
68 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 70
 							</div>
71 71
                                                     {% elif moment.embed.type == "vimeo" %}
72 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 74
 							</div>
75 75
                                                     {% endif %}
76 76
                                                 {% endif %}

Laden…
Annuleren
Opslaan