Skip to content

Commit b71c08e

Browse files
committed
Updated footer for 2025, removed non info sections about 24 hour broadcast
1 parent cdff12a commit b71c08e

File tree

5 files changed

+143
-104
lines changed

5 files changed

+143
-104
lines changed

mps_site/scripts.py

Lines changed: 126 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
from datetime import datetime
22
import feedparser
33
import yt_dlp as youtube_dl
4-
import requests
4+
import requests
55
from bs4 import BeautifulSoup
66
import json
77
import pandas as pd
88
import re
99

10+
1011
def construct_tcv_url(per_page=3, category=None):
1112
base_url = "https://thecollegeview.ie/wp-json/wp/v2/posts"
1213
query_params = f"?per_page={per_page}&orderby=date&_fields=id,date,title,content,link,author,featured_media"
1314
if category:
1415
query_params += f"&categories={category}"
1516
return base_url + query_params
1617

18+
1719
def fetch_data(url):
1820
try:
1921
response = requests.get(url, timeout=10)
@@ -23,10 +25,13 @@ def fetch_data(url):
2325
print(f"An error occurred: {e}")
2426
return None
2527

28+
2629
def get_featured_media(media_id):
27-
media_data = fetch_data(f"https://thecollegeview.ie/wp-json/wp/v2/media/{media_id}")
30+
media_data = fetch_data(
31+
f"https://thecollegeview.ie/wp-json/wp/v2/media/{media_id}")
2832
return media_data['guid']['rendered'] if media_data else None
2933

34+
3035
def tcv_posts(url):
3136
posts = fetch_data(url)
3237
if not posts:
@@ -36,11 +41,14 @@ def tcv_posts(url):
3641
soup = BeautifulSoup(post['content']['rendered'], 'html.parser')
3742
post['content_plain'] = soup.get_text()
3843
first_image = soup.find('img')
39-
post['first_image'] = first_image['src'] if first_image else get_featured_media(post['featured_media'])
40-
41-
post['formatted_date'] = datetime.strptime(post['date'], '%Y-%m-%dT%H:%M:%S').strftime('%B %d, %Y')
44+
post['first_image'] = first_image['src'] if first_image else get_featured_media(
45+
post['featured_media'])
46+
47+
post['formatted_date'] = datetime.strptime(
48+
post['date'], '%Y-%m-%dT%H:%M:%S').strftime('%B %d, %Y')
4249

43-
author_data = fetch_data(f"https://thecollegeview.ie/wp-json/wp/v2/users/{post['author']}")
50+
author_data = fetch_data(
51+
f"https://thecollegeview.ie/wp-json/wp/v2/users/{post['author']}")
4452
if author_data:
4553
post['author_name'] = author_data.get('name')
4654
post['author_slug'] = author_data.get('slug')
@@ -49,15 +57,17 @@ def tcv_posts(url):
4957

5058
return posts
5159

60+
5261
def process_linktree_data(sheet_url):
5362
url_1 = sheet_url.replace('/edit', '/export?format=csv&')
54-
texts = pd.read_csv(url_1, usecols= ['TEXT'])
55-
links = pd.read_csv(url_1, usecols= ['LINK'])
63+
texts = pd.read_csv(url_1, usecols=['TEXT'])
64+
links = pd.read_csv(url_1, usecols=['LINK'])
5665
text = [i[0] for i in texts.values]
5766
link = [i[0] for i in links.values]
5867
linktree = zip(text, link)
5968
return linktree
6069

70+
6171
def get_date_time():
6272
date = datetime.now()
6373
day_name = date.strftime("%A")
@@ -136,14 +146,18 @@ def get_date_time():
136146
}
137147

138148
if day_name in timetable and 9 <= hour <= 20:
139-
current_show = timetable[day_name].get(hour, "No shows on at the moment")
140-
previous_show = timetable[day_name].get(hour - 1, "No shows on at the moment")
141-
next_show = timetable[day_name].get(hour + 1, "No shows on at the moment")
149+
current_show = timetable[day_name].get(
150+
hour, "No shows on at the moment")
151+
previous_show = timetable[day_name].get(
152+
hour - 1, "No shows on at the moment")
153+
next_show = timetable[day_name].get(
154+
hour + 1, "No shows on at the moment")
142155
else:
143156
current_show = previous_show = next_show = "No shows on at the moment"
144157

