diff --git a/ContentfulService.py b/ContentfulService.py new file mode 100644 index 0000000..c9fdef2 --- /dev/null +++ b/ContentfulService.py @@ -0,0 +1,47 @@ +import contentful +import markdown +import os + +class ContentfulService: + def __init__(self, space_id, access_token): + self.client = contentful.Client(space_id, access_token) + + def get_general_info(self): + entries = self.client.entries({'content_type': 'general'}) + if not entries: + return None + entry = entries[0] + general_date = entry.fields().get('general_date') + general_end_date = entry.fields().get('general_end_date') + general_text = entry.fields().get('general_text') + general_text_event = entry.fields().get('general_event_text') + general_text_conference = entry.fields().get('general_conference_text') + formatted_date = general_date.strftime('%#d %b %Y') if general_date else None + formatted_end_date = general_end_date.strftime('%#d %b %Y') if general_end_date else None + info = { + 'startDate': formatted_date, + 'endDate': formatted_end_date, + 'text': markdown.markdown(general_text) if general_text else '', + 'textConference': markdown.markdown(general_text_conference) if general_text_conference else '', + 'textEvent':markdown.markdown(general_text_event) if general_text_event else '' + } + return info + + def get_location_info(self): + entries = self.client.entries({'content_type': 'locations'}) + location_list = [] + for e in entries: + name = getattr(e, 'name') + directions = getattr(e, 'directions') + url = getattr(e, 'url') + image_asset = getattr(e, 'image') + image_url = image_asset.url() if image_asset else '' + content = { + 'name': name, + 'directions' : directions, + 'url' : url, + 'image' : image_url + } + location_list.append(content) + return location_list + \ No newline at end of file diff --git a/__pycache__/ContentfulService.cpython-310.pyc b/__pycache__/ContentfulService.cpython-310.pyc new file mode 100644 index 0000000..9f0f05b Binary files /dev/null and b/__pycache__/ContentfulService.cpython-310.pyc differ diff --git a/app.py b/app.py index 3f56380..e773902 100644 --- a/app.py +++ b/app.py @@ -3,6 +3,7 @@ import contentful from dotenv import load_dotenv import os import markdown +from ContentfulService import ContentfulService load_dotenv() @@ -13,6 +14,18 @@ SPACE_ID = os.getenv('SPACE_ID') ACCESS_TOKEN = os.getenv('ACCESS_TOKEN') client = contentful.Client(SPACE_ID, ACCESS_TOKEN) +contentful_service = ContentfulService(SPACE_ID, ACCESS_TOKEN) + +# Simple in-memory cahce - this is to store information that will be used on all pages, so I don't have to make +# request's over and over again. +global festival_general_info_cache + +with app.app_context(): + festival_general_info_cache = contentful_service.get_general_info() + +@app.context_processor +def inject_general_info(): + return dict(festival_general_info=festival_general_info_cache) @app.route('/') def index(): @@ -60,10 +73,12 @@ def event_articles(type, title, ex_type): @app.route('/locations') def locations(): - return render_template('locations.html', title='Locations') + location_info = contentful_service.get_location_info() + print(location_info) + return render_template('locations.html', title='Locations', locInfo=location_info) def get_all_content(type): - entries = client.entries({'content_type': type}) + entries = client.entries({'content_type': type, 'fields.beta25': 'true'}) content_list = process_content(entries, type) return content_list diff --git a/public/css/styles.css b/public/css/styles.css index 0f22fac..2ad2bd7 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -496,7 +496,7 @@ hr { font-weight: 300; } -.list-info-text { +#list-info-container p{ padding-bottom: 10px; } diff --git a/public/js/locations.js b/public/js/locations.js index 3060e4d..53034e8 100644 --- a/public/js/locations.js +++ b/public/js/locations.js @@ -1,38 +1,3 @@ -// Example location data -const locationData = { - 'digital-hub': { - text: 'The Digital Hub, 10-13 Thomas St, The Liberties, Dublin 8, D08 PX8H', - imageUrl: '/public/images/locations/digital-hub.webp', - direction: 'https://www.google.com/maps/dir//115-117,+The+Coombe,+The+Liberties,+Dublin,+D08+A970/@53.3391179,-6.3569591,12z/data=!4m8!4m7!1m0!1m5!1m1!1s0x48670e89423ed249:0x8aa3669566840ff9!2m2!1d-6.274559!2d53.3391463?entry=ttu' - }, - 'pallas-projects': { - text: '115-117, The Coombe, The Liberties, Dublin, D08 A970', - imageUrl: 'public/images/locations/pallas.webp', - direction: 'https://www.google.com/maps?gs_lcrp=EgZjaHJvbWUqBggAEEUYOzIGCAAQRRg7MgYIARBFGDkyBggCEEUYOzIGCAMQRRg8MgYIBBAuGEDSAQgxNDA3ajBqOagCALACAQ&um=1&ie=UTF-8&fb=1&gl=ie&sa=X&geocode=KUnSPkKJDmdIMfkPhGaVZqOK&daddr=115-117,+The+Coombe,+The+Liberties,+Dublin,+D08+A970' - }, - 'fire-station': { - text: '9 - 12 Buckingham Street Lower, Mountjoy, Dublin 1', - imageUrl: 'public/images/locations/fire.webp', - direction: 'https://www.google.com/maps/place//data=!4m2!3m1!1s0x48670e897d6ec3f7:0x2eee044a4b511022?sa=X&ved=1t:8290&ictx=111' - }, - 'imma': { - text: 'Royal Hospital Kilmainham, Military Rd, Kilmainham, Dublin 8, D08 FW31', - imageUrl: 'public/images/locations/imma.webp', - direction: 'https://www.google.com/maps/place//data=!4m2!3m1!1s0x48670c462efd7fcd:0x3dc9b365e0e6ace?sa=X&ved=1t:8290&ictx=111' - }, - 'digital-bank': { - text: '85 James St, The Liberties, Dublin 8, D08 C2PR', - imageUrl: '/public/images/locations/bank.webp', - direction: 'https://www.google.com/maps/place//data=!4m2!3m1!1s0x48670d2fc081f95f:0xa5173048f627d0?sa=X&ved=1t:8290&ictx=111' - }, - 'beckett': { - text: 'Samuel Beckett Theatre, Trinity College, Dublin', - imageUrl: '/public/images/locations/beckett.png', - direction: 'https://maps.app.goo.gl/a1T7HktmKdxNcFWB7' - }, - // Add more locations as needed -}; - // Function to update the content function updateLocationContent(locationKey) { const location = locationData[locationKey]; @@ -43,10 +8,15 @@ function updateLocationContent(locationKey) { } } -// Add event listeners to buttons document.querySelectorAll('.location-button').forEach(button => { button.addEventListener('click', (event) => { - const locationKey = event.currentTarget.getAttribute('data-location'); - updateLocationContent(locationKey); + const index = event.currentTarget.getAttribute('data-location'); + const locInfo = window.locInfo; // We'll inject this below + const location = locInfo[index]; + if (location) { + document.getElementById('location-text').innerText = location.directions; + document.getElementById('location-img').src = location.image; + document.getElementById('location-direction').href = location.url; + } }); -}); +}); \ No newline at end of file diff --git a/templates/_nav.html b/templates/_nav.html index d6f0602..d41412b 100644 --- a/templates/_nav.html +++ b/templates/_nav.html @@ -1,7 +1,9 @@
diff --git a/templates/base.html b/templates/base.html index 28a6779..f826924 100644 --- a/templates/base.html +++ b/templates/base.html @@ -3,15 +3,15 @@ - - - - + + + + - + - Beta Festival 2024 {% block title %}{% endblock %} + Beta Festival 2025 {% block title %}{% endblock %} diff --git a/templates/index.html b/templates/index.html index 8622da5..f4e3551 100644 --- a/templates/index.html +++ b/templates/index.html @@ -26,15 +26,10 @@
\Locations
-

