table creation to seperate file
parent
2b7f711641
commit
2394d9387d
BIN
database/show.db
BIN
database/show.db
Binary file not shown.
|
@ -117,7 +117,7 @@
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<h4>This weeks playlist:</h4>
|
<h4>This weeks playlist:</h4>
|
||||||
{% for track in episode_playlist[0:] %}
|
{% for track in episode_playlist[0:] %}
|
||||||
<h4>{{track}}</h4>
|
<p><b> {{track}} </b> </p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<!-- <table> -->
|
<!-- <table> -->
|
||||||
<!-- {% for track in episode_playlist[0:] %} -->
|
<!-- {% for track in episode_playlist[0:] %} -->
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
# CREATE MUSIC DATABASE ------------------------------------------
|
||||||
|
|
||||||
import sys, os, datetime, fnmatch, glob, random, time, pathlib, re
|
import sys, os, datetime, fnmatch, glob, random, time, pathlib, re
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
@ -43,6 +45,39 @@ def database_create(conn):
|
||||||
conn.execute(str(mus_lib))
|
conn.execute(str(mus_lib))
|
||||||
print('''MUSIC LIBRARY Table created successfully''');
|
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):
|
def mk_db_entry(conn):
|
||||||
print("ADDING TRACKS TO DATABASE > > > one moment please! ");
|
print("ADDING TRACKS TO DATABASE > > > one moment please! ");
|
||||||
label_url = "https://fixme.bandcamp.com/"
|
label_url = "https://fixme.bandcamp.com/"
|
||||||
|
@ -76,6 +111,7 @@ def count_tracks(conn):
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
database_create(conn)
|
database_create(conn)
|
||||||
|
database_create_episodes_table(conn)
|
||||||
mk_db_entry(conn)
|
mk_db_entry(conn)
|
||||||
count_tracks(conn)
|
count_tracks(conn)
|
||||||
|
|
||||||
|
|
66
mk_show.py
66
mk_show.py
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
# CREATE PODCAST -----------------------------------------
|
||||||
|
|
||||||
import sys, os, datetime, fnmatch, glob, random, time, pathlib, re
|
import sys, os, datetime, fnmatch, glob, random, time, pathlib, re
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
@ -30,6 +32,8 @@ artist_abreviated = []
|
||||||
|
|
||||||
web_path = "/home/rob/antena/html/episode/{0}/img".format(episode_number)
|
web_path = "/home/rob/antena/html/episode/{0}/img".format(episode_number)
|
||||||
|
|
||||||
|
conn = sqlite3.connect("database/show.db")
|
||||||
|
|
||||||
if os.path.exists(web_path):
|
if os.path.exists(web_path):
|
||||||
print("path_exists_doing_nothing")
|
print("path_exists_doing_nothing")
|
||||||
else: os.makedirs(web_path)
|
else: os.makedirs(web_path)
|
||||||
|
@ -44,49 +48,6 @@ def set_episode_date(input_date):
|
||||||
#return episode_date
|
#return episode_date
|
||||||
print(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):
|
def create_intro(episode_playlist):
|
||||||
intropath = path + "audio/texts/clips/this_is"
|
intropath = path + "audio/texts/clips/this_is"
|
||||||
intro = random.choice(os.listdir(intropath))
|
intro = random.choice(os.listdir(intropath))
|
||||||
|
@ -108,7 +69,7 @@ def check_archive(track):
|
||||||
print("____ TRACK ALREADY PLAYED _____")
|
print("____ TRACK ALREADY PLAYED _____")
|
||||||
return False
|
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 episode_duration
|
||||||
global archive
|
global archive
|
||||||
|
@ -125,7 +86,7 @@ def create_episode_playlist(episode_playlist: list, complete_playlist:list):
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute("SELECT * FROM MUSIC_LIBRARY ORDER BY RANDOM() LIMIT 1 ;")
|
cursor.execute("SELECT * FROM MUSIC_LIBRARY ORDER BY RANDOM() LIMIT 1 ;")
|
||||||
r = cursor.fetchone() # FETCH ONE RANDOM TRACK FROM THE DATABASE
|
r = cursor.fetchone() # FETCH ONE RANDOM TRACK FROM THE DATABASE
|
||||||
print(str(r)+"ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss")
|
|
||||||
# for t in r:
|
# for t in r:
|
||||||
song = str(r[9])
|
song = str(r[9])
|
||||||
track_label = str(r[1])
|
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_duration = float(r[6])
|
||||||
track_genre = str(r[5])
|
track_genre = str(r[5])
|
||||||
track_year = str(r[7])
|
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
|
# 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 = []
|
show_info = []
|
||||||
|
|
||||||
episode_artists = []
|
episode_artists = []
|
||||||
for i in range(10):
|
|
||||||
|
num_eps = 4
|
||||||
|
|
||||||
|
for i in range(num_eps):
|
||||||
artists = []
|
artists = []
|
||||||
cursor.execute("SELECT artist FROM EPISODES WHERE episode=?", [i])
|
cursor.execute("SELECT artist FROM EPISODES WHERE episode=?", [i])
|
||||||
rows = cursor.fetchall()
|
rows = cursor.fetchall()
|
||||||
|
@ -417,7 +381,7 @@ def create_html_homepage_from_template(episode_playlist):
|
||||||
episode_artists.append(artists)
|
episode_artists.append(artists)
|
||||||
|
|
||||||
episodes = []
|
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])
|
print(episode_artists[i])
|
||||||
an_episode = dict(date="2012-02-", \
|
an_episode = dict(date="2012-02-", \
|
||||||
episode_artists=episode_artists[i], episode_number=i, \
|
episode_artists=episode_artists[i], episode_number=i, \
|
||||||
|
@ -524,9 +488,9 @@ def create_RSS_XML_from_template():
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
database_create_episodes_table()
|
# database_create_episodes_table()
|
||||||
set_episode_date(input_date)
|
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_show_coverart(episode_playlist, 1) #episode_duration = 100
|
||||||
#create_animated_gif()
|
#create_animated_gif()
|
||||||
create_intro(episode_playlist)
|
create_intro(episode_playlist)
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
|
|
||||||
Stampede
|
Some Spatter Left
|
||||||
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
|
|
||||||
The Mother (Act VII)
|
The Mother (Act VII)
|
||||||
一点一滴
|
Tilt - Tilt - 03 Alicante 3
|
||||||
Jean-Luc Guionnet & Samo Kutin - Kopaš - 02 02
|
Hunahpu & Xbalanque
|
||||||
Vertex
|
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
|
||||||
|
|
Loading…
Reference in New Issue