145158
return previous_show, current_show, next_show
146159

160+
147161
def get_latest_video_id(channel_url):
148162
feed = feedparser.parse(channel_url)
149163

@@ -153,7 +167,8 @@ def get_latest_video_id(channel_url):
153167
return video_id
154168
else:
155169
return None
156-
170+
171+
157172
def get_latest_video_ids(channel_url):
158173
feed = feedparser.parse(channel_url)
159174
video_ids = []
@@ -165,6 +180,7 @@ def get_latest_video_ids(channel_url):
165180

166181
return video_ids
167182

183+
168184
def get_most_popular_video_ids(channel_url, n=9):
169185
ydl_opts = {
170186
'quiet': True,
@@ -179,17 +195,18 @@ def get_most_popular_video_ids(channel_url, n=9):
179195
info = ydl.extract_info(channel_url, download=False)
180196
video_ids = [entry['id'] for entry in info['entries']]
181197
return video_ids
182-
183-
def get_donation_count_fm():
198+
199+
200+
def get_donation_count():
184201
URL = "https://www.idonate.ie/fundraiser/MediaProductionSociety12"
185202
headers = {
186-
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"}
187-
203+
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"}
204+
188205
data = {
189206
'totalRaised': 0,
190207
'targetAmount': 0
191208
}
192-
209+
193210
try:
194211
r = requests.get(url=URL, headers=headers, timeout=10)
195212
r.raise_for_status()
@@ -201,79 +218,102 @@ def get_donation_count_fm():
201218

202219
total_raised_match = js_content.replace('\\', '').split(',')
203220

204-
205-
206221
for item in total_raised_match:
207222
if '"totalRaised":' in item:
208-
data['totalRaised'] = int(float(item.split(':')[1].replace('"', '')))
223+
data['totalRaised'] = int(
224+
float(item.split(':')[1].replace('"', '')))
209225
if '"targetAmount":' in item:
210-
data['targetAmount'] = int(float(item.split(':')[1].replace('"', '')))
211-
226+
data['targetAmount'] = int(
227+
float(item.split(':')[1].replace('"', '')))
228+
212229
return data
213-
230+
214231
except (requests.RequestException, ValueError, IndexError, AttributeError) as e:
215232
return data
216233

217-
def get_event_data():
218-
data = {}
219-
events = {}
220-
URL = f"https://dcuclubsandsocs.ie/society/media-production"
221-
headers = {'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0"}
222-
r = requests.get(url=URL, headers=headers)
223-
soup = BeautifulSoup(r.content, 'html5lib')
224-
events_data = soup.find('div', attrs = {'id':'events'})
225-
try:
226-
event_count = int(events_data.find('span', attrs = {'class':'float-right badge badge-light'}).text)
227-
except:
228-
event_count = 0
229-
if event_count == 0:
230-
data['event_count'] = event_count
231-
data['events'] = None
232-
return data
233-
event_table = events_data.find('div', attrs = {'class':'table-responsive'})
234-
events_info_list = event_table.find_all('tr', attrs={'class':'show_info pointer'})
235-
events_info_hidden = event_table.find_all('tr', attrs={'class':'d-none'})
236-
237-
for i in range(0, len(events_info_list) - 1, 2):
238-
event_info = events_info_list[i]
239-
try:
240-
event_image = event_info.find('img')['src']
241-
except:
242-
event_image = "static/assets/img/other/upcoming_event.png"
243-
event_name = event_info.find('th', attrs={'class': 'h5 align-middle'}).text.strip()
244-
events["event_" + str(i // 2)] = {'name': event_name, 'image': event_image}
245-
246-
for i in range(1, len(events_info_list), 2):
247-
event_info = events_info_list[i]
248-
event_data = event_info.find_all('td', attrs={'class': 'text-center align-middle'})
249-
events["event_" + str(i // 2)]['start'] = event_data[1].find('b').text
250-
events["event_" + str(i // 2)]['end'] = event_data[2].find('b').text
251-
events["event_" + str(i // 2)]['cost'] = event_data[3].find('b').text
252-
events["event_" + str(i // 2)]['capacity'] = event_data[4].find('b').text
253-
events["event_" + str(i // 2)]['type'] = event_data[5].find('b').text
254-
events["event_" + str(i // 2)]['location'] = events_info_hidden[i].find('b').text
255-
events["event_" + str(i // 2)]['description'] = events_info_hidden[i].find('p')
256-
257-
data['event_count'] = event_count
258-
data['events'] = events
259-
return data
260-
261-
262-
263-
FOLDER_ID = ''
264-
API_KEY = ''
265-
266-
def list_images():
267-
url = f'https://www.googleapis.com/drive/v3/files?q="{FOLDER_ID}" in parents&key={API_KEY}'
268-
response = requests.get(url)
269-
data = response.json()
270-
271-
image_urls = []
272-
if 'files' in data:
273-
for item in data['files']:
274-
file_id = item['id']
275-
file_name = item['name']
276-
file_url = f'https://drive.usercontent.google.com/download?id={file_id}'
277-
image_urls.append({'name': file_name, 'url': file_url})
278-
279-
return image_urls
234+
235+
def get_live_broadcast_shows():
236+
date = datetime.now()
237+
day_name = date.strftime("%A")
238+
current_time = date.strftime("%H:%M")
239+
current_hour = date.hour
240+
current_minute = date.minute
241+
242+
timetable = {
243+
"Wednesday": {
244+
"20:00": "Broadcast Introduction",
245+
"20:30": "Lip Sync Battle",
246+
"21:00": "The Oscars",
247+
"21:30": "Focus Interview",
248+
"22:00": "Hot Wans",
249+
"22:30": "Sa(m)tas Corner",
250+
"23:00": "DCeUrovision",
251+
"23:30": "Freshers on Air",
252+
},
253+
"Friday": {
254+
"00:00": "Storytime with Holly",
255+
"00:20": "Doghouse",
256+
"00:40": "Inkmaster",
257+
"01:00": "Crowtalk",
258+
"01:30": "CommiTEA",
259+
"02:00": "Game Changer",
260+
"02:20": "Undercover boss",
261+
"02:40": "Weird Films & Queer Men in music",
262+
"03:00": "Bird Brains III: Bait Masters",
263+
"03:30": "Carpool Kareoke",
264+
"04:00": "Sexy Calendar",
265+
"04:30": "The Lore",
266+
"05:00": "Competitive Yapping",
267+
"05:20": "What did they just say?",
268+
"05:40": "The Wheel",
269+
"06:00": "The Thing is...",
270+
"06:30": "Are you smarter than a Comms Student?",
271+
"07:00": "Infuriating Guessing Game",
272+
"07:30": "Committee Bake off",
273+
"08:00": "Get Flexy!",
274+
"08:30": "The Voice DCU",
275+
"09:00": "This & Yap",
276+
"09:30": "Family Feud",
277+
"10:00": "Unlikely Things to Hear / Would I lie to you?",
278+
"10:30": "Spill your Guts or Fill your Guts",
279+
"11:00": "Battle of the FM Flagships",
280+
"11:30": "The DIBS Boys",
281+
"12:00": "Drama",
282+
"12:30": "Comms Dine with me",
283+
"13:00": "Her Campus",
284+
"13:30": "DCUtv Guesses",
285+
"14:00": "Action Replay vs The Dugout",
286+
"14:30": "Taskmaster",
287+
"15:00": "Price is Right: Londis Edition",
288+
"15:30": "Expectations Vs Reality",
289+
"16:00": "Franks Butcher Shop",
290+
"16:30": "Breaking News",
291+
"17:00": "DCU Seagulls",
292+
"17:30": "Six One",
293+
"18:00": "Lip Sync Battle 2",
294+
"18:30": "GoldenCards",
295+
"19:00": "Early Early Product Placement",
296+
"19:30": "Thursday Night Live",
297+
"20:00": "Farewells",
298+
}
299+
}
300+
301+
if day_name in timetable:
302+
sorted_times = sorted(timetable[day_name].keys())
303+
304+
current_show_b = "No shows on at the moment"
305+
previous_show_b = "No shows on at the moment"
306+
next_show_b = "No shows on at the moment"
307+
308+
for i, show_time in enumerate(sorted_times):
309+
if current_time >= show_time:
310+
current_show_b = timetable[day_name][show_time]
311+
if i > 0:
312+
previous_show_b = timetable[day_name][sorted_times[i - 1]]
313+
if i + 1 < len(sorted_times):
314+
next_show_b = timetable[day_name][sorted_times[i + 1]]
315+
break
316+
else:
317+
current_show_b = previous_show_b = next_show_b = "No shows on at the moment"
318+
319+
return previous_show_b, current_show_b, next_show_b

mps_site/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
<li><a href="http://youtube.com/dcumps" target="_blank" aria-label="DCU MPS YouTube"><i class="fa-brands fa-youtube"></i></a></li>
141141
<li><a href="https://www.tiktok.com/@dcumps" target="_blank" aria-label="DCU MPS TikTok"><i class="fa-brands fa-tiktok"></i></a></li>
142142
</ul>
143-
<p>© 1985 - 2024 by DCU MPS. Designed and maintained by <a href="https://www.jakefarrell.ie" target="_blank"><strong>Jake Farrell</strong></a></p>
143+
<p>© 1985 - 2025 by DCU MPS. Designed and maintained by <a href="https://www.jakefarrell.ie" target="_blank"><strong>Jake Farrell</strong></a></p>
144144
<p>Powered with ❤️ by <a href="https://redbrick.dcu.ie" target="_blank"><strong>Redbrick</strong></a></p>
145145
</div>
146146
</footer>

mps_site/templates/components/home/about_us.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ <h1>About Us</h1>
66
<div class="row">
77
<div class="col-md-6">
88

9-
<p>DCU’s Media Production Society was founded in 1985, with the aim of operating as a creative and social outlet to a broad variety of students within the university. Composed of three strands, MPS offers the opportunity for its members to gain practical experience in their chosen field of media and collaborate with other, like-minded creatives. Over our 39 years of experience, MPS has thrived across the board, winning a variety of awards at both a University and a National level.<br><br>
9+
<p>DCU’s Media Production Society was founded in 1985, with the aim of operating as a creative and social outlet to a broad variety of students within the university. Composed of three strands, MPS offers the opportunity for its members to gain practical experience in their chosen field of media and collaborate with other, like-minded creatives. Over our 40 years of experience, MPS has thrived across the board, winning a variety of awards at both a University and a National level.<br><br>
1010
DCUtv offers members the opportunity to fully immerse themselves in the world of visual media. DCUtv not only encourages all MPS members to create video content, but also to gain hands-on experience in the more technical aspects of video production. Through annual events run by our TV team, such as the DCUtv 24 hour broadcast, MPS offers the chance to our members to come together and create, catering to all experience levels and interests, both in front of and behind the camera. In 2023, our DCUtv Team won “Best Promotional Video” at the BICS, which are the National Society Awards.
1111
</p>
1212
</div>
@@ -16,7 +16,7 @@ <h1>About Us</h1>
1616
<div class="col-md-12"> <!-- style="background-color: #202E4E; padding: 10px; border-radius: 25px;"-->
1717
<p>DCUfm is Ireland’s Best Student Radio Station. DCUfm is run by our members and their wonderful ideas - you give us your concept and we show you how to take it on air. Additionally, our fantastic podcasting equipment allows members to continue their audio endeavours outside of the studio. DCUfm instils a profound love for audio creation in all of its members, with many of the station’s alumni currently working in stations such as Spin 103.8, Newstalk and FM104.<br><br>
1818
The College View is DCU’s student newspaper. TCV offers members a way to enhance their writing skills and explore different types of journalism - from hard news to wacky satire, from the latest sports scores to reviewing what’s in the cinema. Stories are published online on www.thecollegeview.ie. There’s opportunities to attend and cover events across campus and outside DCU - with the Editorial Team always looking for writers to give their own edge on what’s going on in the University.<br><br>
19-
After 39 years, thousands of members, (and not to mention a global pandemic), MPS continues to grow in numbers and talent year on year. This year, our passionate and dedicated Committee aims to see MPS succeed and function at the highest possible level, with weekly events, workshops and activities for all of our members. MPS seeks to present exciting opportunities to our members, both creatively and socially, and foster the immense potential within DCU students. We hope to continue to do so as we move forward in years to come.
19+
After 40 years, thousands of members, (and not to mention a global pandemic), MPS continues to grow in numbers and talent year on year. This year, our passionate and dedicated Committee aims to see MPS succeed and function at the highest possible level, with weekly events, workshops and activities for all of our members. MPS seeks to present exciting opportunities to our members, both creatively and socially, and foster the immense potential within DCU students. We hope to continue to do so as we move forward in years to come.
2020
</p>
2121
</div>
2222
</div>

0 commit comments

Comments
 (0)