Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Please follow these rules to keep the repo clean:
### How to add a talk recording

#### Manually
- Go to http://localhost:5000/admin/root:talk-recordings/edit
- Go to http://localhost:5000/admin/root:recordings/edit
- Click "Add Page"
- Choose the "Recording" model
- Set the "Title" field to the talk title
Expand Down
19 changes: 17 additions & 2 deletions scripts/recordings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@

These script should help in the process of releasing the talk recordings on Youtube and on the website

## 1. Download Pretalx Schedule
## Steps

**WARNING:** Download the `schedule.json` without being logged in or in private mode otherwise there will be personal data in the json !!!!
1. Download Pretalx Schedule

**WARNING:** Download the `schedule.json` without being logged in or in private mode otherwise there will be personal data (e.g. email addresses) in the json and therefore public as this repo is public !!!!

2. Run `schedule_2_csv.py`

Upload video to Youtube with the provided metadata (title, description) from the CSV. Get the Youtube link and add it to the CSV

3. Run `csv_2_content.py`

Add link to the content files provided

4. Copy content files `sps20/content/recordings` to release it

Copy the slides pdf as well an name it accordingly TODO

5. For full playlist, add them to `sps20/databags/playlists.json`
31 changes: 16 additions & 15 deletions scripts/recordings/csv_2_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
import re
import shutil

FILE_DIR = Path("scripts/recordings/sps24")
assert FILE_DIR.exists(), "FILE_DIR does not exist"
# START Change these two
CONF_YEAR_SLUG = "25"
# END

CSV_PATH = FILE_DIR / "talks.csv"
BASE_DIR = Path(f"scripts/recordings/sps{CONF_YEAR_SLUG}")
CONF_SHORT = f"SPS{CONF_YEAR_SLUG}"
CONF_YEAR = f"20{CONF_YEAR_SLUG}"
CSV_PATH = BASE_DIR / "talks.csv"

assert BASE_DIR.exists(), "BASE_DIR does not exist"
assert CSV_PATH.exists(), "CSV_PATH not found"

CONF_SHORT = "SPS24"
CONF_YEAR = "2024"

OUTPUT_FOLDER = Path("scripts/recordings/out")

