Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
3dc74e43b3 | |||
ce0a9f8041 | |||
15f6f4e0e8 | |||
79db89f932 | |||
d37db84faf | |||
7d0cc28981 | |||
5f1635dddc |
@ -157,7 +157,14 @@ class AudioVideoHandler
|
||||
private function download( $file )
|
||||
{
|
||||
echo "[INFO] Downloading $file...";
|
||||
exec( 'youtube-dl.exe --extract-audio --no-warnings -q --embed-thumbnail --audio-format mp3 --recode-video mp4 --audio-quality 4 -k -o downloaded.%(ext)s "ytsearch: ' . $file . '"' );
|
||||
if( USE_INTERNAL_YOUTUBEDL_EXE )
|
||||
{
|
||||
exec( __DIR__ . '/youtube-dl.exe --extract-audio --no-warnings -q --embed-thumbnail --audio-format mp3 --recode-video mp4 --audio-quality 4 -k -o downloaded.%(ext)s "ytsearch: ' . $file . '"' );
|
||||
}
|
||||
else
|
||||
{
|
||||
exec( YOUTUBE_DL_PATH . ' --extract-audio --no-warnings -q --embed-thumbnail --audio-format mp3 --recode-video mp4 --audio-quality 4 -k -o downloaded.%(ext)s "ytsearch: ' . $file . '"' );
|
||||
}
|
||||
echo "OK\n";
|
||||
list( $artist, $title ) = explode( ' - ', $file );
|
||||
if ( file_exists( './downloaded.f135.mp4' ) === true )
|
||||
|
@ -24,8 +24,8 @@ class Downloader
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS,
|
||||
http_build_query(
|
||||
array(
|
||||
'user' => 'trump@whitehouse.gov',
|
||||
'userpass3' => 'C7AFvca6Ri6VhZL'
|
||||
'user' => ANIMUX_USERNAME,
|
||||
'userpass3' => ANIMUX_PASSWORD
|
||||
) ) );
|
||||
|
||||
// Receive server response ...
|
||||
@ -115,11 +115,14 @@ class Downloader
|
||||
|
||||
|
||||
$artist = str_replace( array( '#ARTIST:', '/' ), array( '', '-' ), strtok( $out, "\n" ) );
|
||||
$artist = preg_replace( "/[^a-zA-Z0-9_.!äöü\s-]/m/u", "", $artist );
|
||||
$artist = utf8_encode( $artist );
|
||||
$artist = str_replace( array( "ö", "ä", "ü" ), array( "oe", "ae", "ue" ), $artist );
|
||||
$artist = preg_replace( '/[^a-zA-Z0-9\ \-]/', '', $artist );
|
||||
|
||||
$title = str_replace( array( '#TITLE:', '/' ), array( '', '-' ), strtok( "\n" ) );
|
||||
$title = preg_replace( "/[^a-zA-Z0-9_.!äöü\s-]/m/u", "", $title );
|
||||
|
||||
$title = utf8_encode( $title );
|
||||
$title = str_replace( array( "ö", "ä", "ü" ), array( "oe", "ae", "ue" ), $title );
|
||||
$title = preg_replace( '/[^a-zA-Z0-9\ \-]/', '', $title );
|
||||
|
||||
|
||||
echo "[INFO] Found $artist - $title\n";
|
||||
@ -154,10 +157,10 @@ class Downloader
|
||||
}
|
||||
fclose( $file );
|
||||
|
||||
echo "[SUCCESS] Downloaded \"$title - $artist\"\n";
|
||||
echo "\n[SUCCESS] Downloaded \"$title - $artist\"\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
26
GetAll.php
Normal file
26
GetAll.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
system( "clear" );
|
||||
|
||||
require_once 'config.inc.php';
|
||||
|
||||
echo "\n";
|
||||
echo "Please enter the number from->to to download karaoke-files";
|
||||
echo "\n";
|
||||
$from = readline( "@From[int] " );
|
||||
echo "\n";
|
||||
$to = readline( "@To[int] " );
|
||||
|
||||
|
||||
$downloader = new Downloader();
|
||||
for( $i=$from; $i <= $to; $i++ )
|
||||
{
|
||||
try
|
||||
{
|
||||
$downloader->requestSong( $i );
|
||||
}catch ( RuntimeException $e )
|
||||
{
|
||||
echo "An error occurred while processing the download.\n";
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
|
12
README.md
12
README.md
@ -0,0 +1,12 @@
|
||||
# Willkommen zum Karaoke-Management System von Tobias Hopp
|
||||
|
||||
- Um einen Start zu ermöglichen, muss zuerst die config.inc.php angepasst werden.
|
||||
- Für das Projekt ist die PHP-Version 7.3 empfohlen, da dieses mit ihr programmiert und getestet wurde.
|
||||
Für andere Versionen kann keine Garantie gewährleistet werden.
|
||||
|
||||
## Variablen der config.inc.php
|
||||
- DOWNLOAD_PATH: Dies ist der Pfad, der definiert wo die Dateien gespeichert werden. WICHTIG: Dieser Ordner muss lesbar und beschreibbar sein. Außerdem sollte er nicht während der Ausführung des Skripts manipuliert werden.
|
||||
- USE_INTERNAL_YOUTUBEDL_EXE: Dies ist eine Optione für Windows und Linux User. Windows-User sollten hier den Wert auf "true" belassen. Dann wird die youtube-dl.exe benutzt, welche sich bereits in dem Ordner des Programms befindet. Linux User sollten hier "false" wählen.
|
||||
- YOUTUBE_DL_PATH: Dies ist der alternative Pfad zu der youtube-dl. Wichtig hierbei ist, dass diese vom Programm ausführbar ist!
|
||||
- ANIMUX_USERNAME: Hier sollte der Benutzername eures Animux-Benutzers eingegeben werden
|
||||
- ANIMUX_PASSWORD: Hier sollte euer Passwort des Animux-Benutzers eingegeben werden.
|
@ -1,12 +1,17 @@
|
||||
<?php
|
||||
|
||||
define( 'DOWNLOAD_PATH', 'C:/Users/hoppt/Documents/Karaoke' );
|
||||
mb_internal_encoding("UTF-8");
|
||||
|
||||
// Please change the following vars before the fist start!
|
||||
define( 'DOWNLOAD_PATH', '/media/tobias/Steam-Spiel/Karaoke' );
|
||||
define( 'USE_INTERNAL_YOUTUBEDL_EXE', false );
|
||||
define( 'YOUTUBE_DL_PATH', '/usr/bin/youtube-dl' );
|
||||
define( 'ANIMUX_USERNAME', 'idiota@idi.at' );
|
||||
define( 'ANIMUX_PASSWORD', 'XANwe6ZhKCnaXky' );
|
||||
|
||||
//mb_internal_encoding("UTF-8");
|
||||
|
||||
error_reporting(0);
|
||||
|
||||
|
||||
require_once 'AudioVideoHandler.php';
|
||||
require_once 'Downloader.php';
|
||||
|
||||
define( 'CURL_PHPSESSID', 'hi' );
|
2
start.sh
Normal file
2
start.sh
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
/usr/bin/php7.3 C:\Users\hoppt\PhpstormProjects\karaoke-management\karaoke-management.php
|
BIN
youtube-dl.exe
BIN
youtube-dl.exe
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user