RSS Feed now working

main
Rob Canning 2024-02-11 02:47:44 +01:00
parent 59e9a079e8
commit cc587f60b3
8 changed files with 145 additions and 94 deletions

Binary file not shown.

View File

@ -3,7 +3,8 @@
import feedparser
#d = feedparser.parse('http://www.reddit.com/r/python/.rss')
d = feedparser.parse('file:///home/rob/antena/html/podcast_rss.xml')
#d = feedparser.parse('file:///home/rob/uho/html/podcast_rss.xml')
d = feedparser.parse('https://uho.rizom.si/podcast_rss.xml')
for post in d.entries:
# print(post.title + ": " + post.link + "")

View File

@ -4,7 +4,7 @@
<title>{{show_name}}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" type="image/x-icon" href="images/favicon.ico">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:200,300,400,700,900">
<link rel="stylesheet" href="../../fonts/icomoon/style.css">
@ -269,9 +269,9 @@
<div class="block-16">
<figure>
<a href="{{show_url}}/{{show_rss}}">
<img src="episode/1/img/cover0.png" alt="podcast" class="img-fluid rounded">
<img src="episode/1/img/cover0.jpeg" alt="podcast" class="img-fluid rounded">
</a>
</figure>
"P", palette=Image.ADAPTIVE, colors=256</figure>
<a href="{{show_url}}/{{show_rss}}">{{show_url}}/{{show_rss}}</a>
</div>
You can also subscribe to our RSS feed via Soundcloud <a href="https://soundcloud.com/uho-podcast" class="pl-3 pr-3"><span class="icon-soundcloud"></span></a> or Youtube <a href="https://www.youtube.com/@uho.podcast" class="pl-3 pr-3"><span class="icon-youtube"></span></a>

View File

@ -5,7 +5,7 @@
<title>{{show_name}}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" type="image/x-icon" href="images/favicon.ico">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:200,300,400,700,900">
<link rel="stylesheet" href="fonts/icomoon/style.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
@ -92,14 +92,13 @@
<div class="row align-items-center justify-content-center text-center">
<div class="col-md-12" data-aos="fade-up" data-aos-delay="400">
<h2 class="text-white font-weight-light mb-2 display-4">{{show_name}}</h2>
<p class="text-white font-weight-light">{{about_show}}</p>
<h4 class="text-white font-weight-light mb-2 display-4" style="color: white; background-color: black;" >Latest Episode: # {{episode_number}}</h4>
<p class="text-white font-weight-light" style="color: white; background-color: black;" >This week music from: {{episode_artists}}</p>
<h2 class="tex font-weight-light mb-2 display-4">The Podcast {{show_name}}!</h2>
<p class="tex font-weight-light mb-2 display-4">The best alternative music from Slovenia, every week.</p>
<p><a href="episode/{{episode_number}}/index.html" class="btn btn-primary btn-sm py-3 px-4 small">Episode Details and Player</a></p>
<!-- <p class="text-white font-weight-light" style="color: white; background-color: black;" >Latest Episode: #{{episode_number}} with music from: {{episode_artists}}</p> -->
<p><a href="episode/{{episode_number}}/index.html" class="btn btn-primary btn-sm py-3 px-4 small">Episode #{{episode_number}} Details and Player</a></p>
<div class="text-white mb-4"><span class="text-white">Presented by: {{episode_author}} / Zavod Rizoma | {{episode_date}}</span>
<div class="player">
<audio id="player2" preload="none" controls style="max-width: 100%">
<source src="episode/{{episode_number}}/show.mp3" type="audio/mp3">
@ -108,8 +107,6 @@
</div>
<p class="text-white font-weight-light">{{show_url}}</p>
</div>
</div>
</div>
@ -142,14 +139,6 @@
<div class="container" data-aos="fade-up">
<div class="row">
<div class="col-md-12 text-center">
@ -270,7 +259,7 @@
<div class="row">
<div class="col-lg-4">
<div class="mb-5">
<h3 class="footer-heading mb-4">About The {{show_name}} Podcast</h3>
<h3 class="footer-heading mb-4">About The Podcast {{show_name}}</h3>
<p>{{about_show}}</p>
</div>
@ -338,15 +327,14 @@
<h3 class="footer-heading mb-4">Follow Us on Social Media</h3>
We are on most of the social media platforms, please follow us and tell your friends about the podcast!
We are on most of the social media platforms, please follow us and tell your friends about the podcast!
<div>
<a href="https://www.facebook.com/profile.php?id=61555936138715" class="pl-0 pr-3"><span class="icon-facebook"></span></a>
<a href="https://twitter.com/uho_podcast" class="pl-3 pr-3"><span class="icon-twitter"></span></a>
<a href="https://www.instagram.com/uho.podcast" class="pl-3 pr-3"><span class="icon-instagram"></span></a>
<a href="https://www.youtube.com/@uho.podcast" class="pl-3 pr-3"><span class="icon-youtube"></span></a>
<a href="https://soundcloud.com/uho-podcast" class="pl-3 pr-3"><span class="icon-soundcloud"></span></a>
<a href="https://www.youtube.com/@uho.podcast" class="pl-3 pr-3"><span class="icon-youtube"></span></a>
<a href="https://soundcloud.com/uho-podcast" class="pl-3 pr-3"><span class="icon-soundcloud"></span></a>
</div>
<p></p>
<p></p>
@ -372,7 +360,7 @@
<div class="block-16">
<figure>
<a href="{{show_url}}/{{show_rss}}">
<img src="episode/1/img/cover0.png" alt="podcast" class="img-fluid rounded">
<img src="images/podcast-main.jpeg" alt="podcast" class="img-fluid rounded">
</a>
</figure>
<a href="{{show_url}}/{{show_rss}}">{{show_url}}/{{show_rss}}</a>

