Пример #1
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');
include "../grooveshark.class.php";
$gs = new GrooveShark();
$url = 'http://grooveshark.com/s/1980/2JS6Dg?src=5';
# look up the son URL then get the download URL.
$song = $gs->getSongByUrl($url);
$data = $gs->getSongById($song['SongID']);
# push the file name in the header
$filename = "{$song['ArtistName']} - {$song['Name']}.mp3";
header("Content-Disposition: attachment; filename={$filename}");
#	passthru("wget -qO- {$data['url']}");
Пример #2
0
$music_path = "songs";
// remove memry limits
ini_set('memory_limit', -1);
$gs = new GrooveShark();
$playlist_id = $argv[1];
$playlist = $gs->getPlaylistByID($playlist_id);
$songs = $playlist['Songs'];
echo "Downloading playlist: {$playlist['Name']}\n";
$filename = $playlist_id . '.zip';
$zip = new ZipArchive();
# open or create a zip file by the playlist id number
foreach ($songs as $song) {
    if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) {
        exit("cannot create <{$filename}>\n");
    }
    $songs_info = $gs->getSongById($song['SongID']);
    $file_name = $song['Name'] . ".mp3";
    passthru("wget -O \"{$music_path}/{$file_name}\" {$songs_info['url']}");
    echo "Downloading file: {$file_name} from url: {$songs_info['url']} \n";
    #$zip->addFromString($file_name , file_get_contents($songs_info['url']));
    #$zip->close();
}
echo "Created file: {$filename}\ndone.\n";
function get_mem()
{
    $size = memory_get_usage(true);
    $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
    $size = @round($size / pow(1024, $i = floor(log($size, 1024))), 2) . ' ' . $unit[$i];
    echo "Mem: {$size}\n";
    // 123 kb
}
Пример #3
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');
include "../grooveshark.class.php";
$music_path = "../assets/music/";
$gs = new GrooveShark();
#	$url = 'http://grooveshark.com/s/1980/2JS6Dg?src=5';
# look up the son URL then get the download URL.
#	$song = $gs->getSongByUrl($url);
$data = $gs->getSongById('28470323');
echo "\n" . $data['url'] . "\n";
#passthru("nvlc -I dummy --play-and-exit " . $data['url'] . '--sout \'#standard{access=http,mux=ogg,dst=localhost:8080}\'');
# push the file name in the header
#	$filename = "{$song['ArtistName']} - {$song['Name']}.mp3";
#	if (!is_dir($music_path)) {
#		mkdir($music_path, 0700, true);
#	}
#	$filename = str_replace(' ','\ ', $filename);
#	print $filename;
#	print "\n";
#	print "{$data['url']}\n";
#	header("Content-Disposition: attachment; filename={$filename}");
#	passthru("wget -O $music_path/{$filename} {$data['url']}");