-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
217 lines (206 loc) · 7.49 KB
/
index.php
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php
require_once 'vendor/autoload.php';
$getID3 = new getID3;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Therapy Sessions</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background: no-repeat url(./grid_0.png);
background-size: 100%;
background-position: top;
background-color: black;
background-attachment: fixed;
}
h1 {
text-align: center;
margin-bottom: 1rem;
color: red;
font-family: "Lucida Console", "Courier New", monospace;
font-size: 4rem;
}
h2 {
text-align: center;
color: white;
font-family: "Lucida Console", "Courier New", monospace;
font-size: 2rem;
}
#recording-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 1rem;
padding: 1rem;
}
.recording {
border: 1px solid #dee2e6;
border-radius: 5px;
width: 400px;
height: 300px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 1rem;
box-sizing: border-box;
color: white;
background-size: cover;
background-position: center;
position: relative;
font-style: bold;
}
.overlay {
background-color: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 1;
padding: 1rem;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
}
.filename, .metadata {
text-align: center;
inline-size: 375px;
/* overflow: hidden;
overflow-wrap: break-word;*/
}
audio {
width: 100%;
}
.download-btn {
background-color: #830d0d;
border: none;
border-radius: 5px;
color: white;
padding: 0.5rem 1rem;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 0 1rem;
cursor: pointer;
}
.flier {
margin-bottom: 1rem;
}
header {
position: relative;
text-align: center;
padding: 1rem;
}
.header-overlay {
background-color: rgba(0, 0, 0, 0.5);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
footer {
position: relative;
text-align: center;
padding: 1rem;
}
.footer-overlay {
background-color: rgba(0, 0, 0, 0.5);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
.setlist, a:link, a:visited, a:hover, a:active {
color: white;
}
</style>
</head>
<body>
<header>
<div class="header-overlay"></div>
<h1>Therapy Sessions Archive</h1>
<h2>Therapy Sessions is a drum n bass event run by Anger Management / Robyn Chaos</h2>
<h2>This archive is unofficial, and exists to archive a great night we had in the early 2000's</h2>
<h2>If you have more Therapy sets, set lists or fliers - please get in touch!</h2>
</header>
<div id="recording-container">
<?php
$audio_dir = "audio/";
$fliers_dir = "fliers/";
$setlists_dir = "setlists/";
$flier_extensions = ['jpg', 'jpeg', 'png', 'webp'];
function find_matching_setlist($filename, $setlists_dir) {
$possible_setlist = $setlists_dir . str_replace('.mp3', '.txt', $filename);
if (file_exists($possible_setlist)) {
return $possible_setlist;
}
return null;
}
function find_matching_flier($filename, $fliers_dir, $flier_extensions) {
foreach ($flier_extensions as $ext) {
$possible_flier = $fliers_dir . str_replace('.mp3', ".$ext", $filename);
if (file_exists($possible_flier)) {
return $possible_flier;
}
}
return null;
}
if (is_dir($audio_dir)) {
$files = glob($audio_dir . "*.mp3");
foreach ($files as $file) {
$file_name = basename($file);
$flier_path = find_matching_flier($file_name, $fliers_dir, $flier_extensions);
$default_flier = "therapy.jpg";
$flier = $flier_path ? "style=\"background-image: url('$flier_path');\"" : "style=\"background-image: url('$default_flier');\"";
$setlist_path = find_matching_setlist($file_name, $setlists_dir);
$file_info = $getID3->analyze($file);
$artist = isset($file_info['tags']['id3v2']['artist'][0]) ? $file_info['tags']['id3v2']['artist'][0] : (isset($file_info['tags']['id3v1']['artist'][0]) ? $file_info['tags']['id3v1']['artist'][0] : 'Unknown');
$title = isset($file_info['tags']['id3v2']['title'][0]) ? $file_info['tags']['id3v2']['title'][0] : (isset($file_info['tags']['id3v1']['title'][0]) ? $file_info['tags']['id3v1']['title'][0] : 'Unknown');
$album = isset($file_info['tags']['id3v2']['album'][0]) ? $file_info['tags']['id3v2']['album'][0] : (isset($file_info['tags']['id3v1']['album'][0]) ? $file_info['tags']['id3v1']['album'][0] : 'Unknown');
$year = isset($file_info['tags']['id3v2']['year'][0]) ? $file_info['tags']['id3v2']['year'][0] : (isset($file_info['tags']['id3v1']['year'][0]) ? $file_info['tags']['id3v1']['year'][0] : 'Unknown');
$setlist_link = $setlist_path ? "<a href=\"$setlist_path\" download>Download Setlist</a>" : '';
$content = <<<HTML
<div class="filename">$file_name</div>
<div class="metadata">
<p>Artist: $artist</p>
<p>Title: $title</p>
<p>Event: $album</p>
<p>Year: $year</p>
</div>
<audio controls src="$file"></audio>
<a class="download-btn" href="$file" download>Download</a>
<div class="setlist">$setlist_link</div>
HTML;
echo "<div class=\"recording\" $flier>
<div class=\"overlay\">
$content
</div>
</div>";
}
} else {
echo "<p>Error: the 'audio' directory does not exist.</p>";
}
?>
</div>
<footer>
<div class="footer-overlay"></div>
<h2>Site provided free of advertising for the community, all sets are over 10 years old and no copyright infringement is intended.</h2>
<h2>Copyright owners wanting content removed should contact the email below.</h2>
<h2>oli at olipassey dot me dot uk</h2>
</footer>
</body>
</html>