-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_sequence.py
More file actions
60 lines (45 loc) · 1.97 KB
/
Copy pathmake_sequence.py
File metadata and controls
60 lines (45 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import os, random, glob, datetime
os.system ("rm /home/liquidsoap/radio/elex/sequence_MP3WRAP.mp3")
command = "mp3wrap /home/liquidsoap/radio/elex/sequence.mp3 "
# Get the list of all tracks
musicdir = '/home/liquidsoap/radio/elex/music'
list_of_music = glob.glob(musicdir + '/*.mp3')
# Get the list of all jingles
jinglesdir = '/home/liquidsoap/radio/elex/jingles'
list_of_jingles = glob.glob(jinglesdir + '/*.mp3')
# Get the list of playlist tracks
playlistdir = '/home/liquidsoap/radio/elex/playlist'
list_of_playlist = glob.glob(playlistdir + '/*.mp3')
# Set up the array which will hold the files to be sequenced
tracks = []
# If the next sequence starts at :00, play 2 mins silence, else play SNR
now = datetime.datetime.now()
# TODO: Add to the TOTH
if (now.minute < 45):
tracks.append('/home/liquidsoap/radio/elex/snrnews-safe.mp3')
# TODO: Replace with the half-past hour intro
tracks.append('/home/liquidsoap/radio/elex/idents/toth.mp3')
else:
tracks.append('/home/liquidsoap/radio/elex/idents/toth.mp3')
# Add a random track
rndTrack = random.choice(list_of_music)
tracks.append(rndTrack)
# Add the Cambridge package (will be blank if none)
tracks.append('/home/liquidsoap/radio/elex/cambridge_MP3WRAP.mp3')
# Add the S. Cambs package (will be blank if none)
tracks.append('/home/liquidsoap/radio/elex/s_cambs_MP3WRAP.mp3')
# Add link for SE Cambs if there are SE Cambs clips
seclipsdir = '/home/liquidsoap/radio/elex/clips_safe/s_e_cambs'
num_clips = len([name for name in os.listdir(seclipsdir) if os.path.isfile(os.path.join(seclipsdir, name))])
if (num_clips > 0):
tracks.append('/home/liquidsoap/radio/elex/idents/s_e_cambs_trail.mp3')
# Add a random track
rndTrack = random.choice(list_of_playlist)
tracks.append(rndTrack)
# Add the SE Cambs package (will be blank if none)
tracks.append('/home/liquidsoap/radio/elex/s_e_cambs_MP3WRAP.mp3')
# Call MP3 wrap to add it all together
for track in tracks:
command = command + "\"" + track + "\" "
print command
os.system(command)