diff --git a/database/show.db b/database/show.db index 6b52de3..ce70dc0 100644 Binary files a/database/show.db and b/database/show.db differ diff --git a/html/templates/episode.jinja b/html/templates/episode.jinja index 93471b1..da301db 100644 --- a/html/templates/episode.jinja +++ b/html/templates/episode.jinja @@ -117,7 +117,7 @@

This weeks playlist:

{% for track in episode_playlist[0:] %} -

{{track}}

+

{{track}}

{% endfor %} diff --git a/mk_music_library_db.py b/mk_music_library_db.py index 7a9300d..a24f14a 100755 --- a/mk_music_library_db.py +++ b/mk_music_library_db.py @@ -1,5 +1,7 @@ #!/usr/bin/python3 +# CREATE MUSIC DATABASE ------------------------------------------ + import sys, os, datetime, fnmatch, glob, random, time, pathlib, re from datetime import timedelta from os.path import join @@ -43,6 +45,39 @@ def database_create(conn): conn.execute(str(mus_lib)) print('''MUSIC LIBRARY Table created successfully'''); + +#conn = '' + +def database_create_episodes_table(conn): + # the show database + +# conn = sqlite3.connect("database/show.db") + + #TODO put the below back as a raw quiry to make if not exists possible + q = Query \ + .create_table("EPISODES") \ + .columns( + Column("id", "INT", nullable=True), + Column("episode", "INT", nullable=True), + Column("date", 'DATETIME', nullable=True), + Column("album", "VARCHAR(200)", nullable=True), + Column("track", "VARCHAR(120)", nullable=True), + Column("artist", "VARCHAR(120)", nullable=True), + Column("trackdur", "FLOAT", nullable=True), + Column("genre", "VARCHAR(120)", nullable=True), + Column("year", 'DATETIME', nullable=True), + Column("path", "VARCHAR(120)", nullable=False))\ + .unique("path") \ + .primary_key("path") + + #TODO get the unique path back into action find bug + conn.execute(str(q)) + + + + + print("EPISODES Table created successfully"); + def mk_db_entry(conn): print("ADDING TRACKS TO DATABASE > > > one moment please! "); label_url = "https://fixme.bandcamp.com/" @@ -76,6 +111,7 @@ def count_tracks(conn): def main(): database_create(conn) + database_create_episodes_table(conn) mk_db_entry(conn) count_tracks(conn) diff --git a/mk_show.py b/mk_show.py index e85c889..d111c31 100755 --- a/mk_show.py +++ b/mk_show.py @@ -1,5 +1,7 @@ #!/usr/bin/python3 +# CREATE PODCAST ----------------------------------------- + import sys, os, datetime, fnmatch, glob, random, time, pathlib, re from datetime import timedelta from os.path import join @@ -30,6 +32,8 @@ artist_abreviated = [] web_path = "/home/rob/antena/html/episode/{0}/img".format(episode_number) +conn = sqlite3.connect("database/show.db") + if os.path.exists(web_path): print("path_exists_doing_nothing") else: os.makedirs(web_path) @@ -44,49 +48,6 @@ def set_episode_date(input_date): #return episode_date print(episode_date) -conn = '' -def database_create_episodes_table(): - # the show database - global conn - conn = sqlite3.connect("database/show.db") - - q = Query \ - .create_table("EPISODES") \ - .columns( - Column("id", "INT", nullable=True), - Column("episode", "INT", nullable=True), - Column("date", 'DATETIME', nullable=True), - Column("album", "VARCHAR(200)", nullable=True), - Column("track", "VARCHAR(120)", nullable=True), - Column("artist", "VARCHAR(120)", nullable=True), - Column("trackdur", "FLOAT", nullable=True), - Column("genre", "VARCHAR(120)", nullable=True), - Column("year", 'DATETIME', nullable=True), - Column("path", "VARCHAR(120)", nullable=False))\ - .primary_key("path") - #.unique("path") \ - #TODO get the unique path back into action find bug - conn.execute(str(q)) - - - - - print("EPISODES Table created successfully"); - - - - - - - - - - - - - - - def create_intro(episode_playlist): intropath = path + "audio/texts/clips/this_is" intro = random.choice(os.listdir(intropath)) @@ -108,7 +69,7 @@ def check_archive(track): print("____ TRACK ALREADY PLAYED _____") return False -def create_episode_playlist(episode_playlist: list, complete_playlist:list): +def create_episode_playlist(conn, episode_playlist: list, complete_playlist:list): global episode_duration global archive @@ -125,7 +86,7 @@ def create_episode_playlist(episode_playlist: list, complete_playlist:list): 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(str(r)+"ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss") + # for t in r: song = str(r[9]) track_label = str(r[1]) @@ -135,8 +96,8 @@ def create_episode_playlist(episode_playlist: list, complete_playlist:list): track_duration = float(r[6]) track_genre = str(r[5]) track_year = str(r[7]) - track_path = '/'.join(song.split('/')[0:-1]) - + track_path = song #'/'.join(song.split('/')[0:-1]) + #print(str(song)+"ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss") # SOME LOGIC TO SEE IF WE ALLOW THAT TRACK OR NOT @@ -404,7 +365,10 @@ def create_html_homepage_from_template(episode_playlist): show_info = [] episode_artists = [] - for i in range(10): + + num_eps = 4 + + for i in range(num_eps): artists = [] cursor.execute("SELECT artist FROM EPISODES WHERE episode=?", [i]) rows = cursor.fetchall() @@ -417,7 +381,7 @@ def create_html_homepage_from_template(episode_playlist): episode_artists.append(artists) episodes = [] - for i in range(10): # get this from new table EPISODE_STATS number of tracks in DB + 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=episode_artists[i], episode_number=i, \ @@ -524,9 +488,9 @@ def create_RSS_XML_from_template(): def main(): - database_create_episodes_table() +# database_create_episodes_table() set_episode_date(input_date) - create_episode_playlist(episode_playlist, complete_playlist) + create_episode_playlist(conn, episode_playlist, complete_playlist) create_show_coverart(episode_playlist, 1) #episode_duration = 100 #create_animated_gif() create_intro(episode_playlist) diff --git a/playlists/track_playout_history.txt b/playlists/track_playout_history.txt index d4290f3..e90dd7b 100644 --- a/playlists/track_playout_history.txt +++ b/playlists/track_playout_history.txt @@ -1,13 +1,11 @@ -Stampede -Vrtnice -zvoki iz dnevne sobe -jez -The Left Eye -NeoPogo - FeS2 -BE CREEP - Burnt Dreams -Zlatko Kaučič, Tomaž Grom - Torn Memories Of Folklore - Raztrgana folklora spomina - 08 Almost The Same +Some Spatter Left The Mother (Act VII) -一点一滴 -Jean-Luc Guionnet & Samo Kutin - Kopaš - 02 02 -Vertex +Tilt - Tilt - 03 Alicante 3 +Hunahpu & Xbalanque +Maskardh - Thrills Of Deconstruction +Heretics Fork +94 +Zlatko Kaučič, Tomaž Grom - The Ear Is The Shadow Of The Eye - 12 Battling For A Title - Za naslov se boriva +Crossing The Rubicon +šopscum solata