View File

@ -1,49 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Hiking Treks</title> <link>https://www.apple.com/itunes/podcasts/</link>
<title>The Podcast UHO!</title> <link>https://uho.rizom.si/podcast_rss.xml</link>
<language>en-us</language>
<copyright>© 2019 John Appleseed</copyright>
<itunes:author>The Sunset Explorers</itunes:author>
<description> {{short_description}} </description>
<itunes:type>serial</itunes:type>
<itunes:owner> <itunes:name>{{show_name}}</itunes:name>
<itunes:email>{{show_email}}</itunes:email>
<copyright>© 2024 Zavod Rizoma</copyright>
<itunes:author>Zavod Rizoma</itunes:author>
<description>{{about_show}}</description>
<itunes:summary>{{about_show}}</itunes:summary>
<itunes:type>music</itunes:type>
<itunes:owner>
<itunes:name>{{show_name}}</itunes:name>
<itunes:email>{{show_email}}</itunes:email>
</itunes:owner>
<itunes:image
href="{{show_image}}"
/>
<itunes:category text="Music">
<itunes:category text="Independent Music"/> </itunes:category>
<itunes:image href="https://uho.rizom.si/images/podcast-main.jpeg"/>
<itunes:category text="Music"/>
<itunes:explicit>false</itunes:explicit>
{% for rss_item in range(episode_number) %}
{% for rss_item in episodes %}
<item>
<itunes:episodeType>podcast</itunes:episodeType>
<itunes:title>{{show_name}} Episode # {{episode_number}}</itunes:title>
<description>
<content:encoded>
<![CDATA[{{show_short_description}} Listen on
<a
href="{{show_url}}">Rizoma Podcasts Homepage</a>.]]>
</content:encoded>
<title>#{{rss_item.episode_number}} : {{rss_item.episode_artists}} {{rss_item.episode_date[0][0]}} </title> <link>https://uho.rizom.si/episode/{{rss_item.episode_number}}</link>
<itunes:episodeType>full</itunes:episodeType>
<itunes:title>The Podcast UHO! Episode # {{rss_item.episode_number}}</itunes:title>
<itunes:summary>{{rss_item.episode_artists}} For full playlist details see: https://uho.rizom.si/episode/{{rss_item.eepisode_number}}
</itunes:summary>
<itunes:image href="{{rss_item.episode_image}}"/>
<description>{{rss_item.episode_artists}} For full playlist details see: https://uho.rizom.si/episode/{{rss_item.episode_number}}
</description>
<enclosure
length="{{episode_duration}}"
length="{{rss_item.episode_duration[0]}}"
type="audio/mpeg"
url="{{episde_mp3_url}}"
url="{{rss_item.episode_mp3_url}}"
/>
<guid>aae20190418</guid>
<pubDate>{{episode_pub_date}}</pubDate>
<!-- <pubDate>Tue, 8 Jan 2019 01:15:00 GMT</pubDate> -->
<itunes:duration>{{episode_duration}}</itunes:duration>
<guid>{{rss_item.episode_number}}</guid>
<pubDate>{{rss_item.episode_date[0][0]}}</pubDate>
<itunes:duration>{{rss_item.episode_duration[0]}}</itunes:duration>
<itunes:explicit>false</itunes:explicit>
</item>
{% endfor %}
</channel>
</rss
</rss>

