forked from axiom-team/astroport
129 lines
5.3 KiB
PHP
129 lines
5.3 KiB
PHP
<?php
|
|
/*
|
|
DONE!!!? WRITE THAT CODE IN infobar2.js : arrount line 158 before "return lines;"
|
|
// ZEEBOX HACK ZONE
|
|
var reclink = '/REC/youtube-dl.php?q=REC&artist=' + escape(encodeURIComponent(npinfo.Artist)) + '&title=' + escape(encodeURIComponent(npinfo.Title)) + '&radio='+ escape(encodeURIComponent(npinfo.stream)) +'&maxResults=1';
|
|
var zcopylink = ' <a id="REC" title="Enregistrer sur Youtube" href="#" onclick=\'javascript:window.open("'+ reclink +'","REC","menubar=no, scrollbars=no, top=10, left=10, width=384, height=546");return false;\'>[REC]</a>';
|
|
zcopylink += ' <a title="RECHERCHE LIBRE" href="/REC/youtube-dl.php" target="youtube">*</a>';
|
|
lines[0].text += zcopylink;
|
|
// ZEEBOX HACK ZONE
|
|
*/
|
|
// RUN CLI if($argc>1) parse_str(implode('&',array_slice($argv, 1)), $_REQUEST);
|
|
$search=$radio=$artist=$title=$lnk=$lnkform=$cmd=$len="";
|
|
$search = trim(urldecode($_REQUEST['q']));
|
|
|
|
$radio = urldecode($_REQUEST['radio']);
|
|
$artist = urldecode($_REQUEST['artist']);
|
|
$title = urldecode($_REQUEST['title']);
|
|
$lnk = trim(urldecode($_REQUEST['lnk']));
|
|
$cmd="$radio|$artist|$title";
|
|
$len=strlen($artist.$title);
|
|
|
|
//$result='<a href="#null" onclick="javascript:window.close();"><img src="/REC/REC.png"></a><br>';
|
|
$result='<a href="https://www.copylaradio.com" target="copylaradio"><img src="/REC/REC.png"></a><br>';
|
|
if( $radio == "" ) { $radio = "CopyLaRadio"; }
|
|
if( $radio == "Nova zz" ) {
|
|
$artist = "undefined";
|
|
$title = "undefined";
|
|
}
|
|
// Write request for copy.sh triggering
|
|
if( $search == "REC" ) {
|
|
///////////////////
|
|
$result.='<h2>♫ '.$radio.' ♫</h2>';
|
|
// LINK RECEIVED
|
|
if ($lnk) {
|
|
$artist="";
|
|
shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Lien reçu."');
|
|
// Not making double request
|
|
if( ! exec('grep '.escapeshellarg($lnk).' /tmp/ytdl.list') ) {
|
|
file_put_contents("/tmp/ytdl.list","CopyLibre||$lnk\n", FILE_APPEND);
|
|
}
|
|
$result.='<p><a href="'.$lnk.'" target="check">LIEN: '.$lnk.'</a></p>';
|
|
///////////////////
|
|
// TRACK COPY (not for undefined or local file)
|
|
} else if ($radio && $artist != $title && $artist != "undefined" && $title != "undefined" && strlen(explode(".", $title)[1]) != 3 && explode(".", $title)[1] != "opus" ) {
|
|
// Not making double request
|
|
if( ! exec('grep '.escapeshellarg($cmd).' /tmp/ytdl.list') ) {
|
|
shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Enregistrement ajouté."');
|
|
file_put_contents("/tmp/ytdl.list","$cmd\n", FILE_APPEND);
|
|
} else {
|
|
shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Copie déjà lancée"');
|
|
}
|
|
$result.='<a style="color:#FFFFFF" href="https://www.youtube.com/results?search_query='.urlencode($artist).'%20'.urlencode($title).'" target="check">
|
|
<h4>'.$artist.' / '.$title.'</h4>
|
|
</a>';
|
|
///////////////////
|
|
// RADIO EXTERNAL TRACK SCRAPER
|
|
} else if($radio != "" && $artist == "undefined" && $title == "undefined" ){
|
|
shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Recherche externe pour '.$radio.'"');
|
|
file_put_contents("/tmp/youtube-dl.log", "/home/pi/G1sms+/_CopyLaRadio/libradio/".escapeshellcmd($radio).".php".PHP_EOL, FILE_APPEND);
|
|
if ( file_exists("/home/pi/G1sms+/_CopyLaRadio/libradio/".escapeshellcmd($radio).".php") ) {
|
|
file_put_contents("/tmp/ytdl.list","$radio||".PHP_EOL, FILE_APPEND);
|
|
} else {
|
|
shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Aucun module"');
|
|
}
|
|
|
|
} else {
|
|
shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Identification imprécise. Podcast? Fichier local?"');
|
|
}
|
|
|
|
}
|
|
|
|
$ytform = '<form action="/REC/youtube-dl.php" method="GET">
|
|
<div>
|
|
<h3>ARTISTE: <input type="search" id="artist" name="artist" size="17" placeholder="Indiquez un artiste" value="'.$artist.'"></h3>
|
|
<h3>TITRE: <input type="search" id="title" name="title" size="20" placeholder="Titre de la chanson" value="'.$title.'"></h3>
|
|
</div>
|
|
<input type="hidden" id="radio" name="radio" value="'.$radio.'">
|
|
<input type="hidden" id="q" name="q" value="REC">
|
|
<br>
|
|
<input type="submit" value="♫ Copie Youtube ♫">
|
|
</form>
|
|
';
|
|
|
|
$lnkform.='<form action="/REC/youtube-dl.php" method="GET">
|
|
<a href="https://youtube.com" target="search"><img src="/REC/youtube.png"></a>
|
|
<p><h1>youtube-dl</h1>
|
|
<a style="color:#FFFFFF" href="https://ytdl-org.github.io/youtube-dl/supportedsites.html" target="_blank">- Sites compatibles -</a>
|
|
<input type="search" id="lnk" name="lnk" placeholder="Inscrivez le lien à copier" value="" size="40">
|
|
<input type="hidden" id="q" name="q" value="REC">
|
|
</p>
|
|
<div>
|
|
<input type="submit" value="Copie du Lien">
|
|
</div>
|
|
</form>';
|
|
|
|
?>
|
|
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="description" content="">
|
|
<meta name="author" content="fred" >
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
|
|
<title><?php echo $search;?> - Recherche YouTube & Copie privée</title>
|
|
<link href="/REC/bootstrap.css" rel="stylesheet">
|
|
</head>
|
|
<body style='background: url("/REC/fond.jpg") no-repeat scroll center center / cover rgb(0, 0, 0); color:#FFFFFF;'>
|
|
<section class="content-section text-center">
|
|
<div class="container-fluid">
|
|
<div class="container" id="result" >
|
|
<div class="col-lg-8 col-lg-offset-2 page-scroll">
|
|
<ul>
|
|
<?php echo $result; ?>
|
|
<hr>
|
|
</ul>
|
|
<ul>
|
|
<?php echo $ytform; ?>
|
|
<hr>
|
|
<?php echo $lnkform; ?>
|
|
<hr>
|
|
</ul>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</body>
|
|
</html>
|