first commit
This commit is contained in:
commit
bdf95574f7
9 changed files with 819 additions and 0 deletions
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
Best_of_Vangelis
|
||||
C418_Minecraft
|
||||
Frostpunk
|
||||
Minecraft
|
||||
C418_other
|
||||
Skyrim
|
||||
The_Elder_Scrolls_Online
|
2
.htaccess
Normal file
2
.htaccess
Normal file
|
@ -0,0 +1,2 @@
|
|||
Order allow,deny
|
||||
Allow from all
|
4
README.md
Normal file
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
# AMBIENT
|
||||
|
||||
|
||||
A little home-made HTML5 audio player.
|
BIN
background.jpg
Executable file
BIN
background.jpg
Executable file
Binary file not shown.
After Width: | Height: | Size: 533 KiB |
BIN
background_.jpg
Executable file
BIN
background_.jpg
Executable file
Binary file not shown.
After Width: | Height: | Size: 511 KiB |
283
index.html
Executable file
283
index.html
Executable file
|
@ -0,0 +1,283 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="description" content="Ambient music">
|
||||
<meta name="keywords" content="ambient,chillout,background,music,minecraft,gameplay">
|
||||
|
||||
<title>Ambiance</title>
|
||||
<style>
|
||||
body {
|
||||
font-size: 1em;
|
||||
background-color: #23313A;
|
||||
background: url("background_.jpg") no-repeat, url("background-fast320.jpg") no-repeat, #23313A ;;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
background-size: cover;
|
||||
font-family: "Trebuchet MS",sans-serif;
|
||||
color: #fff;
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #ff0;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
#container {
|
||||
text-align: center;
|
||||
padding-top: 5%;
|
||||
}
|
||||
#title1 {
|
||||
text-align: center;
|
||||
font-size: 8vw;
|
||||
text-shadow:0px 0px 10px #000000,0px 0px 10px #000000,0px 0px 5px #000000;
|
||||
}
|
||||
#title2 {
|
||||
text-align: center;
|
||||
font-size: 1.5vw;
|
||||
text-shadow:0px 0px 10px #000000,0px 0px 10px #000000,0px 0px 5px #000000;
|
||||
}
|
||||
#composers {
|
||||
background: rgba(0,0,0,0.65);
|
||||
border-radius: 15px;
|
||||
padding: 15px;
|
||||
text-shadow:0px 0px 10px #000000,0px 0px 10px #000000,0px 0px 5px #000000,0px 0px 5px #000000,0px 0px 5px #000000;
|
||||
margin-left: 25%;
|
||||
margin-right: 25%;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
#instructions {
|
||||
font-size:0.8em;
|
||||
text-shadow:0px 0px 10px #000000,0px 0px 10px #000000,0px 0px 5px #000000,0px 0px 5px #000000,0px 0px 5px #000000;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
#playwith {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#htmlplayer {
|
||||
padding: 5px 0px 5px 0px;
|
||||
margin-left: 20%;
|
||||
margin-right: 20%;
|
||||
margin-top: 15px;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
#htmlplayer button {
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
audio {
|
||||
width: 500px;
|
||||
display: inline;
|
||||
position: relative;
|
||||
top: 16px;
|
||||
}
|
||||
|
||||
#songNumber {
|
||||
color: rgb(180,180,180);
|
||||
margin-right: 5px;
|
||||
|
||||
}
|
||||
#songTitle {
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#buttonPrevious, #buttonNext {
|
||||
padding-left: 12px;
|
||||
padding-right: 12px;
|
||||
}
|
||||
|
||||
|
||||
.playbutton {
|
||||
-moz-box-shadow:inset 0px 2px 2px 0px #94b079;
|
||||
-webkit-box-shadow:inset 0px 2px 2px 0px #94b079;
|
||||
box-shadow:inset 0px 2px 2px 0px #94b079;
|
||||
background-color:#464f2e;
|
||||
-webkit-border-top-left-radius:42px;
|
||||
-moz-border-radius-topleft:42px;
|
||||
border-top-left-radius:42px;
|
||||
-webkit-border-top-right-radius:42px;
|
||||
-moz-border-radius-topright:42px;
|
||||
border-top-right-radius:42px;
|
||||
-webkit-border-bottom-right-radius:42px;
|
||||
-moz-border-radius-bottomright:42px;
|
||||
border-bottom-right-radius:42px;
|
||||
-webkit-border-bottom-left-radius:42px;
|
||||
-moz-border-radius-bottomleft:42px;
|
||||
border-bottom-left-radius:42px;
|
||||
border:1px solid #000000;
|
||||
display:inline-block;
|
||||
color:#ffffff;
|
||||
font-size:15px;
|
||||
font-weight:bold;
|
||||
width:135px;
|
||||
text-decoration:none;
|
||||
text-align:center;
|
||||
text-shadow:1px 1px 0px #000000;
|
||||
padding: 2px 0px 2px 0px;
|
||||
margin: 5px 5px 0px 5px;
|
||||
}.playbutton:hover {
|
||||
background-color:#6c7d45;
|
||||
text-decoration:none;
|
||||
}.playbutton:active {
|
||||
position:relative;
|
||||
top:1px;
|
||||
}
|
||||
/* This button was generated using CSSButtonGenerator.com
|
||||
Yeah I'm lazy. Sue me.
|
||||
*/
|
||||
|
||||
|
||||
/* CSS Tooltip from http://www.impressivewebs.com/pure-css-tool-tips/ */
|
||||
a[data-tooltip]:link, a[data-tooltip]:visited {
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a[data-tooltip]:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
border-top: 20px solid rgb(200,200,0);
|
||||
border-left: 30px solid transparent;
|
||||
border-right: 30px solid transparent;
|
||||
visibility: hidden;
|
||||
top: -22px;
|
||||
left: 35px;
|
||||
}
|
||||
|
||||
a[data-tooltip]:after {
|
||||
content: attr(data-tooltip);
|
||||
position: absolute;
|
||||
color: black;
|
||||
text-shadow: none;
|
||||
top: -39px;
|
||||
left: 35px;
|
||||
background: rgb(200,200,0);
|
||||
padding: 5px 15px;
|
||||
-webkit-border-radius: 10px;
|
||||
-moz-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
white-space: nowrap;
|
||||
visibility: hidden;
|
||||
font-weight:normal;
|
||||
}
|
||||
|
||||
a[data-tooltip]:hover:before, a[data-tooltip]:hover:after {
|
||||
visibility: visible;
|
||||
-webkit-transition: visibility 0s linear .3s;
|
||||
-moz-transition: visibility 0s linear .3s;
|
||||
-o-transition: visibility 0s linear .3s;
|
||||
transition: visibility 0s linear .3s;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1260px) {
|
||||
#title1 { font-size: 10vw; }
|
||||
#title2 { font-size: 2.5vw; }
|
||||
#composers { font-size: 0.9em; margin-left: 20%; margin-right: 20%; }
|
||||
#htmlplayer { margin-left: 10%; margin-right: 10%; }
|
||||
audio { width: 400px; }
|
||||
#instructions { font-size: 0.7em; }
|
||||
}
|
||||
@media screen and (max-width: 700px) {
|
||||
#title1 { font-size: 3em; }
|
||||
#title2 { font-size: 1em; }
|
||||
#composers { font-size: 0.9em; margin-left: 5%; margin-right: 5%; }
|
||||
#htmlplayer { margin-left: 10%; margin-right: 10%; }
|
||||
audio { width: 300px; }
|
||||
#instructions { font-size: 0.7em; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
|
||||
<div id="title1">Musique d'ambiance</div>
|
||||
<div id="title2">Mes bandes originales préférées<br>comme Minecraft, Vangelis, Frostpunk, Skyrim ...</div>
|
||||
|
||||
<div id="composers">
|
||||
Ma sélection de musiques, rêveuses, inpirantes ou mélancoliques que j'écoute pour travailler <br>ou lorsque je joue, histoire de changer des musiques des jeux.<br>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div id="instructions">
|
||||
<div id="htmlplayer">
|
||||
<span id="songNumber">(/)</span> <span id="songTitle">Titre</span> - <span id="songArtist">Artiste</span><br />
|
||||
<button id="buttonPrevious" onclick="previousSong();">◀</button>
|
||||
<button id="buttonNext" onclick="nextSong();">▶</button>
|
||||
<audio controls id="audio" width="700" height="100"></audio>
|
||||
</div>
|
||||
|
||||
<div id="playwith">
|
||||
<center>Méthode alternative:</center>
|
||||
<a href="playlist.m3u" class="playbutton" data-tooltip="Ouvrez ce fichier avec votre lecteur multimédia préféré (tel que VLC).">M3U Playlist</a>
|
||||
</div>
|
||||
<br style="clear:both;">
|
||||
<!--
|
||||
. o .
|
||||
. . o Hello, hacker. If you prefer to download all musics for offline listening:
|
||||
o o o wget https://draconis.me/ambient/playlist.m3u ; wget -i playlist.m3u
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
// A very crude HTML Audio player.
|
||||
// Uses as source a xspf playlist containing links to mp3 files.
|
||||
// Author: sebsauvage at sebsauvage dot net
|
||||
// Licence: Public domain
|
||||
// Mood: I hate javascript.
|
||||
|
||||
var playlist; // The list of songs
|
||||
var currentSong=-1; // current song index in playlist
|
||||
var audioplayer = document.getElementById('audio'); // audioplayer.
|
||||
|
||||
// Resize previous/next buttons to match audio player height.
|
||||
document.getElementById('buttonPrevious').style.height = audioplayer.clientHeight;
|
||||
document.getElementById('buttonNext').style.height = audioplayer.clientHeight;
|
||||
|
||||
// Get the xspf playlist
|
||||
const req = new XMLHttpRequest();
|
||||
req.open('GET', 'xspf_playlist.php', true); // Note that xspf_playlist.php returns a shuffled playlist each time.
|
||||
req.overrideMimeType('text/xml');
|
||||
req.onload = parseXSPF;
|
||||
req.send(null);
|
||||
|
||||
// Parse XSPF xml once received.
|
||||
function parseXSPF() {
|
||||
playlist = Array.from(req.responseXML.documentElement.children[1].children); // xml.playlist.tracklist
|
||||
currentSong = 0;
|
||||
playCurrentSong();
|
||||
}
|
||||
|
||||
// Switch to next song.
|
||||
function nextSong() {
|
||||
currentSong++;
|
||||
if (currentSong >= playlist.length) { currentSong = 0; }
|
||||
playCurrentSong();
|
||||
}
|
||||
|
||||
// Switch to previous song.
|
||||
function previousSong() {
|
||||
currentSong--;
|
||||
if (currentSong < 0) { currentSong = playlist.length-1; }
|
||||
playCurrentSong();
|
||||
}
|
||||
|
||||
function playCurrentSong() {
|
||||
audioplayer.src = playlist[currentSong].children[0].textContent; // URL of song (xml.playlist.tracklist.track.location)
|
||||
audioplayer.onended = nextSong.bind(null); // Autplay next song when this song ends.
|
||||
document.getElementById('songNumber').textContent = '[' + (currentSong+1) + '/' + playlist.length + ']';
|
||||
document.getElementById('songTitle').textContent = playlist[currentSong].children[1].textContent; // xml.playlist.tracklist.track.title
|
||||
document.getElementById('songArtist').textContent = playlist[currentSong].children[2].textContent; // xml.playlist.tracklist.track.creator
|
||||
audioplayer.play();
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
341
playlist.m3u
Executable file
341
playlist.m3u
Executable file
|
@ -0,0 +1,341 @@
|
|||
#EXTM3U
|
||||
#EXTINF:250,Piotr Musiał - The City Must Survive
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_09_The_City_Must_Survive.mp3
|
||||
#EXTINF:278,Piotr Musiał - Damned Souls
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_10_Damned_Souls.mp3
|
||||
#EXTINF:182,Vangelis - Abraham's Theme
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Abrahams_Theme.mp3
|
||||
#EXTINF:171,C418 - swarms
|
||||
https://draconis.me/ambient/C418_other/c418__One__16_swarms.mp3
|
||||
#EXTINF:43,Jeremy Soule - Night Without Stars
|
||||
https://draconis.me/ambient/Skyrim/Night_without_Stars.mp3
|
||||
#EXTINF:91,C418 - lost cousins
|
||||
https://draconis.me/ambient/C418_other/c418__One__12_lost_cousins.mp3
|
||||
#EXTINF:72,Jeremy Soule - Caught Off Guard
|
||||
https://draconis.me/ambient/Skyrim/Caught_off_Guard.mp3
|
||||
#EXTINF:296,Lena Raine - Aerie
|
||||
https://draconis.me/ambient/Minecraft/Lena%20Raine__Aerie.mp3
|
||||
#EXTINF:182,Jeremy Soule - Death or Sovngarde
|
||||
https://draconis.me/ambient/Skyrim/Death_or_Sovngarde.mp3
|
||||
#EXTINF:249,Jeremy Soule - Journey’s End
|
||||
https://draconis.me/ambient/Skyrim/Journey_s_End.mp3
|
||||
#EXTINF:356,Vangelis - Life Of Antarctica (Remastered)
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Life_Of_Antarctica.mp3
|
||||
#EXTINF:185,C418 - Mutation
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Mutation.mp3
|
||||
#EXTINF:271,Lena Raine - Infinite Amethyst
|
||||
https://draconis.me/ambient/Minecraft/Lena%20Raine__Infinite%20Amethyst.mp3
|
||||
#EXTINF:87,C418 - Chris
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_15_Chris.mp3
|
||||
#EXTINF:310,C418 - Aria Math
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Aria_Math.mp3
|
||||
#EXTINF:228,Jeremy Soule - The City Gates
|
||||
https://draconis.me/ambient/Skyrim/The_City_Gates.mp3
|
||||
#EXTINF:247,Piotr Musiał - Price of Progress
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_05_Price_of_Progress.mp3
|
||||
#EXTINF:151,Vangelis - Celestial Whispers
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Celestial_Whispers.mp3
|
||||
#EXTINF:169,Piotr Musiał - On the Edge Theme
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_07_On_the_Edge_Theme.mp3
|
||||
#EXTINF:275,C418 - Ballad of the Cats
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Ballad_of_the_Cats.mp3
|
||||
#EXTINF:102,C418 - Beginning
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_22_Beginning.mp3
|
||||
#EXTINF:211,Vangelis - Fading Away
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Fading_Away.mp3
|
||||
#EXTINF:244,C418 - Floating Trees
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Floating_Trees.mp3
|
||||
#EXTINF:65,C418 - Key
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_01_Key.mp3
|
||||
#EXTINF:2554,Jeremy Soule & Mark Lampert - https://draconis.me/ambient/Skyrim Atmospheres
|
||||
https://draconis.me/ambient/Skyrim/Atmospheres.mp3
|
||||
#EXTINF:410,Vangelis - Other Side Of Antarctica (Remastered)
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Other_Side_Of_Antarctica.mp3
|
||||
#EXTINF:306,Jeremy Soule - From Past to Present
|
||||
https://draconis.me/ambient/Skyrim/From_Past_to_Present.mp3
|
||||
#EXTINF:85,C418 - pr department
|
||||
https://draconis.me/ambient/C418_other/c418__One__18_pr_department.mp3
|
||||
#EXTINF:224,Vangelis - Kinematic (Remastered)
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Kinematic.mp3
|
||||
#EXTINF:287,Jeremy Soule - Ancient Stones
|
||||
https://draconis.me/ambient/Skyrim/Ancient_Stones.mp3
|
||||
#EXTINF:254,C418 - https://draconis.me/ambient/Minecraft
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_08_Minecraft.mp3
|
||||
#EXTINF:164,Piotr Musiał - The Last Autumn Theme
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_01_The_Last_Autumn_Theme.mp3
|
||||
#EXTINF:239,C418 - Warmth
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Warmth.mp3
|
||||
#EXTINF:205,Kumi Tanioka - Floating Dream
|
||||
https://draconis.me/ambient/Minecraft/Kumi%20Tanioka__Floating%20Dream.mp3
|
||||
#EXTINF:275,Kumi Tanioka - Comforting Memories
|
||||
https://draconis.me/ambient/Minecraft/Kumi%20Tanioka__Comforting%20Memories.mp3
|
||||
#EXTINF:246,Piotr Musiał - The Inevitable
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_06%20_The_Inevitable.mp3
|
||||
#EXTINF:339,Vangelis - Memories Of Green (Remastered)
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Memories_Of_Green.mp3
|
||||
#EXTINF:176,C418 - Thirteen
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_16_Thirteen.mp3
|
||||
#EXTINF:281,C418 - Mice on Venus
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_11_Mice_on_Venus.mp3
|
||||
#EXTINF:255,Piotr Musiał - Arrival
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_02_Arrival.mp3
|
||||
#EXTINF:176,C418 - Beginning 2
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Beginning_2.mp3
|
||||
#EXTINF:398,Jeremy Soule - Standing Stones
|
||||
https://draconis.me/ambient/Skyrim/Standing_Stones.mp3
|
||||
#EXTINF:94,Piotr Musiał - Reaching the Shores (Bonus Track)
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_13_Reaching_the_Shores_(Bonus_Track).mp3
|
||||
#EXTINF:174,Jeremy Soule - Into Darkness
|
||||
https://draconis.me/ambient/Skyrim/Into_Darkness.mp3
|
||||
#EXTINF:238,Jeremy Soule - Sky Above, Voice Within
|
||||
https://draconis.me/ambient/Skyrim/Sky_Above_Voice_Within.mp3
|
||||
#EXTINF:68,C418 - Dry Hands
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_12_Dry_Hands.mp3
|
||||
#EXTINF:65,C418 - Oxygène
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_09_Oxygene.mp3
|
||||
#EXTINF:93,C418 - for the sake of making games
|
||||
https://draconis.me/ambient/C418_other/c418__One__09_for_the_sake_of_making_games.mp3
|
||||
#EXTINF:175,Jeremy Soule - The Gathering Storm
|
||||
https://draconis.me/ambient/Skyrim/The_Gathering_Storm.mp3
|
||||
#EXTINF:301,Jeremy Soule,Brad Derrick & Malukah - For Blood, for Glory, for Honor
|
||||
https://draconis.me/ambient/The_Elder_Scrolls_Online/Jeremy_Soule_For_Blood_For_Glory_For_Honor.mp3
|
||||
#EXTINF:198,C418 - jayson glove
|
||||
https://draconis.me/ambient/C418_other/c418__One__26_jayson_glove.mp3
|
||||
#EXTINF:601,Vangelis - Création du monde (Remastered)
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Cr%C3%A9ation_du_monde.mp3
|
||||
#EXTINF:124,C418 - Excuse
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_17_Excuse.mp3
|
||||
#EXTINF:110,Brad Derrick - Weapons Drawn
|
||||
https://draconis.me/ambient/The_Elder_Scrolls_Online/Brad_Derrick_Weapons_Drawn.mp3
|
||||
#EXTINF:247,Piotr Musiał - New London Ultimatum
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_11_New_London_Ultimatum.mp3
|
||||
#EXTINF:603,C418 - Alpha
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Alpha.mp3
|
||||
#EXTINF:281,Piotr Musiał - The Darkest Of Days
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk%20_03%20_The_Darkest_Of_Days.mp3
|
||||
#EXTINF:237,Jeremy Soule - Dragonborn
|
||||
https://draconis.me/ambient/Skyrim/Dragonborn.mp3
|
||||
#EXTINF:314,Lena Raine - Wending
|
||||
https://draconis.me/ambient/Minecraft/Lena%20Raine__Wending.mp3
|
||||
#EXTINF:242,Piotr Musiał - On our Own
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_10_On_our_Own.mp3
|
||||
#EXTINF:254,C418 - Concrete Halls
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Concrete_Halls.mp3
|
||||
#EXTINF:108,Piotr Musiał - Snow is Ever-changing (Bonus Track)
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk%20_25%20_Snow_is_Ever_changing_(Bonus_Track).mp3
|
||||
#EXTINF:105,Jeremy Soule - Steel on Steel
|
||||
https://draconis.me/ambient/Skyrim/Steel_on_Steel.mp3
|
||||
#EXTINF:312,Lena Raine - Firebugs
|
||||
https://draconis.me/ambient/Minecraft/Lena%20Raine__Firebugs.mp3
|
||||
#EXTINF:94,Jeremy Soule - Awake
|
||||
https://draconis.me/ambient/Skyrim/Awake.mp3
|
||||
#EXTINF:150,Jeremy Soule - The Bannered Mare
|
||||
https://draconis.me/ambient/Skyrim/The_Bannered_Mare.mp3
|
||||
#EXTINF:208,C418 - Subwoofer Lullaby
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_03_Subwoofer_Lullaby.mp3
|
||||
#EXTINF:366,Jeremy Soule - Masser
|
||||
https://draconis.me/ambient/Skyrim/Masser.mp3
|
||||
#EXTINF:69,Jeremy Soule - Before the Storm
|
||||
https://draconis.me/ambient/Skyrim/Before_the_Storm.mp3
|
||||
#EXTINF:333,Jeremy Soule - Far Horizons
|
||||
https://draconis.me/ambient/Skyrim/Far_Horizons.mp3
|
||||
#EXTINF:241,Piotr Musiał - Final Push
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_12_Final_Push.mp3
|
||||
#EXTINF:280,Piotr Musiał - The Last Flame
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_06_The_Last_Flame.mp3
|
||||
#EXTINF:204,C418 - Haggstrom
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_07_Haggstrom.mp3
|
||||
#EXTINF:92,C418 - Ki
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Ki.mp3
|
||||
#EXTINF:170,C418 - Flake
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Flake.mp3
|
||||
#EXTINF:241,Piotr Musiał - Cold, New Dawn
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_08_Cold_New_Dawn.mp3
|
||||
#EXTINF:296,C418 - Dead Voxel
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Dead_Voxel.mp3
|
||||
#EXTINF:240,Piotr Musiał - Long Days, Cold Nights
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_03_Long_Days_Cold_Nights.mp3
|
||||
#EXTINF:212,Malukah - Beauty of Dawn
|
||||
https://draconis.me/ambient/The_Elder_Scrolls_Online/Malukah_Beauty_Of_Dawn.mp3
|
||||
#EXTINF:343,Lena Raine - Ancestry
|
||||
https://draconis.me/ambient/Minecraft/Lena%20Raine__Ancestry.mp3
|
||||
#EXTINF:372,C418 - Dragon Fish
|
||||
https://draconis.me/ambient/C418_other/C418__Dragon%20Fish.mp3
|
||||
#EXTINF:132,Jeremy Soule - Blood and Steel
|
||||
https://draconis.me/ambient/Skyrim/Blood_and_Steel.mp3
|
||||
#EXTINF:361,C418 - Haunt Muskie
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Haunt_Muskie.mp3
|
||||
#EXTINF:244,Piotr Musiał - The Shepherd
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_07_The_Shepherd.mp3
|
||||
#EXTINF:93,C418 - wooden love
|
||||
https://draconis.me/ambient/C418_other/c418__One__22_wooden_love.mp3
|
||||
#EXTINF:192,Jeremy Soule - Around the Fire
|
||||
https://draconis.me/ambient/Skyrim/Around_the_Fire.mp3
|
||||
#EXTINF:206,C418 - buildup errors
|
||||
https://draconis.me/ambient/C418_other/c418__One__08_buildup_errors.mp3
|
||||
#EXTINF:231,Jeremy Soule - Tundra
|
||||
https://draconis.me/ambient/Skyrim/Tundra.mp3
|
||||
#EXTINF:157,Jeremy Soule - Death in the Darkness
|
||||
https://draconis.me/ambient/Skyrim/Death_in_the_Darkness.mp3
|
||||
#EXTINF:231,Jeremy Soule - Kyne’s Peace
|
||||
https://draconis.me/ambient/Skyrim/Kyne_s_Peace.mp3
|
||||
#EXTINF:259,Vangelis - Return To The Void
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Return_To_The_Void.mp3
|
||||
#EXTINF:142,Jeremy Soule - Watch the Skies
|
||||
https://draconis.me/ambient/Skyrim/Watch_the_Skies.mp3
|
||||
#EXTINF:254,Piotr Musiał - First Shipment
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_09_First_Shipment.mp3
|
||||
#EXTINF:184,Jeremy Soule - Out of the Cold
|
||||
https://draconis.me/ambient/Skyrim/Out_of_the_Cold.mp3
|
||||
#EXTINF:126,Vangelis - P.S.
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__P.S.mp3
|
||||
#EXTINF:167,C418 - total drag
|
||||
https://draconis.me/ambient/C418_other/c418__One__13_total_drag.mp3
|
||||
#EXTINF:144,C418 - impostor syndrome
|
||||
https://draconis.me/ambient/C418_other/c418__One__07_impostor_syndrome.mp3
|
||||
#EXTINF:173,Jeremy Soule - Silent Footsteps
|
||||
https://draconis.me/ambient/Skyrim/Silent_Footsteps.mp3
|
||||
#EXTINF:143,Jeremy Soule - Silence Unbroken
|
||||
https://draconis.me/ambient/Skyrim/Silence_Unbroken.mp3
|
||||
#EXTINF:191,C418 - Clark
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_14_Clark.mp3
|
||||
#EXTINF:223,Jeremy Soule - Under an Ancient Sun
|
||||
https://draconis.me/ambient/Skyrim/Under_an_Ancient_Sun.mp3
|
||||
#EXTINF:239,Jeremy Soule - Dawn
|
||||
https://draconis.me/ambient/Skyrim/Dawn.mp3
|
||||
#EXTINF:443,Jeremy Soule - Aurora
|
||||
https://draconis.me/ambient/Skyrim/Aurora.mp3
|
||||
#EXTINF:515,C418 - Taswell
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Taswell.mp3
|
||||
#EXTINF:80,C418 - one last game
|
||||
https://draconis.me/ambient/C418_other/c418__One__20_one_last_game.mp3
|
||||
#EXTINF:244,C418 - Shuniji
|
||||
https://draconis.me/ambient/C418_other/C418__Shuniji.mp3
|
||||
#EXTINF:238,Piotr Musiał - Streets Of New London
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_04_Streets_Of_New_London.mp3
|
||||
#EXTINF:141,Jeremy Soule - Shadows and Echoes
|
||||
https://draconis.me/ambient/Skyrim/Shadows_and_Echoes.mp3
|
||||
#EXTINF:188,C418 - preliminary art form
|
||||
https://draconis.me/ambient/C418_other/c418__One__10_preliminary_art_form.mp3
|
||||
#EXTINF:256,Jeremy Soule - Beneath the Ice
|
||||
https://draconis.me/ambient/Skyrim/Beneath_the_Ice.mp3
|
||||
#EXTINF:534,Vangelis - Blade Runner Blues
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Blade_Runner_Blues.mp3
|
||||
#EXTINF:201,Jeremy Soule - The Jerall Mountains
|
||||
https://draconis.me/ambient/Skyrim/The_Jerall_Mountains.mp3
|
||||
#EXTINF:177,C418 - Living Mice
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_05_Living_Mice.mp3
|
||||
#EXTINF:166,C418 - danny makes chiptune
|
||||
https://draconis.me/ambient/C418_other/c418__One__04_danny_makes_chiptune.mp3
|
||||
#EXTINF:248,Piotr Musiał - Construction Site
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_Expansions_04_Construction_Site.mp3
|
||||
#EXTINF:114,C418 - Équinoxe
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_10_Equinoxe.mp3
|
||||
#EXTINF:201,Jeremy Soule - A Winter’s Tale
|
||||
https://draconis.me/ambient/Skyrim/A_Winter_s_Tale.mp3
|
||||
#EXTINF:308,Lena Raine - Stand Tall
|
||||
https://draconis.me/ambient/Minecraft/Lena%20Raine__Stand%20Tall.mp3
|
||||
#EXTINF:142,Jeremy Soule - Imperial Throne
|
||||
https://draconis.me/ambient/Skyrim/Imperial_Throne.mp3
|
||||
#EXTINF:111,C418 - Door
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_02_Door.mp3
|
||||
#EXTINF:211,Jeremy Soule - The White River
|
||||
https://draconis.me/ambient/Skyrim/The_White_River.mp3
|
||||
#EXTINF:330,Brad Derrick - Moons of Evening Star
|
||||
https://draconis.me/ambient/The_Elder_Scrolls_Online/Brad_Derrick_Moons_Of_Evening_Star.mp3
|
||||
#EXTINF:545,Jeremy Soule - Wind Guide You
|
||||
https://draconis.me/ambient/Skyrim/Wind_Guide_You.mp3
|
||||
#EXTINF:497,C418 - Dreiton
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Dreiton.mp3
|
||||
#EXTINF:234,Jeremy Soule - Distant Horizons
|
||||
https://draconis.me/ambient/Skyrim/Distant_Horizons.mp3
|
||||
#EXTINF:188,C418 - Strad
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Strad.mp3
|
||||
#EXTINF:160,Jeremy Soule - Shattered Shields
|
||||
https://draconis.me/ambient/Skyrim/Shattered_Shields.mp3
|
||||
#EXTINF:241,Piotr Musiał - Brave New World
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_05_Brave_New_World.mp3
|
||||
#EXTINF:94,Jeremy Soule - Unbound
|
||||
https://draconis.me/ambient/Skyrim/Unbound.mp3
|
||||
#EXTINF:354,Vangelis - La mer recommencée (Remastered)
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__La_mer_recommenc%C3%A9e.mp3
|
||||
#EXTINF:276,C418 - Intro
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Intro.mp3
|
||||
#EXTINF:191,Jeremy Soule - A Chance Meeting
|
||||
https://draconis.me/ambient/Skyrim/A_Chance_Meeting.mp3
|
||||
#EXTINF:251,C418 - independent accident
|
||||
https://draconis.me/ambient/C418_other/c418__One__03_independent_accident.mp3
|
||||
#EXTINF:90,C418 - Wet Hands
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_13_Wet_Hands.mp3
|
||||
#EXTINF:110,Jeremy Soule - Tooth and Claw
|
||||
https://draconis.me/ambient/Skyrim/Tooth_and_Claw.mp3
|
||||
#EXTINF:274,Piotr Musiał - Into The Storm
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_08_Into_The_Storm.mp3
|
||||
#EXTINF:352,Vangelis - Antarctica Echoes (Remastered)
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Antarctica_Echoes.mp3
|
||||
#EXTINF:463,Vangelis - Fields of Coral
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Fields_of_Coral.mp3
|
||||
#EXTINF:303,C418 - Axolotl
|
||||
https://draconis.me/ambient/C418_other/C418__Axolotl.mp3
|
||||
#EXTINF:125,Jeremy Soule - Secunda
|
||||
https://draconis.me/ambient/Skyrim/Secunda.mp3
|
||||
#EXTINF:68,Jeremy Soule - Seven Thousand Steps
|
||||
https://draconis.me/ambient/Skyrim/Seven_Thousand_Steps.mp3
|
||||
#EXTINF:332,C418 - Blind Spots
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Blind_Spots.mp3
|
||||
#EXTINF:343,Lena Raine - Left to Bloom
|
||||
https://draconis.me/ambient/Minecraft/Lena%20Raine__Left%20to%20Bloom.mp3
|
||||
#EXTINF:149,Piotr Musiał - The Still, Cold World (Bonus Track)
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_11_The_Still_Cold_World_(Bonus_Track).mp3
|
||||
#EXTINF:323,Brad Derrick - Sands of the Alik'r
|
||||
https://draconis.me/ambient/The_Elder_Scrolls_Online/Brad_Derrick_Sands_Of_The_Alik_r.mp3
|
||||
#EXTINF:1112,Vangelis - Movement 1
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__Soil_Festivities__01__Movement_1.mp3
|
||||
#EXTINF:186,Piotr Musiał - https://draconis.me/ambient/Frostpunk Theme
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_%2001_Frostpunk_Theme.mp3
|
||||
#EXTINF:233,Piotr Musiał - Are We Alone?
|
||||
https://draconis.me/ambient/Frostpunk/Piotr_Musia%C5%82_Frostpunk_02_%20Are_We_Alone.mp3
|
||||
#EXTINF:378,C418 - Biome Fest
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Biome_Fest.mp3
|
||||
#EXTINF:127,Vangelis - In the magic of Cosmos
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__In_the_magic_of_Cosmos.mp3
|
||||
#EXTINF:208,Jeremy Soule - Frostfall
|
||||
https://draconis.me/ambient/Skyrim/Frostfall.mp3
|
||||
#EXTINF:180,C418 - Moog City 2
|
||||
https://draconis.me/ambient/C418_Minecraft/C418__Minecraft-Volume_Beta__Moog_City_2.mp3
|
||||
#EXTINF:226,C418 - cliffside hinson
|
||||
https://draconis.me/ambient/C418_other/c418__One__01_cliffside_hinson.mp3
|
||||
#EXTINF:386,Jeremy Soule - Unbroken Road
|
||||
https://draconis.me/ambient/Skyrim/Unbroken_Road.mp3
|
||||
#EXTINF:196,Jeremy Soule - One They Fear
|
||||
https://draconis.me/ambient/Skyrim/One_They_Fear.mp3
|
||||
#EXTINF:143,Jeremy Soule - Dragonsreach
|
||||
https://draconis.me/ambient/Skyrim/Dragonsreach.mp3
|
||||
#EXTINF:218,Jeremy Soule - Sovngarde
|
||||
https://draconis.me/ambient/Skyrim/Sovngarde.mp3
|
||||
#EXTINF:238,C418 - the weirdest year of your life
|
||||
https://draconis.me/ambient/C418_other/c418__One__15_the_weirdest_year_of_your_life.mp3
|
||||
#EXTINF:143,Jeremy Soule - Towers and Shadows
|
||||
https://draconis.me/ambient/Skyrim/Towers_and_Shadows.mp3
|
||||
#EXTINF:132,Jeremy Soule - Solitude
|
||||
https://draconis.me/ambient/Skyrim/Solitude.mp3
|
||||
#EXTINF:751,Vangelis - Rêve (Remastered)
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__R%C3%AAve.mp3
|
||||
#EXTINF:303,Lena Raine - Chrysopoeia
|
||||
https://draconis.me/ambient/Minecraft/Lena%20Raine__Chrysopoeia.mp3
|
||||
#EXTINF:246,Jeremy Soule - The Streets of Whiterun
|
||||
https://draconis.me/ambient/Skyrim/The_Streets_of_Whiterun.mp3
|
||||
#EXTINF:207,Vangelis - A Way
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__A_Way.mp3
|
||||
#EXTINF:236,Vangelis - At The Starting Blocks
|
||||
https://draconis.me/ambient/Best_of_Vangelis/Vangelis__At_The_Starting_Blocks.mp3
|
||||
#EXTINF:318,Lena Raine - So Below
|
||||
https://draconis.me/ambient/Minecraft/Lena%20Raine__So%20Below.mp3
|
||||
#EXTINF:312,Lena Raine - Rubedo
|
||||
https://draconis.me/ambient/Minecraft/Lena%20Raine__Rubedo.mp3
|
||||
#EXTINF:215,C418 - Sweden
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_18_Sweden.mp3
|
||||
#EXTINF:254,C418 - Danny
|
||||
https://draconis.me/ambient/C418_Minecraft/C418_21_Danny.mp3
|
||||
#EXTINF:278,Lena Raine - One More Day
|
||||
https://draconis.me/ambient/Minecraft/Lena%20Raine__One%20More%20Day.mp3
|
102
playlist_gen.php
Normal file
102
playlist_gen.php
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
/*
|
||||
Lit la liste de tous les fichiers mp3 des sous-répertoires et écrit un fichier playlist.m3u
|
||||
|
||||
Utilise la lib getid3() (http://getid3.sourceforge.net/)
|
||||
Doc: http://getid3.sourceforge.net/source/?t=structure.txt
|
||||
|
||||
*/
|
||||
error_reporting(E_ALL); ini_set('display_errors', '1');
|
||||
|
||||
header('Content-Type: text/plain;charset=UTF-8');
|
||||
if (!file_exists('getid3/getid3.php')) { die('ERROR: getid3 library is required. Download it from http://getid3.sourceforge.net/'); }
|
||||
require_once 'getid3/getid3.php';
|
||||
|
||||
function startsWith($haystack, $needle) { return strpos($haystack, $needle) === 0; }
|
||||
function endsWith($haystack, $needle) { return substr($haystack, -strlen($needle)) == $needle; }
|
||||
|
||||
/**
|
||||
* Flattens an array.
|
||||
*/
|
||||
function array_flat($array) {
|
||||
$tmp = Array();
|
||||
foreach($array as $a) {
|
||||
if(is_array($a)) {
|
||||
$tmp = array_merge($tmp, array_flat($a));
|
||||
}
|
||||
else {
|
||||
$tmp[] = $a;
|
||||
}
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recurses subdirectories and returns the list of all files contained within
|
||||
* as a flat array (1 item per file, with path)
|
||||
*/
|
||||
function getFilesFromDir($dir) {
|
||||
$files = array();
|
||||
if ($handle = opendir($dir)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != "..") {
|
||||
if(is_dir($dir.'/'.$file)) {
|
||||
$dir2 = $dir.'/'.$file;
|
||||
$files[] = getFilesFromDir($dir2);
|
||||
}
|
||||
else {
|
||||
$files[] = $dir.'/'.$file;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
$tmp = array_flat($files);
|
||||
natcasesort($tmp); // case insentitive sort.
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
$GLOBALS['TOTALTIME']=0;
|
||||
|
||||
/**
|
||||
* Builds a EXTINF line (part of m3u file format)
|
||||
* Example: #EXTINF:333,Brian Eno - Lantern Marsh
|
||||
* (333 is the duration in seconds, then Artist - Title)
|
||||
*/
|
||||
function makeEXTInfLine($filename)
|
||||
{
|
||||
$getID3 = new getID3;
|
||||
$fileinfo = $getID3->analyze($filename);
|
||||
getid3_lib::CopyTagsToComments($fileinfo); // To get id3v1 and id3v2 tags at the same place.
|
||||
$duration = (string)floor($fileinfo['playtime_seconds']);
|
||||
$GLOBALS['TOTALTIME'] += $fileinfo['playtime_seconds'];
|
||||
$artist = $fileinfo['comments']['artist'][0];
|
||||
$title = $fileinfo['comments']['title'][0];
|
||||
return '#EXTINF:'.$duration.','.$artist.' - '.$title;
|
||||
}
|
||||
/**
|
||||
* Builds a m3u playlist from all mp3 files located in a directory.
|
||||
* Returns a properly formatted m3u file.
|
||||
* Input: $dir : directory to scan.
|
||||
* $baseurl : Base URL where this directory is served.
|
||||
* Output: (string) the resulting m3u file.
|
||||
*/
|
||||
function buildM3u($dir,$baseurl)
|
||||
{
|
||||
$lines = Array();
|
||||
foreach(getFilesFromDir($dir) as $filename)
|
||||
{
|
||||
if (pathinfo($filename, PATHINFO_EXTENSION)=='mp3')
|
||||
{
|
||||
echo "Processing $filename\n";
|
||||
$lines[] = makeEXTInfLine($filename);
|
||||
$lines[] = $baseurl.substr($filename, strlen($dir));
|
||||
}
|
||||
}
|
||||
return implode("\n",$lines);
|
||||
}
|
||||
|
||||
$data = buildM3u('.','https://sebsauvage.net/ambient');
|
||||
file_put_contents('playlist.m3u',$data);
|
||||
echo 'Playlist regénérée. Durée totale (en secondes): ',$GLOBALS['TOTALTIME'];
|
||||
?>
|
80
xspf_playlist.php
Executable file
80
xspf_playlist.php
Executable file
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
/* Génère un fichier xspf minimal à partir d'un fichier .m3u
|
||||
Ce code est dans le domaine public.
|
||||
Auteur: sebsauvage at sebsauvage dot net
|
||||
|
||||
Warning: No error control (I create clean m3u files), no proper utf-8 handling.
|
||||
*/
|
||||
header('Content-Type: text/plain; charset=utf-8'); // We use UTF-8 for proper international characters handling.
|
||||
|
||||
// Tells if a string starts with a substring or not.
|
||||
function startsWith($haystack,$needle,$case=true) {
|
||||
if($case){return (strcmp(substr($haystack, 0, strlen($needle)),$needle)===0);}
|
||||
return (strcasecmp(substr($haystack, 0, strlen($needle)),$needle)===0);
|
||||
}
|
||||
|
||||
function buildTrackXspf($artist,$tracktitle,$duration,$url)
|
||||
{
|
||||
return "<track>\n<location>".htmlspecialchars(trim($url))."</location>\n<title>".htmlspecialchars(trim($tracktitle))."</title>\n<creator>".htmlspecialchars(trim($artist))."</creator>\n<duration>".$duration."000</duration>\n</track>";
|
||||
}
|
||||
|
||||
$lines = explode("\n",file_get_contents('playlist.m3u'));
|
||||
$currentline = 0;
|
||||
$nblines = count($lines);
|
||||
|
||||
/* Example line:
|
||||
#EXTINF:404,Jon Hopkins - The End
|
||||
^ ^ ^ track title
|
||||
^ ^ artist name
|
||||
^ duration (in seconds)
|
||||
The next line contains the URL.
|
||||
|
||||
This has to be transformed to:
|
||||
|
||||
<track><location>URL</location><title>Tracktitle</title><creator>Artist</creator><duration>duration</duration></track>
|
||||
*/
|
||||
$tracks = array();
|
||||
while ($currentline<$nblines ) {
|
||||
$line = $lines[$currentline];
|
||||
if (startsWith($line,'#EXTINF:')) {
|
||||
$data = substr($line, 8); // Remove #EXTINF:
|
||||
|
||||
// Extract duration (in seconds)
|
||||
$j = strpos($data,',');
|
||||
$duration = intval(substr($data, 0, $j));
|
||||
$data = substr($data, $j+1);
|
||||
|
||||
// Extract artist and track title
|
||||
$k = strpos($data, ' - ');
|
||||
$artist = substr($data, 0, $k);
|
||||
$tracktitle = substr($data, $k+3);
|
||||
|
||||
// Get URL in next line
|
||||
$url = $lines[$currentline+1];
|
||||
|
||||
$currentline = $currentline + 1;
|
||||
$tracks[] = buildTrackXspf($artist,$tracktitle,$duration,$url); // Build XSPF XML for this track
|
||||
}
|
||||
$currentline = $currentline + 1;
|
||||
}
|
||||
|
||||
shuffle($tracks);
|
||||
|
||||
|
||||
echo <<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<playlist xmlns="http://xspf.org/ns/0/" version="1">
|
||||
<title>Alternative musics for Minecraft gameplay</title>
|
||||
<trackList>
|
||||
|
||||
XML;
|
||||
foreach ($tracks as $track) {
|
||||
echo $track;
|
||||
echo "\n";
|
||||
}
|
||||
echo <<<XML
|
||||
</trackList>
|
||||
</playlist>
|
||||
XML;
|
||||
?>
|
Loading…
Add table
Reference in a new issue