diff --git a/templates/add_venue.html b/confarchive/templates/add_venue.html similarity index 100% rename from templates/add_venue.html rename to confarchive/templates/add_venue.html diff --git a/templates/base.html b/confarchive/templates/base.html similarity index 100% rename from templates/base.html rename to confarchive/templates/base.html diff --git a/templates/conference.html b/confarchive/templates/conference.html similarity index 100% rename from templates/conference.html rename to confarchive/templates/conference.html diff --git a/templates/country_list.html b/confarchive/templates/country_list.html similarity index 100% rename from templates/country_list.html rename to confarchive/templates/country_list.html diff --git a/templates/event.html b/confarchive/templates/event.html similarity index 100% rename from templates/event.html rename to confarchive/templates/event.html diff --git a/templates/github.html b/confarchive/templates/github.html similarity index 100% rename from templates/github.html rename to confarchive/templates/github.html diff --git a/templates/index.html b/confarchive/templates/index.html similarity index 100% rename from templates/index.html rename to confarchive/templates/index.html diff --git a/templates/login.html b/confarchive/templates/login.html similarity index 100% rename from templates/login.html rename to confarchive/templates/login.html diff --git a/templates/merge_people.html b/confarchive/templates/merge_people.html similarity index 100% rename from templates/merge_people.html rename to confarchive/templates/merge_people.html diff --git a/templates/navbar.html b/confarchive/templates/navbar.html similarity index 100% rename from templates/navbar.html rename to confarchive/templates/navbar.html diff --git a/templates/person.html b/confarchive/templates/person.html similarity index 100% rename from templates/person.html rename to confarchive/templates/person.html diff --git a/templates/person/split.html b/confarchive/templates/person/split.html similarity index 100% rename from templates/person/split.html rename to confarchive/templates/person/split.html diff --git a/templates/reports.html b/confarchive/templates/reports.html similarity index 100% rename from templates/reports.html rename to confarchive/templates/reports.html diff --git a/templates/search_events.html b/confarchive/templates/search_events.html similarity index 100% rename from templates/search_events.html rename to confarchive/templates/search_events.html diff --git a/templates/search_everything.html b/confarchive/templates/search_everything.html similarity index 100% rename from templates/search_everything.html rename to confarchive/templates/search_everything.html diff --git a/templates/search_people.html b/confarchive/templates/search_people.html similarity index 100% rename from templates/search_people.html rename to confarchive/templates/search_people.html diff --git a/templates/series/list.html b/confarchive/templates/series/list.html similarity index 100% rename from templates/series/list.html rename to confarchive/templates/series/list.html diff --git a/templates/top_events.html b/confarchive/templates/top_events.html similarity index 100% rename from templates/top_events.html rename to confarchive/templates/top_events.html diff --git a/templates/top_speakers.html b/confarchive/templates/top_speakers.html similarity index 100% rename from templates/top_speakers.html rename to confarchive/templates/top_speakers.html diff --git a/templates/wikidata.html b/confarchive/templates/wikidata.html similarity index 100% rename from templates/wikidata.html rename to confarchive/templates/wikidata.html diff --git a/main.py b/confarchive/view.py similarity index 97% rename from main.py rename to confarchive/view.py index f1e5990..82b1262 100755 --- a/main.py +++ b/confarchive/view.py @@ -186,9 +186,20 @@ def merge() -> str | Response: print(other_ids, "->", merge_to_id) + conference_people = model.ConferencePerson.query.filter( + model.ConferencePerson.person_id.in_(other_ids) + ) + with database.session.begin(): + merge_to = model.Person.query.get(merge_to_id) + existing_conferences = {conf.id for conf in merge_to.conferences} + to_delete = [ + cp for cp in conference_people if cp.conference_id in existing_conferences + ] + for cp in to_delete: + database.session.delete(cp) + if merge_to_id != name_from_person_id: - merge_to = model.Person.query.get(merge_to_id) name_from_person = model.Person.query.get(name_from_person_id) merge_to.name = name_from_person.name diff --git a/scripts/add_conference_urls.py b/scripts/add_conference_urls.py new file mode 100755 index 0000000..49b7feb --- /dev/null +++ b/scripts/add_conference_urls.py @@ -0,0 +1,55 @@ +#!/usr/bin/python3 + +import os +import json +from confarchive import database, model +from confarchive.view import app + +app.config.from_object("config.default") +database.init_app(app) + + +def url_from_giggty_menu() -> None: + for conf in model.Conference.query.order_by(model.Conference.short_name): + if conf.url: + continue + + giggity_menu = "giggity/menu/" + + menu_filename = os.path.join(giggity_menu, conf.short_name + ".json") + + if not os.path.exists(menu_filename): + continue + + menu = json.load(open(menu_filename)) + links = {link["title"]: link["url"] for link in menu["metadata"]["links"]} + + if "Website" not in links: + continue + print(json.dumps(links, indent=2)) + + url = links["Website"] + + print(conf.short_name, menu_filename, url) + + conf.url = url + + database.session.commit() + + +def add_more_urls() -> None: + for conf in model.Conference.query.order_by(model.Conference.short_name): + if conf.url: + continue + if conf.short_name.startswith("debconf"): + conf.url = f"https://{conf.short_name}.debconf.org/" + print(conf.short_name, conf.url) + if conf.short_name.startswith("fosdem"): + year = conf.short_name[-4:] + conf.url = f"https://fosdem.org/{year}/" + print(conf.short_name, conf.url) + + database.session.commit() + + +add_more_urls() diff --git a/add_place.py b/scripts/add_place.py similarity index 99% rename from add_place.py rename to scripts/add_place.py index 61d0b92..8bce27a 100755 --- a/add_place.py +++ b/scripts/add_place.py @@ -1,9 +1,8 @@ #!/usr/bin/python3 -from main import app import sys from confarchive import database, model, wikidata - +from confarchive.view import app app.config.from_object("config.default") database.init_app(app)