def get_data(csv_path, filter_type=["Talk", "Keynote", "Lightning Talks (9x5min)"]):
df = pd.read_csv(csv_path)
Expand All @@ -22,28 +24,27 @@ def get_data(csv_path, filter_type=["Talk", "Keynote", "Lightning Talks (9x5min)
return df

def create_file_structure(df: pd.DataFrame):
# if OUTPUT_FOLDER.exists():
# shutil.rmtree(OUTPUT_FOLDER)
OUTPUT_FOLDER.mkdir(exist_ok=False)
out_dir = BASE_DIR / "content"
out_dir.mkdir(exist_ok=False) # Warn user if it exists
for i, row in df.iterrows():
filename = Path(OUTPUT_FOLDER / row.filename)
filename = Path(out_dir / row.filename)
filename.mkdir()
content = filename / "contents.lr"
content.write_text(create_content(i, row))
content.write_text(create_content(row))
slide = filename / f"{filename.name}.pdf.lr"
slide.write_text("type: slides")

def create_content(i, row):
def create_content(row):
text = f'''
_model: recording
---
title: {row.title}
---
ordering: {i}
ordering: {row.talk_idx}
---
speaker: {row.names_combined}
---
video_url: {row.video_url}
video_url: {row.video_url if row.video_url != "<VIDEO_URL>" else ""}
---
year: {CONF_YEAR} - Day {row.day}
'''
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
'''
Script to convert pretalx schedule.json to a CSV file.
It can be used to easy copy the data to Youtube upload forms and name the slides pdf properly.
'''

import pandas as pd
from pathlib import Path
import json
import re
from datetime import datetime
from textwrap import dedent

# START Change these two
CONF_YEAR_SLUG = "25"
# END

FILE_DIR = Path("scripts/recordings/sps24")
assert FILE_DIR.exists(), "FILE_DIR does not exist"
BASE_DIR = Path(f"scripts/recordings/sps{CONF_YEAR_SLUG}")
CONF_SHORT = f"SPS{CONF_YEAR_SLUG}"
CONF_YEAR = f"20{CONF_YEAR_SLUG}"

CSV_PATH = FILE_DIR / "talks.csv"
PRETALX_SCHEDULE_PATH = FILE_DIR / "schedule.json"

CONF_SHORT = "SPS24"
assert BASE_DIR.exists(), "FILE_DIR does not exist"

PRETALX_SCHEDULE_PATH = BASE_DIR / "schedule.json"
CSV_PATH = BASE_DIR / "talks.csv"


def get_talks_data(schedule_path = PRETALX_SCHEDULE_PATH):
schedule_data = json.loads(schedule_path.read_text())
Expand All @@ -19,11 +32,12 @@ def get_talks_data(schedule_path = PRETALX_SCHEDULE_PATH):
day_idx = day["index"]
print(f"Processing day {day_idx}")
room_name = next(iter(day["rooms"]))
for talk in day["rooms"][room_name]:
print(f"\tProcessing talks #{talk['id']}")
for i, talk in enumerate(day["rooms"][room_name]):
print(f"\tProcessing talk #{talk['id']}")
names, bios = zip(*[(d["public_name"], d["biography"] if d["biography"] else "") for d in talk["persons"]])
talk_data = dict(
day = day_idx,
talk_idx = i,
date = talk["date"],
title = talk["title"],
type = talk["type"],
Expand Down Expand Up @@ -54,15 +68,15 @@ def enrich(talks):
named_title = f'{names} - {talk["title"]}'
talk["named_title"] = named_title
talk["video_title"] = f"{named_title} - {CONF_SHORT}"
filename = clean_filename(f"{CONF_SHORT}_{named_title}")
filename = clean_filename(f"{CONF_SHORT}_{talk['day']}-{talk['talk_idx']:02d}_{named_title}")
talk["filename"] = filename
talk["video_url"] = "<TODO>"
talk["video_url"] = "<VIDEO_URL>" # fill in manually later when the video is uploaded
talk["biographies_combined"] = "\n\n".join(talk["biographies_raw"])
talk["date_str"] = talk["date"]
# Title and Description for youtube
talk["video_text"] = f'{talk["names_combined"]} – {talk["title"]} – {CONF_SHORT}'
talk["video_text"] = f'''Talk recorded at the Swiss Python Summit on {timestring(talk["date"])}.

talk["video_text"] = f'''
Talk recorded at the Swiss Python Summit on {timestring(talk["date"])}.
Licensed as Creative Commons Attribution 4.0 International.

---------
Expand All @@ -74,7 +88,7 @@ def enrich(talks):
About the speaker(s):

{talk["biographies_combined"]}
'''
'''.lstrip()
return talks

def clean_filename(filename, max_length=70):
Expand Down Expand Up @@ -122,7 +136,7 @@ def main():
df = pd.DataFrame(data)
df.to_csv(CSV_PATH)
short_csv_path = CSV_PATH.parent / (CSV_PATH.stem + "_notext" + CSV_PATH.suffix)
# print(short_csv_path)
print("CSV saved to:", CSV_PATH)
# drop multiline texts
df.drop(["abstract","biographies_raw", "biographies_combined", "video_text"], axis=1).to_csv(short_csv_path)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: When Close Enough is Good Enough
---
ordering: 1
---
speaker: Tim Head
---
video_url:
---
year: 2025 - Day 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Code review in era of collaborative development
---
ordering: 2
---
speaker: Andrii Soldatenko
---
video_url:
---
year: 2025 - Day 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Bytecode and .pyc files
---
ordering: 3
---
speaker: Konrad Gawda
---
video_url:
---
year: 2025 - Day 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Why you, as a Python developer, should learn Rust
---
ordering: 4
---
speaker: Daniel Szoke
---
video_url:
---
year: 2025 - Day 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Functional Python: Saving Christmas with itertools & friends
---
ordering: 5
---
speaker: Edoardo Baldi
---
video_url:
---
year: 2025 - Day 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Building Resilient Python Apps for Unreliable Networks
---
ordering: 6
---
speaker: Emeka Onyebuchi
---
video_url:
---
year: 2025 - Day 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Software estimation: False sense of certainty
---
ordering: 7
---
speaker: Ines Panker
---
video_url:
---
year: 2025 - Day 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Using Python's array API standard for ESA's Euclid mission
---
ordering: 8
---
speaker: Saransh Chopra
---
video_url:
---
year: 2025 - Day 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Machine learning for Swiss democracy
---
ordering: 1
---
speaker: Vita Midori
---
video_url:
---
year: 2025 - Day 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: AI Coding Agents and how to code them
---
ordering: 2
---
speaker: Alex Shershebnev
---
video_url:
---
year: 2025 - Day 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Causal ML for Smarter Advertising Campaigns with Python
---
ordering: 3
---
speaker: Francesco Conti
---
video_url:
---
year: 2025 - Day 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Docling: Get your documents ready for generative AI
---
ordering: 4
---
speaker: Peter Staar, Michele Dolfi, Panos Vagenas, Nikos Livathinos
---
video_url:
---
year: 2025 - Day 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Agentic Cyber Defense with External Threat Intelligence
---
ordering: 5
---
speaker: Jyoti Yadav
---
video_url:
---
year: 2025 - Day 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Anonymization of sensitive information in financial document
---
ordering: 6
---
speaker: Piotr Gryko
---
video_url:
---
year: 2025 - Day 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: Gompertz Linear Units (GoLU)
---
ordering: 7
---
speaker: Das Indrashis
---
video_url:
---
year: 2025 - Day 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

_model: recording
---
title: What Networks tell us about Trades, Power, and the World?
---
ordering: 8
---
speaker: Kshitijaa Jaglan
---
video_url:
---
year: 2025 - Day 2
1 change: 1 addition & 0 deletions scripts/recordings/sps25/schedule.json

Large diffs are not rendered by default.

Loading