Example #1
0
<?php

require "phpBrainz.class.php";
$DEBUG = false;
//"true" to display full search array, "false" to display normal (human-readable) results list
$a = $_REQUEST['artist'];
$artist = !empty($a) ? $a : "Buddy Holly";
$s = $_REQUEST['song'];
$song = !empty($s) ? $s : "Weezer";
$mb = new phpBrainz();
$mb_rf = new phpBrainz_TrackFilter(array("title" => $song, "artist" => $artist));
$time1 = microtime(true);
//  print_r($mb->getASINFromTrackMBID("7a408099-5c69-4f53-8050-6b15837398d1"));
//  print_r($mb->getTrack());
$time2 = microtime(true);
$runtime = "\n" . ($time2 - $time1) . "\n";
$result = '';
?>
<form>
  <input type="text" name="artist" value="<?php 
echo $artist;
?>
" />
  <input type="text" name="song" value="<?php 
echo $song;
?>
" />
  <input type="submit" name="search" value="Search" />
</form>
<?php 
if ($DEBUG) {
<?php

require_once "../phpBrainz.class.php";
$mbid = "d615590b-1546-441d-9703-b3cf88487cbd";
$trackIncludes = array("artist", "releases", "puids");
$phpBrainz = new phpBrainz();
print_r($phpBrainz->getTrack($mbid, $trackIncludes));
Example #3
0
<?php

/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
phpBrainz is a php class for querying the musicbrainz web service.
Copyright (c) 2007 Jeff Sherlock
*/
require_once "../phpBrainz.class.php";
//Create new phpBrainz object
$phpBrainz = new phpBrainz();
$args = array("title" => "Buddy Holly", "artist" => "Weezer");
$trackFilter = new phpBrainz_TrackFilter($args);
$trackResults = $phpBrainz->findTrack($trackFilter);
echo "<pre>";
print_r($trackResults);
echo "</pre>";
<?php

/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
phpBrainz is a php class for querying the musicbrainz web service.
Copyright (c) 2007 Jeff Sherlock
*/
require_once "../phpBrainz.class.php";
//Create new phpBrainz object
$phpBrainz = new phpBrainz();
$args = array("title" => "Learn", "artist" => "Foo Fighters");
$releaseFilter = new phpBrainz_ReleaseFilter($args);
$releaseResults = $phpBrainz->findRelease($releaseFilter);
print_r($releaseResults);
 public function equals(phpBrainz_Release $compareObj)
 {
     if ($this->id == $compareObj->getId() && phpBrainz::isValidMBID($this->id) || $this->artist->equals($compareObj->getArtist()) && $this->title == $compareObj->getTitle()) {
         return true;
     }
     return false;
 }
<?php

require_once "../phpBrainz.class.php";
$mbid = "b922ff57-9289-4ea4-999e-cd4ddb986614";
$trackIncludes = array("artist", "discs", "tracks");
$phpBrainz = new phpBrainz();
print_r($phpBrainz->getRelease($mbid, $trackIncludes));
Example #7
0
<?php

require "phpBrainz.class.php";
$mb = new phpBrainz();
$mb_test = new stdClass();
$mb_rf = new phpBrainz_TrackFilter(array("title" => "Buddy Holly", "artist" => "Weezer"));
$time1 = microtime(true);
print_r($mb->findTrack($mb_rf));
//print_r($mb->getASINFromTrackMBID("7a408099-5c69-4f53-8050-6b15837398d1"));
//print_r($mb->getTrack());
$time2 = microtime(true);
print "\n" . ($time2 - $time1) . "\n";
Example #8
0
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
phpBrainz is a php class for querying the musicbrainz web service.
Copyright (c) 2007 Jeff Sherlock
*/
require_once "../phpBrainz.class.php";
//Create new phpBrainz object
$phpbrainz = new phpBrainz();
$mbid = '18de3678-655c-4cc6-aa94-097b1caab782';
$slug = 'itsabouttime';
$artist_slug = 'talklesssaymore';
// Downloads are a file path.
print $artist_slug . '/' . $slug . '/download';
// Streams are a URL.
print $artist_slug . '/' . $slug . '/stream';
print "<pre>";
print "Looking up Musicbrainz ID " . $mbid . "...";
// Include everything, why the hell not.
$trackIncludes = array("artist", "counts", "release-events", "discs", "tracks", "artist-rels", "label-rels", "release-rels", "track-rels", "url-rels", "track-level-rels", "labels");
$brainz_release = $phpbrainz->getRelease($mbid, $trackIncludes);
print "done";
print "\n\n";
$artist = $brainz_release->getArtist(1);