manual track selection via TK GUI

main
Rob Canning 2024-03-02 11:09:53 +01:00
parent 38a399c8f9
commit 3053079051
3 changed files with 82 additions and 212 deletions

View File

@ -1,6 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-KYQSVBZSME"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-KYQSVBZSME');
</script>
<title>{{show_name}}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
@ -35,93 +45,39 @@
</div>
<header class="site-navbar py-4 absolute transparent" role="banner">
<div class="container">
<div class="row align-items-center">
<!-- <div class="col-3" data-aos="fade-down"> -->
<!-- <h1><a href="index.html" class="text-white h2">{{show_name}}</a></h1> -->
<!-- </div> -->
<div class="col-9" data-aos="fade-down">
<nav class="site-navigation position-relative text-right text-md-right" role="navigation">
<div class="d-inline-block ml-md-0 mr-auto py-3"><a href="#" class="site-menu-toggle js-menu-toggle text-white"><span class="icon-menu h3"></span></a></div>
<ul class="site-menu js-clone-nav d-none">
<li class="has-children">
<a href="index.html">Home</a>
<ul class="dropdown arrow-top">
<li><a href="#">Menu One</a></li>
<li><a href="#">Menu Two</a></li>
<li><a href="#">Menu Three</a></li>
<li class="has-children">
<a href="#">Sub Menu</a>
<ul class="dropdown">
<li><a href="#">Menu One</a></li>
<li><a href="#">Menu Two</a></li>
<li><a href="#">Menu Three</a></li>
</ul>
</li>
</ul>
</li>
<li class="has-children">
<a href="#">Dropdown</a>
<ul class="dropdown arrow-top">
<li><a href="#">Menu One</a></li>
<li><a href="#">Menu Two</a></li>
<li><a href="#">Menu Three</a></li>
</ul>
</li>
<li class="active"><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</div>
</div>
</div>
</header>
<div class="site-blocks-cover overlay inner-page-cover" style="background-image: url({{episode_image}});" data-aos="fade" data-stellar-background-ratio="0.5">
<div class="container">
<div class="row align-items-center justify-content-center text-center">
<div class="col-md-8" style="background-color: rgba(0,0,0,0.5)" data-aos="fade-up" data-aos-delay="400">
<h2 style="background-color: black;" class="text-white font-weight-light mb-2 display-4">{{show_name}} | Episode #{{episode_number}} </h2>
<h2 class="text-white font-weight-light mb-2 display-4">{{show_name}} | Episode #{{episode_number}} </h2>
<p class="text-white font-weight-light">Latest Episode: #{{episode_number}} with music from: {{episode_artists}}</p>
<div class="text-white mb-3"><span class="text-white" style="color: white; background-color: black;" > Hosted by: {{episode_author}} | First broadcast: {{episode_date}} | <br> Total running time: {{episode_duration}}</small></span></div>
</div>
</div>
</div>
</div>
<!-- <div class="player mb-2"> -->
<audio id="player2" preload="none" controls style="max-width: 30%">
<source src="show.mp3" type="audio/mp3">
</audio>
<!-- </div> -->
<div class="container site-section">
<div class="text-white mb-4"><span class="text-white">Presented by: {{episode_author}} / Zavod Rizoma | {{episode_date}}</span>
<div class="text-white mb-3">
<span class="text-white" style="" >
Produced by Zavod Rizoma, Presented by: {{episode_author}}
<br> First broadcast: {{episode_date}}
<br> Total running time: {{episode_duration}}
</small>
</span>
</div>
</div>
</div>
</div>
</div>
<!-- <div class="container site-section"> -->
<div class="row justify-content-center">
<div class="col-md-12">
<h2>{{show_name}} | Episode #{{episode_number}} | {{episode_date}}</h2>
<div class="player mb-5">
<audio id="player2" preload="none" controls style="max-width: 100%">
<source src="show.mp3" type="audio/mp3">
</audio>
</div>
<em>Playtime: {{episode_duration}} | Show presented by: {{episode_author}} | First broadcast: {{episode_date}} | {{show_url}}</em>
<!-- {% for track in episode_playlist[0:] %} -->
<!-- <p><b> {{track}} </b> </p> -->
<!-- {% endfor %} -->
<table class="table table-striped">
<!-- <img src="{{episode_image}}" width="500"/> TODO MAKE THIS PRETTY -->
<!-- <TD class="c1"><IMG src="favicon.ico"></TD> -->
@ -141,7 +97,7 @@
<TD class="c1"><i>{{track[1]}}</i></TD>
<TD class="c2">{{track[2]}}</TD>
<TD class="c3">{{track[3]}}</TD>
<TD class="c4">{{track[4]}}</TD>
<TD class="//c4">{{track[4]}}</TD>
<TD class="c5">{{track[5]}}</TD>
<TD class="c5">{{track[6]}}</T>
@ -156,12 +112,11 @@
<p><a href="../../index.html" class="btn btn-primary btn-sm py-3 px-4 small">Back to Episode List</a></p>
</div>
</div>
</div>
</div>
<!-- </div> -->
<footer class="site-footer">
@ -296,15 +251,6 @@
</div>
</div>
<div class="row pt-5 mt-5 text-center">
<div class="col-md-12">
<p>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright &copy;<script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script>document.write(new Date().getFullYear());</script> All rights reserved | This template is made with <i class="icon-heart-o" aria-hidden="true"></i> by <a href="https://colorlib.com" target="_blank" >Colorlib</a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
</p>
</div>
</div>
</div>
</footer>

View File

@ -2,6 +2,16 @@
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-KYQSVBZSME"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-KYQSVBZSME');
</script>
<title>{{show_name}}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
@ -35,75 +45,16 @@
</div>
<header class="site-navbar py-4 absolute transparent" role="banner">
<div class="container">
<div class="row align-items-center">
<!-- <div class="col-3" data-aos="fade-down"> -->
<!-- <h1><a href="#" class="text-white h2">{{show_name}}</a></h1> -->
<!-- </div> -->
<div class="col-9" data-aos="fade-down">
<nav class="site-navigation position-relative text-right text-md-right" role="navigation">
<div class="d-inline-block ml-md-0 mr-auto py-3"><a href="#" class="site-menu-toggle js-menu-toggle text-white"><span class="icon-menu h3"></span></a></div>
<ul class="site-menu js-clone-nav d-none">
<li class="has-children active">
<a href="index.html">Home</a>
<ul class="dropdown arrow-top">
<li><a href="#">Menu One</a></li>
<li><a href="#">Menu Two</a></li>
<li><a href="#">Menu Three</a></li>
<li class="has-children">
<a href="#">Sub Menu</a>
<ul class="dropdown">
<li><a href="#">Menu One</a></li>
<li><a href="#">Menu Two</a></li>
<li><a href="#">Menu Three</a></li>
</ul>
</li>
</ul>
</li>
<li class="has-children">
<a href="#">Dropdown</a>
<ul class="dropdown arrow-top">
<li><a href="#">Menu One</a></li>
<li><a href="#">Menu Two</a></li>
<li><a href="#">Menu Three</a></li>
</ul>
</li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</div>
</div>
</div>
</header>
<div class="site-blocks-cover overlay" style="background-image: url(episode/{{episode_number}}/{{episode_image}});" data-aos="fade" data-stellar-background-ratio="0.5">
<div class="container">
<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="tex font-weight-light mb-2 display-4">The Podcast {{show_name}}!</h2>
<div class="col-md-12" style="background-color: rgba(0,0,0, 0.7)" data-aos="fade-up" data-aos-delay="400">
<h2 class="tex font-weight-light mb-2 display-4" style="margin:0; padding-bottom:0; margin-bottom:0">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 class="text-white font-weight-light" >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">
</audio>
</div>
<div class="text-white mb-4"><span class="text-white">Produced by Zavod Rizoma and Presented by: {{episode_author}} {{episode_date}}</span>
</div>
@ -368,31 +319,9 @@
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>
</div>
<!-- <div class="mb-5"> -->
<!-- <h3 class="footer-heading mb-2">Subscribe Newsletter</h3> -->
<!-- <form action="#" method="post"> -->
<!-- <div class="input-group mb-3"> -->
<!-- <input type="text" class="form-control border-secondary text-white bg-transparent" placeholder="Enter Email" aria-label="Enter Email" aria-describedby="button-addon2"> -->
<!-- <div class="input-group-append"> -->
<!-- <button class="btn btn-primary" type="button" id="button-addon2">Send</button> -->
<!-- </div> -->
<!-- </div> -->
<!-- </form> -->
<!-- </div> -->
</div>
</div>
<div class="row pt-5 mt-5 text-center">
<div class="col-md-12">
<p>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright &copy;<script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script>document.write(new Date().getFullYear());</script> All rights reserved | This template is made with <i class="icon-heart-o" aria-hidden="true"></i> by <a href="https://colorlib.com" target="_blank" >Colorlib</a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
</p>
</div>
</div>
</div>

