db shuffle episode order
parent
f498383f79
commit
08cace37e3
|
@ -6,6 +6,8 @@ usage examples:
|
|||
|
||||
./mk_show.py --episode 2 --insert_fill --top_tail
|
||||
|
||||
./mk_show.py --episode 2 --date 2024-03-11 --playlist edit --web --art --insert_fill --top_tail
|
||||
|
||||
Generative radio show of contemporary Slovenian independent music for Mariborski radio študent - MARŠ. Scripted using Liquidsoap and assorted other scripting glue, bash, python...
|
||||
|
||||
featured labels and artists:
|
||||
|
|
BIN
database/show.db
BIN
database/show.db
Binary file not shown.
34
mk_show.py
34
mk_show.py
|
@ -33,7 +33,7 @@ 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, 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 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'''
|
||||
|
||||
episode_number = args.episode
|
||||
input_date = args.date
|
||||
|
@ -239,6 +239,8 @@ def create_episode_playlist(conn, episode_number):
|
|||
# TODO shuffle playlist order as an option
|
||||
|
||||
def modify_playlist(conn, episode_number, episode_duration):
|
||||
|
||||
#TODO some broken logic here - cant do multip shuffles or generate new playlist
|
||||
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('SELECT * FROM EPISODES WHERE EPISODE=?', [episode_number])
|
||||
|
@ -261,6 +263,31 @@ def modify_playlist(conn, episode_number, episode_duration):
|
|||
if user_input == 'y':
|
||||
print("action")
|
||||
create_episode_playlist(conn, episode_number)
|
||||
|
||||
elif user_input == 's':
|
||||
# shuffle the episode
|
||||
q = 'SELECT * FROM EPISODES WHERE EPISODE = {0} ORDER BY random();'.format(episode_number)
|
||||
cursor.execute(q)
|
||||
r = cursor.fetchall()
|
||||
# delete the old episode
|
||||
cursor.execute('DELETE FROM EPISODES WHERE episode = {0}'.format(episode_number))
|
||||
track_count = 0;
|
||||
# write in the shuffled version
|
||||
for i in r:
|
||||
print('{0} : {1} {2} {3} {4} '.format(i[2], i[4], i[5], i[6], i[7],))
|
||||
# write the shuffled back to a tmp buffer episode {1000}
|
||||
e = Table('EPISODES')
|
||||
track_number = track_count
|
||||
id = str(uuid.uuid4())
|
||||
q = e.insert(id, episode_number, track_number, str(episode_date),\
|
||||
i[4], i[5], i[6], i[7], i[8], i[9], i[10], i[11], i[12])
|
||||
cursor.execute(str(q))
|
||||
# TODO put this shuffle in a function and sort out the logic flow so i can keep shuffling - remove
|
||||
track_count += 1;
|
||||
#episode_duration = episode_duration + track_duration
|
||||
conn.commit()
|
||||
|
||||
|
||||
elif user_input == 'p':
|
||||
# preview a track --------------------------------------
|
||||
preview_track = input("which track would you like to preview [0-12]:")
|
||||
|
@ -289,12 +316,15 @@ def modify_playlist(conn, episode_number, episode_duration):
|
|||
|
||||
|
||||
def combine_images(columns, space, images, variants:int):
|
||||
|
||||
global show_cover
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageDraw
|
||||
from PIL import ImageFont
|
||||
|
||||
set_episode_date(input_date)
|
||||
|
||||
rows = len(images) // columns
|
||||
|
||||
if len(images) % columns:
|
||||
|
@ -378,6 +408,8 @@ def combine_images(columns, space, images, variants:int):
|
|||
|
||||
def create_show_coverart(variants):
|
||||
|
||||
set_episode_date(input_date)
|
||||
|
||||
final_playlist = []
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('SELECT path FROM EPISODES WHERE EPISODE=?', [episode_number])
|
||||
|
|
Loading…
Reference in New Issue