diff --git a/html/templates/episode.jinja b/html/templates/episode.jinja index bc73a05..025ba51 100644 --- a/html/templates/episode.jinja +++ b/html/templates/episode.jinja @@ -1,6 +1,16 @@ + + + + {{show_name}} @@ -35,94 +45,40 @@ -
-

{{show_name}} | Episode #{{episode_number}}

+

{{show_name}} | Episode #{{episode_number}}

Latest Episode: #{{episode_number}} with music from: {{episode_artists}}

-
Hosted by: {{episode_author}} | First broadcast: {{episode_date}} |
Total running time: {{episode_duration}}
-
-
-
-
+ + + + + +
+ + Produced by Zavod Rizoma, Presented by: {{episode_author}} +
First broadcast: {{episode_date}} +
Total running time: {{episode_duration}} + +
+
+ + + + -
- -
Presented by: {{episode_author}} / Zavod Rizoma | {{episode_date}} -
+
-

{{show_name}} | Episode #{{episode_number}} | {{episode_date}}

- -
- -
- - Playtime: {{episode_duration}} | Show presented by: {{episode_author}} | First broadcast: {{episode_date}} | {{show_url}} - - - - - - +
@@ -141,7 +97,7 @@ - +
#{{track[1]}} {{track[2]}} {{track[3]}}{{track[4]}}{{track[4]}} {{track[5]}} {{track[6]}} @@ -156,12 +112,11 @@

Back to Episode List

- - + - +
@@ -296,15 +251,6 @@ -
-
-

- - Copyright © All rights reserved | This template is made with by Colorlib - -

-
-
diff --git a/html/templates/homepage.jinja b/html/templates/homepage.jinja index cfe70e2..ce4ecd4 100644 --- a/html/templates/homepage.jinja +++ b/html/templates/homepage.jinja @@ -2,6 +2,16 @@ + + + + {{show_name}} @@ -35,77 +45,18 @@ - -
-
-

The Podcast {{show_name}}!

-

The best alternative music from Slovenia, every week.

+
+

The Podcast {{show_name}}!

+

The best alternative music from Slovenia, every week.

+

Latest Episode: #{{episode_number}} with music from: {{episode_artists}}

+

Episode #{{episode_number}} Details and Player

+
Produced by Zavod Rizoma and Presented by: {{episode_author}} {{episode_date}} -

Latest Episode: #{{episode_number}} with music from: {{episode_artists}}

- -

Episode #{{episode_number}} Details and Player

-
Presented by: {{episode_author}} / Zavod Rizoma | {{episode_date}} -
- -
- -
+
@@ -129,7 +80,7 @@

Episode: # {{episode.episode_number}}

- Presented by Rob Canning / {{episode.episode_date}} / {{episode.episode_duration}}
+ Presented by Rob Canning / {{episode.episode_date}} / {{episode.episode_duration}}

On this weeks show music from: {{episode.episode_artists}}

@@ -368,32 +319,10 @@ You can also subscribe to our RSS feed via Soundcloud or Youtube
- - - - - - - - - - - - - - -
-
-

- - Copyright © All rights reserved | This template is made with by Colorlib - -

-
- +
diff --git a/mk_show.py b/mk_show.py index d846fa2..37e3783 100755 --- a/mk_show.py +++ b/mk_show.py @@ -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,10 +99,14 @@ def choose_a_track(conn, episode_number, ): min_track_dur = 2 cursor = conn.cursor() - cursor.execute("SELECT * FROM MUSIC_LIBRARY ORDER BY RANDOM() LIMIT 1 ;") - r = cursor.fetchone() # FETCH ONE RANDOM TRACK FROM THE DATABASE - print(r) - + + 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() #print(name) @@ -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,8 +246,8 @@ 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 @@ -403,7 +406,10 @@ 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": @@ -1075,6 +1071,5 @@ def main(): print("not creating audio output......") conn.close() - + main() -