PHP code example of mrfeathers / acoustid

1. Go to this page and download the library: Download mrfeathers/acoustid library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mrfeathers / acoustid example snippets


$apiKey = 'here is your api key';
$acoustidClient = AcoustidFactory::create($apiKey);

 $fingerPrintContent = 'fingerprint string generated by Chromaprint';
 $fingerPrintDuration = 100;
 
 //meta can be empty, it's not ontent, $fingerPrintDuration, $meta);
 

 foreach($resultCollection as $result) {
    //do something
 }
 

  //track id is a simple uuid string
  $trackId = '08268577-90f3-4ed5-8154-5768e2091554';
  //meta can be empty, it's not rackId, $meta);
 

 //create collection of fingerprints
 $fingerPrintCollection = new FingerPrintCollection([
    new FingerPrint('fingerprint string generated by Chromaprint', 100),
    new FingerPrint('fingerprint string generated by Chromaprint', 121),
 ]);
 
 //also you can add FingerPrint later by addFingerPrint method
 $fingerPrint = new FingerPrint('....', 200);
 
 //FingerPrint object has a lot of additional fields, that you can set calling setters
 $fingerPrint->setArtist('artist name')
    ->setAlbum('album name');
 
 $fingerPrintCollection->addFingerPrint($fingerPrint);
 
 $userApiKey = 'here is your personal user key';
 //wait is not 

//let's get submisstionCollection from the previous example
$submission = array_shift($submissionCollection);

$result = $acoustidClient->getSubmissionStatus($submission->getId());

$mbids = ['83b3d37d-8c3d-4a7b-ae9a-d635e4e3374f'];

$trackCollection = $acoustidClient->listByMBId($mbids);

//add one more mbid
$mbids[] = 'b00db402-51d2-4125-912b-c0eab9c6edd1';

//and you'll get MBIdCollection, each MBId object for each sent mbid
$mbidCollection = $acoustidClient->listByMBId($mbids);