- Beta is a new festival of art and technology critically engaging with the impact of emerging technologies on society. Taking Ireland’s role as a central node in today's wired world as a starting point, Beta showcases and celebrates Ireland’s research and artistic communities through a combination of creativity, debate and experimentation. Beta allows members of the public to engage playfully and critically with new technologies essentially beta testing ethical issues facing society -

-

- The 2024 edition of Beta will explore a range of themes relating to AI, Automated Systems, and the politics of resistance in an algorithmic age. Through a programme of exhibitions, workshops and talks, the festival will interrogate what kinds of powers reside in technology. -

-

- The festival is co-founded by The Digital Hub and supported by Science Week with additional support for the 2024 programme from Screen Ireland, the French Embassy, Institut français, British Council, Smart Dublin, Cultural and Creative Industries Skillsnet, Arts Council Festival Investment Scheme and Creative Europe Desk Ireland. -

+ + {% if festival_general_info %} + {{ festival_general_info.text | safe}} + {% endif %}
↑ beta-festival diff --git a/templates/list.html b/templates/list.html index 8ae0f7d..89d92d5 100644 --- a/templates/list.html +++ b/templates/list.html @@ -8,19 +8,18 @@ {% include '_list-header.html'%}
- {% if title == 'Conferences'%} -

Exploring the relationship between technology and power, Beta Festival’s 2024 conference explores how digital infrastructures and software have reshaped society, culture, and politics. Spanning two days, the event delves into the ways technology influences institutions, political interests, and economic and cultural practices. Bringing together artists, technologists, and researchers, the conference participants will question the forms of power and control embedded in digital infrastructures and explore strategies for redesigning these systems to meet societal demands for both individual and collective autonomy.

