Skip to content

TitleSearch Class

duck7000 edited this page Dec 28, 2024 · 27 revisions

Description of the working

You can use this class to search on musicBrainz API
Search on title, artist, barcode, discid or catno (catalog number)
You can use this python script to get the discid: https://python-discid.readthedocs.io/en/latest/ Title and Artist can be combined or used single
If only barcode, discid or catno is provided all other parameters are ignored

Calling the class

search($title, $artist, $barcode, discid)
@parameter $title input search title text
@parameter $artist input search artist text
@parameter $title input search barcode numbers
@param $discid input discid from disc
@param $catno input catalog number from disc cover

$music = new \Music\TitleSearch();
$results = $music->search("who made who", "AC/DC", "", "", ""); // title and artist
$results = $music->search("", "AC/DC", "", "", ""); // artist only
$results = $music->search("who made who", "", "", "", ""); // title only
$results = $music->search("", "", "724383065820", "", ""); // barcode: artist, title and discid are ignored
$results = $music->search("", "", "", "_Cd7d.1o6UmUZuuT9hwBXBS91KM-", ""); // discid: artist, title and barcode are ignored
$results = $music->search("", "", "", "", "74321 28981 2"); // catno: artist, title, discid and barcode are ignored

Config Options

  • $titleSearchAmount: 25 (this limits the search results), default: 25 , range:1-100 (1 and 100 included)
  • $titleSearchFormat: CD (this searches only on this format) Default: CD, (insensitive to case, spaces, and separators)
  • Possible format values:
  CD
  Digital Media
  Vinyl
  7\"%2BVinyl (7 Inch Vinyl)
  10\"%2BVinyl (10 Inch Vinyl)
  12\"%2BVinyl (12 Inch Vinyl)
  Cassette
  CD-R
  SACD
  DVD
  Other
  Blu-ray
  miniDisc
  DVD-Video
  DVD-Audio
  VHS

Results

@return Title[] array of Titles
array[]

  [0] => Array
    (
        [id] => (string) be888c7d-47a6-40e3-bea8-5bd8ac2bd339
        [title] => (string) Past Present
        [artist] => (string) Clannad
        [format] => (string) CD
        [trackCount] => (int)16
        [countryCode] => (string) XE
        [date] => (string) 1989
        [label] => Array
            (
                [0] => Array
                    (
                        [id] => 1ca5ed29-e00b-4ea5-b817-0bcca0e04946
                        [name] => RCA
                    )
            )
        [catalogNumber] => Array
            (
                [0] => 74321 28981 2
            )
        [barcode] => (string) 743212898125
        [primaryType] => (string) Album
        [secondaryType] => Array
            (
                [0] => Compilation
            )
        [status] => Official
Clone this wiki locally