Compare commits
No commits in common. "master" and "1.0.0" have entirely different histories.
@ -157,14 +157,7 @@ class AudioVideoHandler
|
|||||||
private function download( $file )
|
private function download( $file )
|
||||||
{
|
{
|
||||||
echo "[INFO] Downloading $file...";
|
echo "[INFO] Downloading $file...";
|
||||||
if( USE_INTERNAL_YOUTUBEDL_EXE )
|
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 . '"' );
|
||||||
{
|
|
||||||
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 )
|
||||||
|
@ -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' => ANIMUX_USERNAME,
|
'user' => 'trump@whitehouse.gov',
|
||||||
'userpass3' => ANIMUX_PASSWORD
|
'userpass3' => 'C7AFvca6Ri6VhZL'
|
||||||
) ) );
|
) ) );
|
||||||
|
|
||||||
// Receive server response ...
|
// Receive server response ...
|
||||||
@ -115,14 +115,11 @@ 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 = preg_replace( "/[^a-zA-Z0-9_.!äöü\s-]/m/u", "", $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 = str_replace( array( '#TITLE:', '/' ), array( '', '-' ), strtok( "\n" ) );
|
||||||
$title = utf8_encode( $title );
|
$title = preg_replace( "/[^a-zA-Z0-9_.!äöü\s-]/m/u", "", $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";
|
||||||
@ -157,7 +154,7 @@ class Downloader
|
|||||||
}
|
}
|
||||||
fclose( $file );
|
fclose( $file );
|
||||||
|
|
||||||
echo "\n[SUCCESS] Downloaded \"$title - $artist\"\n";
|
echo "[SUCCESS] Downloaded \"$title - $artist\"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
26
GetAll.php
26
GetAll.php
@ -1,26 +0,0 @@
|
|||||||
<?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
@ -1,12 +0,0 @@
|
|||||||
# 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,17 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
define( 'DOWNLOAD_PATH', 'C:/Users/hoppt/Documents/Karaoke' );
|
||||||
mb_internal_encoding("UTF-8");
|
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);
|
error_reporting(0);
|
||||||
|
|
||||||
|
|
||||||
require_once 'AudioVideoHandler.php';
|
require_once 'AudioVideoHandler.php';
|
||||||
require_once 'Downloader.php';
|
require_once 'Downloader.php';
|
||||||
|
|
||||||
|
define( 'CURL_PHPSESSID', 'hi' );
|
2
start.sh
2
start.sh
@ -1,2 +0,0 @@
|
|||||||
#!/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