Respority created

This commit is contained in:
Givou 2021-03-25 21:43:23 +01:00
commit ba57c1bb70
2 changed files with 42 additions and 0 deletions

18
README.md Normal file
View File

@ -0,0 +1,18 @@
Hey folks,
this is a very simple PHP Code that renames your Sinusbot music files back to their old name.
It only removes special chars, because that made some small errors....and it was not worth to me to fix the issues.
The Songs are still readable f.E "Udo Jrgens - Griechischer Wein HBz Hard-Bounce Remix"
How to use.
Close the respority with "git clone http://git.thiemoo.at/Givou/Sinusbot_song_renamer.git"
Go into your Sinusbot foot filesystem.
Copy your Database from /rootfs/data/db/[UUID from Instance].sqlite
Download the file and put it into the renamers main directory.
Rename it to db.db
Now download your songs from /rootfs/data/store/[UUID from Instance]/ and put them into the storage directory from the renamer.
Execute the PHP Code with "php umwandler.php" or call it in your browser
The Musik files should code up in the /output directory, if you made all steps correctly.
#Tested with Sinusbot 1.0.0-beta.10-202ee4d!

24
umwandler.php Normal file
View 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");
}
?>