View File

@ -13,7 +13,7 @@ import uuid
from pypika import Query, Table, Field, Column
music_library_path = "/home/rob/uho/music/"
conn = sqlite3.connect("database/show.db")
conn = sqlite3.connect("database/uho_music.db")
#TODO fix getting bandcamp urls into db
labelnames = [("sploh", "https://sploh.bandcamp.com"), ("terraformer"), ("pharamafabric") ]

View File

@ -31,14 +31,13 @@ args = parser.parse_args()
path = pathlib.Path.cwd()
show_name = "UhO"
show_name = "UHO"
show_url = "https://uho.rizom.si"
show_rss = "podcast_rss.xml"
show_email = "uho.podcast@gmail.com"
episode_author="Rob Canning"
show_short_description = '''The UhO! podcast presents an eclectic selection of independent music from Slovenia. The show aims to deliver as broad a range of genres as possible; banging techno, sludge, math rock, contemporary classical, doom, free improvisation, noise music, glitch, jazz skronk, field recordings, ambient, drone....etc etc... whatever the genre, you can be sure you are listening to the latest and most inovative music on offer in this part of the world. Hosted and compiled by Rob Canning, the show is published weekly by Zavod Rizoma and is broadcast in Slovenia on FM by mariborski radio študent: MARŠ. It as also available as a podcast. Use our RSS feed or search for UhO Podcast where ever you subscribe to podcasts'''
show_short_description = '''The UhO! podcast presents an eclectic selection of independent music from Slovenia. The show aims to deliver as broad a range of genres as possible; banging techno, sludge, math rock, contemporary classical, doom, free improvisation, noise music, glitch, jazz skronk, field recordings, ambient, drone....etc etc... whatever the genre, you can be sure you are listening to the latest and most innovative music on offer in this part of the world. Hosted and compiled by Rob Canning, the show is published weekly by Zavod Rizoma and is broadcast in Slovenia on FM by mariborski radio študent: MARŠ. It as also available as a podcast. Use our RSS feed or search for UhO Podcast where ever you subscribe to podcasts'''
episode_number = args.episode
@ -50,6 +49,8 @@ archive = []
#artists_played = []
artist_abreviated = []
episode_artists = []
# sqlite database connection
conn = sqlite3.connect("database/show.db")
@ -435,7 +436,7 @@ def combine_images(columns, space, images, variants:int):
background_width = width_max*columns + (space*columns)-space
background_height = height_max*rows + (space*rows)-space
#background = Image.new('RGBA', (background_width, background_height), (0, 0, 0, 255))
background = Image.new('RGBA', (width_max*columns , height_max*columns), (0, 0, 0, 255))
background = Image.new('RGB', (width_max*columns , height_max*columns), (0, 0, 0, 255))
x = 0
y = 0
@ -496,8 +497,9 @@ def combine_images(columns, space, images, variants:int):
im.text((1540,1888), '''{0} '''\
.format(show_url, show_name, episode_date,episode_number), fill="white", font=mf_h4)
show_cover = 'img/cover{2}.png'.format(episode_number,episode_date, variants)
background.save("html/" + "episode/{0}/{1}".format(episode_number, show_cover))
show_cover = 'img/cover{2}.jpg'.format(episode_number,episode_date, variants)
background.convert("P", palette=Image.ADAPTIVE, colors=256)
background.save("html/" + "episode/{0}/{1}".format(episode_number, show_cover), optimize=True)
#convert -delay 100 -loop 0 html/episode/2/img/show_cover_2024-01-12* animatedGIF.gif
return show_cover
@ -541,7 +543,7 @@ def create_show_coverart(variants):
def create_animated_gif():
# filepaths
fp_in = "/home/rob/uho/html/episode/2/img/*.png".format(episode_number)
fp_in = "/home/rob/uho/html/episode/2/img/*.jpg".format(episode_number)
fp_out = "/home/rob/uho/html/episode/2/img/show_cover.gif"
# use exit stack to automatically close opened images
@ -563,7 +565,7 @@ def create_animated_gif():
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
def create_podcast():
#TODO normalise-audio the wav fills before conversion to flac then replay-gain
print('''------------------------
creating show audio
------------------------''')
@ -611,7 +613,7 @@ def create_podcast():
# Insert a midshow CTA between track 6 outro and track 7 intro --------
final_playlist.insert(24, get_midshow_CTA()) # <-----------------------
# final_playlist.insert(24, get_midshow_CTA()) # <-----------------------
# ------------ MAIN SHOW STRUCTURE ENDS HERE --------------------------
@ -646,7 +648,6 @@ def create_podcast():
print(track)
playlist = playlist.append(track)
# TODO CLI flag to generate FLAC
# save the entire poidcast as FLAC
# with open("html/episode/{0}/show.flac".format(episode_number), 'wb') as out_f:
@ -661,7 +662,7 @@ def create_podcast():
playlist.export(out_f, format='mp3',\
tags={'title': str('Uho! Episode #{0} '.format(episode_number)),\
'artist': 'https://uho.rizom.si',\
'album': 'THE UHO PODCAST',\
'album': 'The Podcast UHO!',\
'comments': 'https://uho.rizom.si'})
print("MP3 audio file exported...")
@ -683,7 +684,7 @@ def create_html_homepage_from_template():
conn = sqlite3.connect("database/show.db")
cursor = conn.cursor()
episode_artists = []
#global episode_artists
#TODO fix this - now it reports zero
# get number of episodes from DB
@ -700,7 +701,7 @@ def create_html_homepage_from_template():
for artist in rows:
art = string=re.sub("\(.*?\)","", artist[0])
# shorten verbose artist names such as trojnik Trojnik (Cene Resnik, Tomaž Grom, Vid Drašler)
artist = string=re.sub("and","&",art)
artist = string=re.sub("and","+",art)
artists.append(artist)
episode_artists.append(artists)
@ -743,7 +744,7 @@ def create_html_homepage_from_template():
episode_artists=str(episode_artists[episode_number])\
.strip("[").strip("]").strip('\'').strip('\''), \
about_show=show_short_description, \
episode_image="img/cover0.png".format(episode_number))
episode_image="img/cover0.jpg".format(episode_number))
with open("html/index.html".format(episode_number), "w") as episode_page:
episode_page.write(output_from_parsed_template)
@ -788,13 +789,15 @@ def parse_db_episode():
# populate the jinja html template for the EPISODE
output_from_parsed_template = episode_template.render(\
show_name=show_name, episode_author=episode_author,\
episode_number=episode_number, show_url=show_url, show_rss=show_rss,\
episode_duration=timedelta(seconds=round(episode_duration)), \
episode_date=episode_date, about_show=show_short_description, \
episode_playlist=playlist_table, \
episode_image="img/cover0.png".format(episode_number))
episode_artists=episode_artists,\
show_name=show_name,\
episode_author=episode_author,\
episode_number=episode_number, show_url=show_url, \
show_rss=show_rss,\
episode_duration=timedelta(seconds=round(episode_duration)),\
episode_date=episode_date, about_show=show_short_description,\
episode_playlist=playlist_table,\
episode_image="img/cover0.jpg".format(episode_number))
return output_from_parsed_template
def create_html_episode_from_template(episode_number, episode_duration):
@ -851,23 +854,72 @@ def create_html_episode_from_template(episode_number, episode_duration):
episode_page.write(output_from_parsed_template)
def create_RSS_XML_from_template():
playlist_table = []
set_episode_date(input_date)
env = Environment(loader=FileSystemLoader('html/templates'))
rss_template = env.get_template('show_RSS.jinja.xml')
output_from_parsed_template = \
rss_template.render(\
show_name=show_name, \
episode_number=int(episode_number), episode_author=episode_author, \
show_url=show_url,\
episode_duration=timedelta(seconds=round(episode_duration)),\
about_show=show_short_description, \
episode_image="img/cover0.png".format(episode_number))
with open("html/show_rss.xml".format(episode_number), "w") as rss_page:
rss_page.write(output_from_parsed_template)
cursor = conn.cursor()
cursor.execute('SELECT MAX(episode) FROM EPISODES')
num_eps = cursor.fetchone()[0]
num_eps = num_eps+1
for i in range(num_eps):
artists = []
cursor.execute("SELECT artist FROM EPISODES WHERE episode=? ORDER BY track_number ASC", [i])
rows = cursor.fetchall()
for artist in rows:
art = string=re.sub("\(.*?\)","", artist[0])
# shorten verbose artist names such as trojnik Trojnik (Cene Resnik, Tomaž Grom, Vid Drašler)
artist = string=re.sub("and","+",art)
artists.append(artist)
episode_artists.append(artists)
dates = []
cursor.execute("SELECT date FROM EPISODES WHERE episode=? ORDER BY track_number ASC", [i])
d = cursor.fetchone()
dates.append(d)
trackdurs = []
cursor.execute("SELECT trackdur FROM EPISODES WHERE episode=? ORDER BY track_number ASC", [i])
td = cursor.fetchone()
trackdurs.append(str(60*60))
# TODO this is not what i need here - i need a final episode duraton so for now putting in a dummy value
episodes = []
for i in range(num_eps): # get this from new table EPISODE_STATS number of tracks in DB
#print(episode_artists[i])
an_episode = dict(date="2012-02-", \
episode_artists=str(episode_artists[i])\
.strip("[").strip("]").strip("\'"), episode_number=i, \
episode_date=dates, episode_mp3_url=show_url+"/episode/"+str(i)+"/show.mp3",\
episode_duration=trackdurs)
episodes.append(an_episode)
# reversed order to most recent episode appears first in list
print(episodes)
episodes = reversed(episodes[0:episode_number])
#TODO remove single quptes not working in episode_artists
# populate the jinja html template for the EPISODE
#''.join(random.choice((str.upper,str.lower))(x) for x in show_name)
output_from_parsed_template = rss_template.render(\
show_name=show_name, show_url=show_url, show_rss=show_rss, \
episodes=episodes, episode_author=episode_author,\
episode_date=episode_date,\
episode_duration=episode_duration, episode_number=episode_number, \
episode_artists=str(episode_artists[episode_number])\
.strip("[").strip("]").strip('\'').strip('\''), \
about_show=show_short_description, \
episode_image="img/cover0.jpg".format(episode_number))
with open("html/podcast_rss.xml".format(episode_number), "w") as rss_page:
rss_page.write(output_from_parsed_template)
def main():
# playlist options
@ -879,7 +931,7 @@ def main():
elif args.playlist=="keep":
print("working with playlist from database... ")
elif args.playlist=="edit":
print("edit the playlist...")
print("edit the playlishttps://uho.rizom.si/podcast_rss.xmlt...")
modify_playlist(conn, episode_number, episode_duration)
else:
print("not creating new show....")

View File

@ -0,0 +1,15 @@
# Featured Labels
BETON RECORDS
KAMIZDAT
MENT FESTIVAL
PHARMAFABRIK
TERRAFORMER_RF
DEBILA
KAPA RECORDS
NATURE SCENE RECORDS
MOONLEE RECORDS
SPLOH
ZARŠ
+ MANY SELF_RELEASES