Skip to content

Commit

Permalink
Merge pull request #94 from pyconau/phall/youtube-embeds
Browse files Browse the repository at this point in the history
Embed youtube videos on talk pages
  • Loading branch information
urcheraus authored Dec 15, 2024
2 parents 1cb65ae + 0338e09 commit 0d9023e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
20 changes: 10 additions & 10 deletions scripts/schedule_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ def parse_markdown(text):

seen_speakers = set()

# yt_resp = requests.get(
# "https://portal.nextdayvideo.com.au/main/C/pyconau/S/pyconau_2021.json"
# )
# yt_resp.raise_for_status()
# youtube_slugs = {
# x["conf_key"]: x["host_url"].rsplit("/", 1)[1]
# for x in yt_resp.json()
# if x["host_url"] is not None
# }
yt_resp = requests.get(
"https://portal.nextdayvideo.com.au/main/C/pyconau/S/pyconau_2024.json"
)
yt_resp.raise_for_status()
youtube_slugs = {
x["conf_key"]: x["host_url"].rsplit("/", 1)[1]
for x in yt_resp.json()
if x["host_url"] is not None
}

for entry in SESSIONS_DIR.glob("*"):
entry.unlink()
Expand Down Expand Up @@ -188,7 +188,7 @@ def parse_markdown(text):
"code": session["code"],
"speakers": speakers,
"cw": parse_markdown(cw) if cw is not None else None,
# "youtube_slug": youtube_slugs.get(session["code"]),
"youtube_slug": youtube_slugs.get(session["code"]),
},
f,
)
Expand Down
2 changes: 1 addition & 1 deletion src/main_config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Whether or not tickets are on sale.
export const CONFERENCE_TZ = "Australia/Melbourne"
export const TICKETS_AVAILABLE: boolean = true
export const TICKETS_AVAILABLE: boolean = false

export const ROOMS = [
{ slug: "goldfields", name: "Door 12 / Goldfields Theatre", days: ['friday', 'saturday', 'sunday'] },
Expand Down
27 changes: 15 additions & 12 deletions src/pages/program/[sessionId].astro
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const track = entry.data.track
const daySlug = DateTime.fromJSDate(entry.data.start, {
zone: CONFERENCE_TZ,
}).weekdayLong?.toLowerCase()
const youtube_embed_url = "https://www.youtube-nocookie.com/embed/" + entry.data.youtube_slug
---

<style lang="scss">
Expand Down Expand Up @@ -77,18 +79,6 @@ const daySlug = DateTime.fromJSDate(entry.data.start, {
{% endif %}
{% if session.youtube_slug %}
<iframe
width="560"
height="315"
src="https://www.youtube-nocookie.com/embed/{{ session.youtube_slug }}"
frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
class="ytembed"
></iframe>
{% endif %}
*/
Expand Down Expand Up @@ -125,6 +115,19 @@ const daySlug = DateTime.fromJSDate(entry.data.start, {
</p>
)
}
{ entry.data.youtube_slug && (
<iframe
width="560"
height="315"
src={youtube_embed_url}
frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
class="ytembed"
></iframe>
)
}

<div class="lede"><Fragment set:html={entry.data.abstract} /></div>
{
TICKETS_AVAILABLE ? (
Expand Down

0 comments on commit 0d9023e

Please sign in to comment.