Respority created
This commit is contained in:
24
umwandler.php
Normal file
24
umwandler.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
session_start();
|
||||
$db = new SQLite3("db.db");
|
||||
$result = $db->query("SELECT trackinfo FROM storage_files");
|
||||
|
||||
while($datalist = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||
$content = json_decode($datalist['trackinfo'], true);
|
||||
|
||||
$path = $content['path'];
|
||||
if(file_exists("storage/".$path)) {
|
||||
$filelocation = "storage/".$path;
|
||||
$name = $content['title'];
|
||||
|
||||
nameFile($filelocation, $name);
|
||||
}
|
||||
echo "<h1>All files in /storage renamed and fixed up. \n <p>Output is in /output/songnames/";
|
||||
$db->close();
|
||||
}
|
||||
|
||||
function nameFile($file, $name) {
|
||||
$fname = preg_replace('/[^A-Za-z0-9- \-]/', '', $name);
|
||||
rename($file, "output/".utf8_decode($fname).".mp3");
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user