-

On the first day, discussions will focus on the ethics of AI development, its impact on democracy, and the manipulation of political systems, as well as how artists are leveraging digital tools to resist surveillance and platform capitalism. The second day will explore the transformation of creative practices by these technologies, with sessions addressing copyright and intellectual property in the age of AI, the preservation of digital cultural memory, counter-archives, and new possibilities for immersive and interactive storytelling.

-

Throughout the conference, keynote speakers Abeba Birhane, an accountability expert, and Kay Watson, a specialist in art and technology, will offer insights into how AI is reshaping society and culture, while exploring the limits and possibilities of individual and collective agency in this rapidly evolving digital landscape.

- {% endif %} + {% if festival_general_info %} + {% if title == 'Conferences'%} + {{ festival_general_info.textConference | safe }} + {% endif %} - {% if title == 'Events'%} -

Beta Festival will feature a variety of performances, workshops and discussions as part of this year's programme including a number of events with our festival research partner ADAPT Research Centre and collaborations with D.A.T.A., Base, Fire Station Artists Studios, Creative Futures Academy and Creative Sparks Fab Lab.

-

We will also present Noire (France) in association with the French Embassy and Institut français, the Cannes award-winning immersive experience directed by Stéphane Foenkinos and Pierre-Alain Giraud, based on the work by Tania de Montaigne, produced by Novaya in partnership with the Centre Pompidou, co-produced with Flash Forward Entertainment.

- {% endif %} + {% if title == 'Events'%} + {{ festival_general_info.textEvent | safe }} + {% endif %} - {% if title == 'Exhibitions' %} - {% include '_ex.html' %} + {% if title == 'Exhibitions' %} + {% include '_ex.html' %} + {% endif %} {% endif %}
diff --git a/templates/locations.html b/templates/locations.html index c8601ad..4e05e85 100644 --- a/templates/locations.html +++ b/templates/locations.html @@ -4,33 +4,32 @@ {% block content %}
- {% include '_nav.html' %} -
-
-
-
Digital Depot at The Digital Hub
-
The Bank at The Digital Hub
-
Pallas Projects/Studios
-
Fire Station Artists Studios
-
Samuel Beckett Theatre
-
-
-
- The Digital Hub, 10-13 Thomas St, The Liberties, Dublin 8, D08 PX8H -
- -
↳ Directions
-
-
-
-
-
- -
-
-
+ {% include '_nav.html' %} +
+
+
+ {% for loc in locInfo %} +
{{ loc.name }}
+ {% endfor %} +
+
+
+ {{ locInfo[0].directions }} +
+ +
↳ Directions
+
+
+
+
+
+ +
+
+
- - + {% endblock content %} \ No newline at end of file