Exemple #1
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>";
//  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) {
    echo $runtime . "<pre>";
    print_r($mb->findTrack($mb_rf));
    echo "</pre>";
} else {
    echo "<ul>";
    foreach ($mb->findTrack($mb_rf) as $track) {
        $releases = $track->getReleases();
        foreach ($releases as $release) {
            echo "<li><a href=\"http://musicbrainz.org/release/" . $release->getId() . "\">" . $release->getTitle() . "</a> (" . $release->getTracksCount() . " <em>tracks</em>)</li>";
        }
    }
    echo "</ul>";
}
Exemple #3
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";