View File

@ -40,7 +40,6 @@ 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 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
input_date = args.date
episode_date = datetime.datetime.now().strftime("%Y-%m-%d")
@ -70,21 +69,26 @@ def set_episode_date(input_date):
return episode_date
def get_intro():
intropath = "audio/intros"
intro = random.choice(os.listdir(intropath))
#final_playlist.insert(0, str(os.path.abspath(intropath)) + "/" + str(intro))
return str(str(intropath) + "/" + str(intro))
def get_midshow_CTA():
midshow_path = "audio/midshow_CTA"
midshow_CTA = random.choice(os.listdir(midshow_path))
#final_playlist.insert(0, str(os.path.abspath(intropath)) + "/" + str(intro))
return str(str(midshow_path) + "/" + str(midshow_CTA))
def select_specific_track(conn, episode_number, episode_duration):
filename = fd.askopenfilename()
cursor = conn.cursor()
cursor.execute("SELECT * FROM MUSIC_LIBRARY WHERE path = ? ", (filename, ))
r = cursor.fetchone()
print(filename)
return r
def choose_a_track(conn, episode_number, ):
def choose_a_track(conn, episode_number, choice ):
print("adding a track")
global episode_duration
global track_count
@ -95,9 +99,13 @@ def choose_a_track(conn, episode_number, ):
min_track_dur = 2
cursor = conn.cursor()
if choice == 0:
cursor.execute("SELECT * FROM MUSIC_LIBRARY ORDER BY RANDOM() LIMIT 1 ;")
r = cursor.fetchone() # FETCH ONE RANDOM TRACK FROM THE DATABASE
print(r)
else:
r = select_specific_track(conn, episode_number, episode_duration)
# TODO lookup path and get complete db record
#name= fd.askopenfilename()
@ -158,7 +166,6 @@ def choose_a_track(conn, episode_number, ):
def check_archive(track_path):
cursor = conn.cursor()
cursor.execute("SELECT * FROM EPISODES WHERE path = ?", (track_path,))
data=cursor.fetchone()
@ -172,7 +179,6 @@ def check_archive(track_path):
#TODO limit number of KM Compilations in new function
def check_for_KM_compilation(track_album):
"TODO fix me"
# check if album is played already on this episode - maybe last 2 episodes >= or similar
cursor = conn.cursor()
@ -190,7 +196,6 @@ def check_for_KM_compilation(track_album):
def check_album(track_album):
# check if album is played already on this episode - maybe last 2 episodes >= or similar
cursor = conn.cursor()
cursor.execute("SELECT * FROM EPISODES WHERE album = ? AND episode = ?", (track_album,episode_number))
@ -222,7 +227,6 @@ def check_artist(track_artist):
track_count = 1
def create_episode_playlist(conn, episode_number):
global episode_duration
global archive
global track_count
@ -242,7 +246,7 @@ def create_episode_playlist(conn, episode_number):
# 56 mins of audio rest for fillers - aprox.
while episode_duration < 56 * 60 and track_count <= 12 :
print(track_count)
choose_a_track(conn, episode_number)
choose_a_track(conn, episode_number, 0)
modify_playlist(conn, episode_number, episode_duration)
@ -252,6 +256,8 @@ def playlist_replace_track(conn, episode_number, episode_duration):
global track_count
cursor = conn.cursor()
track_to_replace = int(input(">>>>>>>>>> Which track number would you like to REPLACE? : "))
specific_or_random = int(input(">>>>>>>>>> with a specific (1) or random track (0) : "))
# delete the old track
cursor.execute('DELETE FROM EPISODES WHERE episode = {0} AND track_number={1}'\
.format(episode_number, track_to_replace ))
@ -259,7 +265,7 @@ def playlist_replace_track(conn, episode_number, episode_duration):
# this is where the index number comes from in the below choose_a_track function
track_count = track_to_replace
# insert the new track
choose_a_track(conn, episode_number)
choose_a_track(conn, episode_number, specific_or_random)
conn.commit()
# get the new episode time
cursor.execute('SELECT SUM(trackdur) FROM EPISODES WHERE EPISODE=? ', [episode_number])
@ -270,7 +276,6 @@ def playlist_replace_track(conn, episode_number, episode_duration):
def playlist_add_track(conn, episode_number, episode_duration):
global track_count
cursor = conn.cursor()
#track_to_add = int(input(">>>>>>>>>> Where would you like to ADD the track? : "))
@ -320,7 +325,6 @@ def playlist_delete_track(conn, episode_number, episode_duration):
def playlist_shuffle_tracks(conn, episode_number, episode_duration):
os.system("clear")
# shuffle the episode
cursor = conn.cursor()
@ -352,7 +356,6 @@ def playlist_shuffle_tracks(conn, episode_number, episode_duration):
def playlist_preview_track(conn, episode_number, episode_duration):
cursor = conn.cursor()
# preview a track --------------------------------------
preview_track = input(">>>>>>>> Which track would you like to preview : ")
@ -364,7 +367,6 @@ def playlist_preview_track(conn, episode_number, episode_duration):
def modify_playlist(conn, episode_number, episode_duration):
cursor = conn.cursor()
cursor.execute('SELECT * FROM EPISODES WHERE EPISODE=? ORDER BY track_number ASC', [episode_number])
preview = cursor.fetchall()
@ -388,7 +390,8 @@ def modify_playlist(conn, episode_number, episode_duration):
(l)isten to track
(n)EW (playlist),
(s)HUFFLE
(r)EPLACE
(r)EPLACE random
(c) choose specific track
(d)ELETE
(a)DD
@ -404,6 +407,9 @@ def modify_playlist(conn, episode_number, episode_duration):
elif user_input == 'r':
playlist_replace_track(conn, episode_number, episode_duration)
elif user_input == 'c':
select_specific_track(conn, episode_number, episode_duration)
elif user_input == 'l':
playlist_preview_track(conn, episode_number, episode_duration)
@ -423,12 +429,9 @@ def modify_playlist(conn, episode_number, episode_duration):
# ----------------------------------------------------------------------
def combine_images(columns, space, images, variants:int):
global show_cover
print(images)
set_episode_date(input_date)
rows = len(images) // columns
if len(images) % columns:
@ -512,7 +515,6 @@ def combine_images(columns, space, images, variants:int):
# -------------------------------------------------------------------------------
def create_show_coverart(variants):
set_episode_date(input_date)
final_playlist = []
@ -640,10 +642,7 @@ def social_media_post():
''')
def create_animated_gif():
# filepaths
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"
@ -775,7 +774,6 @@ def create_podcast():
### ------------------------------------------------------------
def create_html_homepage_from_template():
# TODO "on this weeks show" variants fed to html from list here
set_episode_date(input_date)
@ -903,7 +901,6 @@ def parse_db_episode():
return output_from_parsed_template
def create_html_episode_from_template(episode_number, episode_duration):
set_episode_date(input_date)
output_from_parsed_template = parse_db_episode()
@ -1023,7 +1020,6 @@ def create_RSS_XML_from_template():
rss_page.write(output_from_parsed_template)
def main():
# playlist options
if args.playlist == "new":
@ -1077,4 +1073,3 @@ def main():
conn.close()
main()