Created
March 11, 2013 09:19
-
-
Save GianpaMX/5132995 to your computer and use it in GitHub Desktop.
Script para bajar música un playlistde Corona Music. Necesitas rtmpdump y avconv
Para ejecutarlo: cat response.json | php cmdownloader.php | sh
Donde response.json contiene el playlist bajado de coronamusic con el firebug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$json = file_get_contents("php://stdin"); | |
$playlist = json_decode($json); | |
foreach($playlist->items as $index => $item) { | |
$artist = $item->artistName; | |
$album = $item->albumTitle; | |
$title = $item->name; | |
$track = $index + 1; | |
$track = str_pad("$track", 2, '0', STR_PAD_LEFT); | |
$outputfilename = "$artist - $album - $track - $title.mp3"; | |
/* | |
TODO: Bajar imagen e incrustarla en cada mp3 | |
$image = array_pop($item->images); | |
$ext = pathinfo($image->url, PATHINFO_EXTENSION); | |
copy($image->url, "file.$ext"); | |
*/ | |
$url = "rtmpe://akflash.bandit.fm/ondemand/mp3:flash/srv/streamingMedia/{$item->streamingId}"; | |
$cmd = "rtmpdump -r \"$url\" -o file.flv"; | |
echo "$cmd\n"; | |
$titlemetadata = "-metadata title=\"$title\""; | |
$authormetadata = "-metadata author=\"$artist\""; | |
$albummetadata = "-metadata album=\"$album\""; | |
$trackmetadata = "-metadata track=\"$track\""; | |
$cmd = "avconv -y -i file.flv -codec:a copy $titlemetadata $authormetadata $albummetadata $trackmetadata \"$outputfilename\""; | |
echo "$cmd\n"; | |
$cmd = "rm -f file.flv"; | |
echo "$cmd\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment