示例#1
0
<?php

include "../grooveshark.class.php";
$music_path = "songs";
$gs = new GrooveShark();
$search = $argv[1];
#$artists = $gs->search($search, 'Artists');
#print_r($artists);
$songs = $gs->search($search);
print_r($songs);
<?php

include "../grooveshark.class.php";
$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];
示例#3
0
<?php

include "../grooveshark.class.php";
$gs = new GrooveShark(array());
// if they change the clientRevision or revToken this will try to find it from app.js.
#$gs->getAppData();
#$url = 'http://grooveshark.com/#/s/Cookies+With+A+Smile/3EXEk7?src=5';
#$song = $gs->getSongByUrl($url);
#print_r($gs->getSongFromToken("3EXEk7"));
#$data = $gs->getSongById($song['SongID']);
#$data = $gs->search('Cookies With A Smile');
$data = $gs->getPlaylistByID(65715998);
print_r($data['Name']);
/*	$zip = new ZipArchive();

	$playlist_id = '57895619';
	$filename = $playlist_id . '.zip';
	
	if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
	    exit("cannot create <$filename>\n");
	}
	
	#$zip->addFromString('test.txt' , 'test');
	
	get_mem();
	
	#$zip->close();
	
	function get_mem(){
		$size = memory_get_usage(true);
		$unit=array('b','kb','mb','gb','tb','pb');
<?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']}");
示例#5
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']}");