jinja2 added for web creation
parent
3360165010
commit
795a25451b
|
@ -1,29 +0,0 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<title> SHOW INFO </title>
|
||||
</head>
|
||||
<body> <h1>Inside the with open: 2024-01-11 </h1>
|
||||
|
||||
|
||||
<h2>"Show info for: THE AND IF #2 release date: 2024-01-11 </h2>
|
||||
<img src="../html/img/show_cover_2024-01-11.png" alt="podcast cover of the week" width="700" height="700">
|
||||
<h3>Total Playtime excluding fills: 1:01:07 </h3>
|
||||
ARTIST | ALBUM | TRACK | YEAR | DURATION
|
||||
<p>Lifecutter | Sub Persona | Sub Persona IV | 2020 | 0:03:52</p>
|
||||
<p>Warrego Valles | Botox | 5000000000 YRS | 2018 | 0:05:04</p>
|
||||
<p>Vomir | Bora Scura Reimagined | Action XIX | 2021 | 0:06:15</p>
|
||||
<p>Delta-Sleep-Inducing Peptide | Oscillopsia | Constant Negation | 2014 | 0:06:58</p>
|
||||
<p>Luka Prinčič | Antigone/Child | Chorus 1 (SC) | 2018 | 0:05:41</p>
|
||||
<p>Gašper Torkar | Dreams of Others EP | Rib Vaulting | 2017 | 0:06:22</p>
|
||||
<p>Zergon | Access Frame: Equity | Altobar | 2020 | 0:05:19</p>
|
||||
<p>Lhetargija | Raganas Mācekle | Vorspiel fur Traurige Madchen | 2021 | 0:04:00</p>
|
||||
<p>Irena Tomažin | Taste Of Silence | Soloveikia Moj | 2014 | 0:03:05</p>
|
||||
<p>Jošt Drašler | The Balloon Catcher | Jošt Drašler - The Balloon Catcher - 09 Grandma Balloon | None | 0:04:26</p>
|
||||
<p>Shekuza | De Sica | Nebulae Tree | 2019 | 0:03:55</p>
|
||||
<p>rouge-ah | bare | conversation suppresed | 2018 | 0:06:11</p>
|
||||
|
||||
|
||||
<hr>
|
||||
<p>For more information on the artists or to buy thier albums visit their bandcamp page. </p>" +"
|
||||
</body></html>
|
|
@ -0,0 +1,340 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{{show_name}}</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:200,300,400,700,900">
|
||||
<link rel="stylesheet" href="fonts/icomoon/style.css">
|
||||
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/magnific-popup.css">
|
||||
<link rel="stylesheet" href="css/jquery-ui.css">
|
||||
<link rel="stylesheet" href="css/owl.carousel.min.css">
|
||||
<link rel="stylesheet" href="css/owl.theme.default.min.css">
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mediaelement@4.2.7/build/mediaelementplayer.min.css">
|
||||
|
||||
|
||||
<link rel="stylesheet" href="css/aos.css">
|
||||
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="site-wrap">
|
||||
|
||||
<div class="site-mobile-menu">
|
||||
<div class="site-mobile-menu-header">
|
||||
<div class="site-mobile-menu-close mt-3">
|
||||
<span class="icon-close2 js-menu-toggle"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="site-mobile-menu-body"></div>
|
||||
</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" data-aos="fade-up" data-aos-delay="400">
|
||||
<h2 class="text-white font-weight-light mb-2 display-4">{{episode_title}}</h2>
|
||||
<div class="text-white mb-3"><span class="text-white-opacity-05"><small>{{episode_author}} <span class="sep">/</span> {{episode_date}} <span class="sep">/</span> {{episode_dur}}</small></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container site-section">
|
||||
|
||||
<div class="player mb-5">
|
||||
<audio id="player2" preload="none" controls style="max-width: 100%">
|
||||
<source src="{{episode_audio}}" type="audio/mp3">
|
||||
</audio>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-7">
|
||||
{{episode_playlist}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="site-section bg-light">
|
||||
<div class="container">
|
||||
<div class="row mb-5">
|
||||
<div class="col-md-12 text-center">
|
||||
<h2 class="font-weight-bold text-black">Related Podcasts</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="d-block podcast-entry bg-white mb-5" data-aos="fade-up">
|
||||
<div class="image w-100" style="height: 300px; background-image: url('images/img_2.jpg');"></div>
|
||||
<div class="text w-100">
|
||||
|
||||
<h3 class="font-weight-light"><a href="single-post.html">Episode 07: How To Create Web Page Using Bootstrap 4</a></h3>
|
||||
<div class="text-white mb-3"><span class="text-black-opacity-05"><small>By Mike Smith <span class="sep">/</span> 16 September 2017 <span class="sep">/</span> 1:30:20</small></span></div>
|
||||
<p class="mb-4">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corrupti repellat mollitia consequatur, optio nesciunt placeat. Iste voluptates excepturi tenetur, nesciunt.</p>
|
||||
|
||||
|
||||
<div class="player">
|
||||
<audio id="player2" preload="none" controls style="max-width: 100%">
|
||||
<source src="http://www.largesound.com/ashborytour/sound/AshboryBYU.mp3" type="audio/mp3">
|
||||
</audio>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="d-block podcast-entry bg-white mb-5" data-aos="fade-up">
|
||||
<div class="image w-100" style="height: 300px; background-image: url('images/img_3.jpg');"></div>
|
||||
<div class="text w-100">
|
||||
|
||||
<h3 class="font-weight-light"><a href="single-post.html">Episode 07: How To Create Web Page Using Bootstrap 4</a></h3>
|
||||
<div class="text-white mb-3"><span class="text-black-opacity-05"><small>By Mike Smith <span class="sep">/</span> 16 September 2017 <span class="sep">/</span> 1:30:20</small></span></div>
|
||||
<p class="mb-4">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corrupti repellat mollitia consequatur, optio nesciunt placeat. Iste voluptates excepturi tenetur, nesciunt.</p>
|
||||
|
||||
|
||||
<div class="player">
|
||||
<audio id="player2" preload="none" controls style="max-width: 100%">
|
||||
<source src="http://www.largesound.com/ashborytour/sound/AshboryBYU.mp3" type="audio/mp3">
|
||||
</audio>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<footer class="site-footer border-top">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<div class="mb-5">
|
||||
<h3 class="footer-heading mb-4">{{about_show}}</h3>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe pariatur reprehenderit vero atque, consequatur id ratione, et non dignissimos culpa? Ut veritatis, quos illum totam quis blanditiis, minima minus odio!</p>
|
||||
</div>
|
||||
|
||||
<div class="mb-5">
|
||||
<h3 class="footer-heading mb-4">Recent Podcast</h3>
|
||||
<div class="block-25">
|
||||
<ul class="list-unstyled">
|
||||
<li class="mb-3">
|
||||
<a href="#" class="d-flex">
|
||||
<figure class="image mr-4">
|
||||
<img src="images/img_1.jpg" alt="" class="img-fluid">
|
||||
</figure>
|
||||
<div class="text">
|
||||
<h3 class="heading font-weight-light">Lorem ipsum dolor sit amet consectetur elit</h3>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="mb-3">
|
||||
<a href="#" class="d-flex">
|
||||
<figure class="image mr-4">
|
||||
<img src="images/img_1.jpg" alt="" class="img-fluid">
|
||||
</figure>
|
||||
<div class="text">
|
||||
<h3 class="heading font-weight-light">Lorem ipsum dolor sit amet consectetur elit</h3>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="mb-3">
|
||||
<a href="#" class="d-flex">
|
||||
<figure class="image mr-4">
|
||||
<img src="images/img_1.jpg" alt="" class="img-fluid">
|
||||
</figure>
|
||||
<div class="text">
|
||||
<h3 class="heading font-weight-light">Lorem ipsum dolor sit amet consectetur elit</h3>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-4 mb-5 mb-lg-0">
|
||||
<div class="row mb-5">
|
||||
<div class="col-md-12">
|
||||
<h3 class="footer-heading mb-4">Quick Menu</h3>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-6">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="#">Home</a></li>
|
||||
<li><a href="#">Matches</a></li>
|
||||
<li><a href="#">News</a></li>
|
||||
<li><a href="#">Team</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-6">
|
||||
<ul class="list-unstyled">
|
||||
<li><a href="#">About Us</a></li>
|
||||
<li><a href="#">Privacy Policy</a></li>
|
||||
<li><a href="#">Contact Us</a></li>
|
||||
<li><a href="#">Membership</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3 class="footer-heading mb-4">Follow Us</h3>
|
||||
|
||||
<div>
|
||||
<a href="#" class="pl-0 pr-3"><span class="icon-facebook"></span></a>
|
||||
<a href="#" class="pl-3 pr-3"><span class="icon-twitter"></span></a>
|
||||
<a href="#" class="pl-3 pr-3"><span class="icon-instagram"></span></a>
|
||||
<a href="#" class="pl-3 pr-3"><span class="icon-linkedin"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4 mb-5 mb-lg-0">
|
||||
<div class="mb-5">
|
||||
<h3 class="footer-heading mb-4">Watch Video</h3>
|
||||
|
||||
<div class="block-16">
|
||||
<figure>
|
||||
<img src="images/img_1.jpg" alt="Image placeholder" class="img-fluid rounded">
|
||||
<a href="https://vimeo.com/channels/staffpicks/93951774" class="play-button popup-vimeo"><span class="icon-play"></span></a>
|
||||
</figure>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mb-5">
|
||||
<h3 class="footer-heading mb-2">Subscribe Newsletter</h3>
|
||||
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit minima minus odio.</p>
|
||||
|
||||
<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 ©<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>
|
||||
</div>
|
||||
|
||||
<script src="js/jquery-3.3.1.min.js"></script>
|
||||
<script src="js/jquery-migrate-3.0.1.min.js"></script>
|
||||
<script src="js/jquery-ui.js"></script>
|
||||
<script src="js/popper.min.js"></script>
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
<script src="js/owl.carousel.min.js"></script>
|
||||
<script src="js/jquery.stellar.min.js"></script>
|
||||
<script src="js/jquery.countdown.min.js"></script>
|
||||
<script src="js/jquery.magnific-popup.min.js"></script>
|
||||
<script src="js/aos.js"></script>
|
||||
|
||||
<script src="js/mediaelement-and-player.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var mediaElements = document.querySelectorAll('video, audio'), total = mediaElements.length;
|
||||
|
||||
for (var i = 0; i < total; i++) {
|
||||
new MediaElementPlayer(mediaElements[i], {
|
||||
pluginPath: 'https://cdn.jsdelivr.net/npm/mediaelement@4.2.7/build/',
|
||||
shimScriptAccess: 'always',
|
||||
success: function () {
|
||||
var target = document.body.querySelectorAll('.player'), targetTotal = target.length;
|
||||
for (var j = 0; j < targetTotal; j++) {
|
||||
target[j].style.visibility = 'visible';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script src="js/main.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
271
mk_show.py
271
mk_show.py
|
@ -1,27 +1,35 @@
|
|||
#!/usr/bin/python3
|
||||
import os, fnmatch, glob, random, time, pathlib, re
|
||||
import sys, os, datetime, fnmatch, glob, random, time, pathlib, re
|
||||
from datetime import timedelta
|
||||
from os.path import join
|
||||
from tinytag import TinyTag
|
||||
import datetime
|
||||
|
||||
#import skimage.uti
|
||||
#import skimage.util
|
||||
|
||||
from datetime import timedelta
|
||||
from random import shuffle
|
||||
|
||||
import sqlite3
|
||||
|
||||
from mk_web import *
|
||||
|
||||
con = sqlite3.connect("music.db")
|
||||
|
||||
DATE = datetime.datetime.now().strftime("%Y-%m-%d")
|
||||
total_show_duration = 0
|
||||
total_show_dur = 0
|
||||
complete_playlist = []
|
||||
show_array = []
|
||||
show_cover = ""
|
||||
archive = []
|
||||
artist_played = []
|
||||
artists_played = []
|
||||
artist_abreviated = []
|
||||
episode_number = "0"
|
||||
episode_number = sys.argv[1]
|
||||
|
||||
show_name = "THE AND IF"
|
||||
|
||||
show_name = "SHOWNAME" # OBED
|
||||
path = "/home/rob/antena/"
|
||||
web_path = "/home/rob/antena/html/episode/{0}/img".format(episode_number)
|
||||
|
||||
if os.path.exists(web_path):
|
||||
print("path_exists_doing_nothing")
|
||||
else: os.makedirs(web_path)
|
||||
|
||||
# /////////////////////////////////////////////////
|
||||
|
||||
|
@ -31,9 +39,8 @@ def create_intro(show_array):
|
|||
show_array.insert(0, str(os.path.abspath(intropath)) + "/" + str(intro))
|
||||
|
||||
def add_to_tracks_played(add_to_played: str):
|
||||
#global complete_tracks_played
|
||||
with open('playlists/track_playout_history.txt', "a") as tracks_played_file:
|
||||
tracks_played_file.write(add_to_played + "\n")
|
||||
tracks_played_file.write(str(add_to_played) + "\n") # newline \n needed here?
|
||||
|
||||
def check_archive(track):
|
||||
global archive
|
||||
|
@ -51,55 +58,60 @@ def load_all_music():
|
|||
with open('playlists/complete_music_archive.pls') as playlist_file:
|
||||
for line in playlist_file:
|
||||
complete_playlist.append(line)
|
||||
print("loaded %s".format(str(len(complete_playlist))))
|
||||
print('''
|
||||
-------------------------------
|
||||
loaded {0} tracks from playlist
|
||||
-------------------------------
|
||||
'''.format(str(len(complete_playlist))))
|
||||
return complete_playlist
|
||||
|
||||
def create_show_playlist(show_array: list, complete_playlist:list):
|
||||
load_all_music()
|
||||
|
||||
global total_show_duration
|
||||
global total_show_dur
|
||||
global archive
|
||||
|
||||
track_count = 0
|
||||
global artist_played
|
||||
max_track_dur = 8
|
||||
min_track_dur = 3
|
||||
global artists_played
|
||||
max_track_dur = 10
|
||||
min_track_dur = 1.8
|
||||
|
||||
while total_show_duration < 60 * 55:
|
||||
while total_show_dur < 60 * 60 and track_count < 12 :
|
||||
song = random.choice(random.sample(\
|
||||
complete_playlist, len(complete_playlist) )).rstrip() # pick a song
|
||||
track = TinyTag.get(song) # get its metadata
|
||||
# check if the artist not in the played list and the song is less than 8mins
|
||||
if track.artist not in artist_played:
|
||||
if track.artist not in artists_played:
|
||||
if check_archive(track.title) is True:
|
||||
if int(track.duration) > min_track_dur * 60:
|
||||
if int(track.duration) < max_track_dur * 60:
|
||||
show_array.append(song.rstrip()) # if 'not in' is true then add the song
|
||||
art = string=re.sub("\(.*?\)","",track.artist)
|
||||
# shorten verbose artist names such as trojnik Trojnik (Cene Resnik, Tomaž Grom, Vid Drašler)
|
||||
art = string=re.sub("and","&",art)
|
||||
artist_abreviated.append(art) # and add the artist to the played list
|
||||
artist_played.append(track.artist) # and add the artist to the played list
|
||||
artist_abreviated.append(art)
|
||||
artists_played.append(track.artist) # and add the artist to the played list
|
||||
add_to_tracks_played(track.title) # and write entry to archive file
|
||||
track_count += 1
|
||||
total_show_duration = total_show_duration + track.duration
|
||||
track_count += 1; print(track_count)
|
||||
total_show_dur = total_show_dur + track.duration
|
||||
else: print("TRACK TOO SHORT..........." )
|
||||
else: print("TRACK TOO LONG..........." )
|
||||
else: print("SONG PLAYED IN PREVIOUS EPISODE" )
|
||||
else: print("ARTIST ALREADY IN PODCAST")
|
||||
|
||||
total_show_duration = timedelta(seconds=round(total_show_duration))
|
||||
show_array = list(set(show_array))
|
||||
print("total tracks = " + str(track_count))
|
||||
print("total duration = " + str(total_show_duration))
|
||||
print(' \n\n\n SHOW ARRAY: \n {0} \n '.format)
|
||||
return show_array, total_show_duration
|
||||
total_show_dur = timedelta(seconds=round(total_show_dur))
|
||||
|
||||
def combine_images(columns, space, images):
|
||||
print("total tracks = {0} \n total duration = {1} ".format(track_count, total_show_dur))
|
||||
|
||||
return show_array, total_show_dur
|
||||
|
||||
def combine_images(columns, space, images, variants:int):
|
||||
global show_cover
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageDraw
|
||||
from PIL import ImageFont
|
||||
|
||||
global show_cover
|
||||
rows = len(images) // columns
|
||||
|
||||
if len(images) % columns:
|
||||
|
@ -129,42 +141,56 @@ def combine_images(columns, space, images):
|
|||
|
||||
im = ImageDraw.Draw(background)
|
||||
mf_h1 = ImageFont.truetype('fonts/Antonio-Light.ttf', 280)
|
||||
mf_h2 = ImageFont.truetype('fonts/Antonio-Light.ttf', 70)
|
||||
mf_h2 = ImageFont.truetype('fonts/Antonio-Light.ttf', 65)
|
||||
mf_h3 = ImageFont.truetype('fonts/Antonio-Regular.ttf', 50)
|
||||
mf_h4 = ImageFont.truetype('fonts/Antonio-Light.ttf', 45)
|
||||
|
||||
mf_h4 = ImageFont.truetype('fonts/Antonio-Light.ttf', 50)
|
||||
|
||||
h2_spc = 85
|
||||
h2_baseline = 1530
|
||||
|
||||
# Add Text to the image ----------------------------------------
|
||||
|
||||
im.text((30,10), '''an eclectic selection of contemporary independent music from slovenia: {0} - E P I S O D E #{1}
|
||||
'''\
|
||||
.format(DATE,episode_number), fill="white", font=mf_h3)
|
||||
im.text((30,280), ''' THIS WEEK ON \n EPISODE #{0} of \n| {1} | SHOW'''\
|
||||
.format(episode_number, show_name), fill="white", font=mf_h1, stroke_width=2, stroke_fill='black')
|
||||
im.text((30, h2_baseline + (h2_spc*1) ), '''m u s i c _ f r o m _ : {0}'''\
|
||||
.format(' | '.join(artist_abreviated[0:3])), (255,255,255), font=mf_h2)
|
||||
im.text((30, h2_baseline + (h2_spc*2) ), "{0}"\
|
||||
.format(' | '.join(artist_abreviated[3:6])), (255,255,255), font=mf_h2)
|
||||
im.text((30, h2_baseline + (h2_spc*3)), "{0}"\
|
||||
.format(' | '.join(artist_abreviated[6:9])), (255,255,255), font=mf_h2)
|
||||
im.text((30, h2_baseline + (h2_spc*4)), "{0}"\
|
||||
.format(' | '.join(artist_abreviated[9:12])), (255,255,255), font=mf_h2)
|
||||
|
||||
im.text((1500,1905), ''' http://showname.rizom.si '''\
|
||||
.format(DATE,episode_number), fill="white", font=mf_h4)
|
||||
|
||||
# shorten verbose artist names such as trojnik Trojnik (Cene Resnik, Tomaž Grom, Vid Drašler)
|
||||
# TiTiTi (Jure Boršič, Jošt Drašler, Vid Drašler)
|
||||
show_cover = 'html/img/show_cover_{0}.png'.format(DATE)
|
||||
background.save(show_cover)
|
||||
|
||||
|
||||
def create_show_coverart():
|
||||
# Add Text to the image ----------------------------------------
|
||||
# -------------------------------------------------------------------
|
||||
# some logic to shuffle the list if sub sections of list are too long for layout
|
||||
str_length_thresh = 50
|
||||
while \
|
||||
[len(s) for s in [''.join(artist_abreviated[0:3])]][0] > str_length_thresh or\
|
||||
[len(s) for s in [''.join(artist_abreviated[3:6])]][0] > str_length_thresh or\
|
||||
[len(s) for s in [''.join(artist_abreviated[6:9])]][0] > str_length_thresh or \
|
||||
[len(s) for s in [''.join(artist_abreviated[9:12])]][0] > str_length_thresh:
|
||||
print("on of the lines is longer than fits the page... shuffling the list for a better look")
|
||||
random.shuffle(artist_abreviated)
|
||||
|
||||
|
||||
global show_array
|
||||
print(show_array)
|
||||
|
||||
im.text((30,10), '''an eclectic selection of contemporary independent music from slovenia: {0} - E P I S O D E #{1}
|
||||
'''\
|
||||
.format(DATE,episode_number), fill="white", font=mf_h3)
|
||||
im.text((30,280), ''' THIS WEEK ON \n EPISODE #{0} of \n {1}!'''.upper()\
|
||||
.format(episode_number, show_name), fill="white", font=mf_h1, stroke_width=2, stroke_fill='black')
|
||||
im.text((30, h2_baseline + (h2_spc*1) ), '''m u s i c _ f r o m _ : {0}'''\
|
||||
.format(' | '.join(artist_abreviated[0:3])), (255,255,255), font=mf_h2)
|
||||
im.text((30, h2_baseline + (h2_spc*2) ), "{0}"\
|
||||
.format(' | '.join(artist_abreviated[3:6])), (255,255,255), font=mf_h2)
|
||||
im.text((30, h2_baseline + (h2_spc*3)), "{0}"\
|
||||
.format(' | '.join(artist_abreviated[6:9])), (255,255,255), font=mf_h2)
|
||||
im.text((30, h2_baseline + (h2_spc*4)), "{0}"\
|
||||
.format(' | '.join(artist_abreviated[9:12])), (255,255,255), font=mf_h2)
|
||||
|
||||
im.text((1560,1888), ''' http://{0}.rizom.si '''\
|
||||
.format(show_name, DATE,episode_number), fill="white", font=mf_h4)
|
||||
|
||||
# TiTiTi (Jure Boršič, Jošt Drašler, Vid Drašler)
|
||||
|
||||
show_cover = 'img/cover.png'.format(episode_number,DATE, variants)
|
||||
#pathlib.Path.touch(show_cover)
|
||||
background.save("html/" + "episode/{0}/{1}".format(episode_number, show_cover))
|
||||
return show_cover
|
||||
|
||||
def create_show_coverart(show_array, variants):
|
||||
|
||||
# global show_array
|
||||
#print(show_array)
|
||||
show_cover_jpgs = []
|
||||
|
||||
for dir in show_array:
|
||||
|
@ -173,66 +199,49 @@ def create_show_coverart():
|
|||
for i in ["cover", "COVER"]:
|
||||
if i in file:
|
||||
show_cover_jpgs.append(str(path) + "/" + file)
|
||||
print(file)
|
||||
#print(file)
|
||||
|
||||
print("\n ++++ show jpgs: +++++ {0} +++++++++number of jpgs: {1} +++++++\n"\
|
||||
.format(show_cover_jpgs, len(show_cover_jpgs) ) )
|
||||
# print("\n ++++ show jpgs: +++++ {0} +++++++++number of jpgs: {1} +++++++\n"\
|
||||
# .format(show_cover_jpgs, len(show_cover_jpgs) ) )
|
||||
|
||||
#slice first 12 images of array
|
||||
# do an if logic here based on track number to set colums
|
||||
# if len(show_cover_jpgs) <= 9:
|
||||
# combine_images(columns=3, space=0, images=show_cover_jpgs[:9])
|
||||
|
||||
if len(show_cover_jpgs) > 0: # duplicate this for variations of geometry
|
||||
combine_images(columns=4, space=3, images=show_cover_jpgs[:12])
|
||||
|
||||
print('''
|
||||
------------------------
|
||||
creating show cover art
|
||||
------------------------
|
||||
''')
|
||||
|
||||
# if len(show_cover_jpgs) > 0: # duplicate this for variations of geometry
|
||||
for i in range(variants):
|
||||
x = show_cover_jpgs[:12]
|
||||
combine_images(columns=4, space=3, images=random.sample(x,len(x)),variants=i)
|
||||
|
||||
return show_cover
|
||||
|
||||
|
||||
def create_animated_gif():
|
||||
import contextlib
|
||||
from PIL import Image
|
||||
|
||||
# filepaths
|
||||
fp_in = "/home/rob/antena/html/episode/2/img/*.png".format(episode_number)
|
||||
fp_out = "/home/rob/antena/html/episode/2/img/show_cover.gif"
|
||||
|
||||
# create a HTML file containing show information
|
||||
# use exit stack to automatically close opened images
|
||||
with contextlib.ExitStack() as stack:
|
||||
|
||||
def create_web_page(show_array:list):
|
||||
global show_cover
|
||||
global total_show_duration
|
||||
dir_path = "html/"
|
||||
pattern = "*.html"
|
||||
show_count = len(fnmatch.filter(os.listdir(dir_path), pattern))
|
||||
show_info = []
|
||||
# lazily load images
|
||||
imgs = (stack.enter_context(Image.open(f))
|
||||
for f in sorted(glob.glob(fp_in)))
|
||||
|
||||
for i in show_array:
|
||||
track = TinyTag.get(i)
|
||||
detail = str(track.artist) + " | " + str(track.album) + \
|
||||
" | " + str(track.title) + " | " + str(track.year) + \
|
||||
" | " + str(timedelta(seconds=round(track.duration)))
|
||||
show_info.append("" + detail)
|
||||
|
||||
with open("html/showinfo_" + DATE + ".html","w") as file:
|
||||
file.write('''
|
||||
<html>
|
||||
<head>
|
||||
<title> SHOW INFO </title>
|
||||
</head>
|
||||
<body> <h1>Inside the with open: %s </h1>\n
|
||||
\n ''' % DATE)
|
||||
|
||||
file.writelines('''<h2>"Show info for: {0} #{1} release date: {2} </h2>
|
||||
'''.format(show_name, show_count, DATE))
|
||||
file.writelines('''<img src="../{0}" alt="podcast cover of the week" width="700" height="700">
|
||||
<h3>Total Playtime excluding fills: {1} </h3>
|
||||
ARTIST | ALBUM | TRACK | YEAR | DURATION
|
||||
'''.format(show_cover, total_show_duration) )
|
||||
|
||||
for x in show_info:
|
||||
file.writelines("<p>" + x + "</p>" +" \n " )
|
||||
|
||||
file.writelines(''' \n\n <hr>
|
||||
<p>For more information on the artists or to buy thier albums visit their bandcamp page. </p>" +" \n ''' )
|
||||
file.writelines("</body></html>")
|
||||
file.close()
|
||||
# extract first image from iterator
|
||||
img = next(imgs)
|
||||
|
||||
# https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#gif
|
||||
img.save(fp=fp_out, format='GIF', append_images=imgs,
|
||||
save_all=True, duration=200, loop=0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -242,18 +251,15 @@ def create_pls_file():
|
|||
with open("shows/antena_playlist_" + DATE + ".pls","w") as file:
|
||||
file.writelines("\n".join(show_array))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def create_podcast(show_array: list):
|
||||
|
||||
print('''
|
||||
------------------------
|
||||
creating show audio
|
||||
------------------------
|
||||
''')
|
||||
|
||||
from glob import glob
|
||||
from pydub import AudioSegment
|
||||
|
||||
|
@ -266,7 +272,6 @@ def create_podcast(show_array: list):
|
|||
second_three_blurb = playlist_songs.pop(0)
|
||||
final_songs_blurb = playlist_songs.pop(0)
|
||||
final_show_outro = playlist_songs.pop(0)
|
||||
|
||||
playlist = intro_and_first
|
||||
|
||||
for song in playlist_songs[2:3]: # first three songs (first added with intro)
|
||||
|
@ -290,13 +295,31 @@ def create_podcast(show_array: list):
|
|||
# get length of final show / podcast
|
||||
playlist_length = len(playlist) / (1000*60)
|
||||
# save the entire poidcast
|
||||
with open("%s_minute_playlist.flac" % playlist_length, 'wb') as out_f:
|
||||
with open("html/episode/{0}/show.flac".format(episode_number), 'wb') as out_f:
|
||||
playlist.export(out_f, format='flac')
|
||||
|
||||
create_show_playlist(show_array, complete_playlist)
|
||||
create_show_coverart() #total_show_duration = 100
|
||||
|
||||
### ------------------------------------------------------------
|
||||
|
||||
def create_html_from_template():
|
||||
|
||||
from jinja2 import Template, Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('html/templates'))
|
||||
episode_template = env.get_template('episode.jinja')
|
||||
output_from_parsed_template = episode_template.render(episode_author="rrrrrrrr", episode_dur="123", about_show="bla bla", episode_playlist="playlist_songs", episode_image="episode/{0}/img/cover.png".format(episode_number))
|
||||
|
||||
with open("html/episode.html".format(episode_number), "w") as episode_page:
|
||||
episode_page.write(output_from_parsed_template)
|
||||
|
||||
create_show_playlist(show_array, complete_playlist)
|
||||
create_show_coverart(show_array, 1) #total_show_dur = 100
|
||||
#create_animated_gif()
|
||||
#convert -delay 100 -loop 0 html/episode/2/img/show_cover_2024-01-12* animatedGIF.gif
|
||||
#create_intro(show_array)
|
||||
create_pls_file()
|
||||
create_web_page(show_array)
|
||||
create_html_from_template()
|
||||
#create_web_page(show_name, show_array, episode_number, artists_played, show_cover, total_show_dur)
|
||||
#create_podcast(show_array)
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +1,11 @@
|
|||
/home/rob/antena/music/kamizdat/Lifecutter - Sub Persona (Kamizdat, 2020) [FLAC]/Lifecutter - Sub Persona - 04. Sub Persona IV.flac
|
||||
/home/rob/antena/music/kamizdat/Warrego_Valles_-_Botox_(2018_Kamizdat)_[FLAC]/7. Warrego Valles - 5000000000 YRS.flac
|
||||
/home/rob/antena/music/pharmafabrik_recordings/Various - Bora Scura Reimagined/Vomir - Bora Scura Reimagined - 09 Action XIX.flac
|
||||
/home/rob/antena/music/pharmafabrik_recordings/Delta-Sleep-Inducing Peptide - Oscillopsia/Delta-Sleep-Inducing Peptide - Oscillopsia - 05 Constant Negation.flac
|
||||
/home/rob/antena/music/kamizdat/Luka_Prinčič_-_Antigone_Child_(2018, Kamizdat).[FLAC]/02 Chorus 1 (SC).flac
|
||||
/home/rob/antena/music/kamizdat/Gašper Torkar - Dreams of Others EP (Kamizdat, 2017) [FLAC]/Gašper Torkar - Dreams of Others EP - 5 - Rib Vaulting.flac
|
||||
/home/rob/antena/music/kamizdat/Access Frame - Equity (Kamizdat, 2020) [FLAC]/Kamizdat - Access Frame- Equity - 07 Zergon- Altobar.flac
|
||||
/home/rob/antena/music/pharmafabrik_recordings/Lhetargija - Raganas Mācekle/Lhetargija - Raganas Mācekle - 03 Vorspiel fur Traurige Madchen.flac
|
||||
/home/rob/antena/music/kamizdat/Irena Tomažin - Taste Of Silence/Irena Tomažin - Taste Of Silence - 09 Soloveikia Moj.flac
|
||||
/home/rob/antena/music/sploh/Jošt Drašler - The Balloon Catcher/Jošt Drašler - The Balloon Catcher - 09 Grandma Balloon.flac
|
||||
/home/rob/antena/music/kamizdat/Irena Tomažin - Taste Of Silence/Irena Tomažin - Taste Of Silence - 02 Soil Stone.flac
|
||||
/home/rob/antena/music/kamizdat/Gašper_Torkar_-_Accept_the_Risk_and_Continue_[Kamizdat_2021_FLAC]/Gašper_Torkar_-_Accept_the_Risk_and_Continue_-_4._Arboreal.flac
|
||||
/home/rob/antena/music/pharmafabrik_recordings/Chris Wood - Misoneism/Chris Wood - Misoneism - 02 Quiet Certainty.flac
|
||||
/home/rob/antena/music/sploh/Samo Kutin and Martin Küchen - Stutter And Strike/Samo Kutin and Martin Küchen - Stutter And Strike - 03 Svete gore.flac
|
||||
/home/rob/antena/music/sploh/Axel Dörner and Tomaž Grom - Omejeno gibanje - Confined Movement/Axel Dörner and Tomaž Grom - Omejeno gibanje - Confined Movement - 06 Confined Movement- F.flac
|
||||
/home/rob/antena/music/kamizdat/Shekuza - De Sica (2019, Kamizdat) [FLAC]/04 Shekuza - Nebulae Tree.flac
|
||||
/home/rob/antena/music/kamizdat/rouge-ah - bare (Kamizdat, 2018) [FLAC]/5. conversation suppresed.flac
|
||||
/home/rob/antena/music/sploh/Tone Pavček & Tomaž Grom - Sonce in sončice po vsem svetu/Tone Pavček & Tomaž Grom - Sonce in sončice po vsem svetu - 10 Ninulla Çapkanёve (Čenčačeva uspavanka).flac
|
||||
/home/rob/antena/music/pharmafabrik_recordings/Various - Bora Scura Reimagined/Sunao Inami - Bora Scura Reimagined - 05 Action XV.flac
|
||||
/home/rob/antena/music/kamizdat/Luka Prinčič + ala pecula - a space process (2022, Kamizdat) [FLAC]/Luka Prinčič + ala pecula - a space process - 06 - a1.flac
|
||||
/home/rob/antena/music/kamizdat/beepblip - Noise for Strings vol.2 (Kamizdat, 2020) [FLAC]/beepblip - Noise for Strings vol.2 - 02. Protons.flac
|
||||
/home/rob/antena/music/sploh/TiTiTi (Jure Boršič, Jošt Drašler, Vid Drašler) - Štafelaj/TiTiTi (Jure Boršič, Jošt Drašler, Vid Drašler) - Štafelaj - 02 Spone (Chains).flac
|
Loading…
Reference in New Issue