Update to config version

This commit is contained in:
Tobias Hopp 2020-12-31 17:45:25 +01:00
parent 5f1635dddc
commit 7d0cc28981
5 changed files with 28 additions and 5 deletions

View File

@ -157,7 +157,14 @@ class AudioVideoHandler
private function download( $file ) private function download( $file )
{ {
echo "[INFO] Downloading $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"; echo "OK\n";
list( $artist, $title ) = explode( ' - ', $file ); list( $artist, $title ) = explode( ' - ', $file );
if ( file_exists( './downloaded.f135.mp4' ) === true ) if ( file_exists( './downloaded.f135.mp4' ) === true )

View File

@ -24,8 +24,8 @@ class Downloader
curl_setopt( $ch, CURLOPT_POSTFIELDS, curl_setopt( $ch, CURLOPT_POSTFIELDS,
http_build_query( http_build_query(
array( array(
'user' => 'trump@whitehouse.gov', 'user' => ANIMUX_USERNAME,
'userpass3' => 'C7AFvca6Ri6VhZL' 'userpass3' => ANIMUX_PASSWORD
) ) ); ) ) );
// Receive server response ... // Receive server response ...

View File

@ -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.

View File

@ -1,6 +1,12 @@
<?php <?php
// Please change the following vars before the fist start!
define( 'DOWNLOAD_PATH', 'C:/Users/hoppt/Documents/Karaoke' ); define( 'DOWNLOAD_PATH', 'C:/Users/hoppt/Documents/Karaoke' );
define( 'USE_INTERNAL_YOUTUBEDL_EXE', true );
define( 'YOUTUBE_DL_PATH', '' );
define( 'ANIMUX_USERNAME', 'trump@whitehouse.gov' );
define( 'ANIMUX_PASSWORD', 'C7AFvca6Ri6VhZL' );
mb_internal_encoding("UTF-8"); mb_internal_encoding("UTF-8");
error_reporting(0); error_reporting(0);
@ -8,5 +14,3 @@ error_reporting(0);
require_once 'AudioVideoHandler.php'; require_once 'AudioVideoHandler.php';
require_once 'Downloader.php'; require_once 'Downloader.php';
define( 'CURL_PHPSESSID', 'hi' );

BIN
youtube-dl.exe Normal file

Binary file not shown.