Update encoding

This commit is contained in:
Tobias Hopp 2021-01-01 01:04:43 +01:00
parent 79db89f932
commit 15f6f4e0e8
2 changed files with 8 additions and 9 deletions

View File

@ -115,17 +115,15 @@ class Downloader
$artist = str_replace( array( '#ARTIST:', '/' ), array( '', '-' ), strtok( $out, "\n" ) ); $artist = str_replace( array( '#ARTIST:', '/' ), array( '', '-' ), strtok( $out, "\n" ) );
$artist = utf8_encode( $artist );
$artist = str_replace( array( "ö", "ä", "ü" ), array( "oe", "ae", "ue" ), $artist ); $artist = str_replace( array( "ö", "ä", "ü" ), array( "oe", "ae", "ue" ), $artist );
$artist = preg_replace( '/[^a-zA-Z0-9\ \-]/', '', $artist );
//echo $artist;
$artistes = preg_replace( '/[^a-zA-Z0-9\ \-]/', "", $artist );
$title = str_replace( array( '#TITLE:', '/' ), array( '', '-' ), strtok( "\n" ) ); $title = str_replace( array( '#TITLE:', '/' ), array( '', '-' ), strtok( "\n" ) );
//echo $title; $title = utf8_encode( $title );
//echo "\ns$title\n";
$title = preg_replace( '/[^a-zA-Z0-9\ \-]/', '', $title );
//echo "\n$title\n";
$title = str_replace( array( "ö", "ä", "ü" ), array( "oe", "ae", "ue" ), $title ); $title = str_replace( array( "ö", "ä", "ü" ), array( "oe", "ae", "ue" ), $title );
$title = preg_replace( '/[^a-zA-Z0-9\ \-]/', '', $title );
echo "[INFO] Found $artist - $title\n"; echo "[INFO] Found $artist - $title\n";
if( is_dir( DOWNLOAD_PATH . '/' . $artist . '/' ) === false ) if( is_dir( DOWNLOAD_PATH . '/' . $artist . '/' ) === false )
@ -159,7 +157,7 @@ class Downloader
} }
fclose( $file ); fclose( $file );
echo "[SUCCESS] Downloaded \"$title - $artist\"\n"; echo "\n[SUCCESS] Downloaded \"$title - $artist\"\n";
return true; return true;
} }

View File

@ -1,4 +1,5 @@
<?php <?php
mb_internal_encoding("UTF-8");
// Please change the following vars before the fist start! // Please change the following vars before the fist start!
define( 'DOWNLOAD_PATH', '/media/tobias/Steam-Spiel/Karaoke' ); define( 'DOWNLOAD_PATH', '/media/tobias/Steam-Spiel/Karaoke' );
@ -7,7 +8,7 @@ define( 'YOUTUBE_DL_PATH', '/usr/bin/youtube-dl' );
define( 'ANIMUX_USERNAME', 'idiota@idi.at' ); define( 'ANIMUX_USERNAME', 'idiota@idi.at' );
define( 'ANIMUX_PASSWORD', 'XANwe6ZhKCnaXky' ); define( 'ANIMUX_PASSWORD', 'XANwe6ZhKCnaXky' );
mb_internal_encoding("UTF-8"); //mb_internal_encoding("UTF-8");
error_reporting(0); error_reporting(0);