MP3::T...DB_File(3pm)

πŸ“¦
version 1.16 Β· 2 versions
  • 1.16 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.13 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

🌸 MP3::T...DB_File(3pm) β€” the group chat version 🌸

okay so bestie, this is a page from the User Contributed Perl Documentation for MP3::T...DB_File(3pm), and yes the name is doing that thing where it gets cut off, we love that for it πŸ’…. Anyway. Let's get into it.


✨ NAME ✨

MP3::Tag::CDDB_File β€” the module that parses CDDB files. that's it, that's the whole vibe πŸŽ€


🌈 SYNOPSIS 🌈

  my $db = MP3::Tag::CDDB_File->new($filename, $track); # Name of audio file
  my $db = MP3::Tag::CDDB_File->new_from($record, $track); # Contents of CDDB

  ($title, $artist, $album, $year, $comment, $track) = $db->parse();

and also, go peek at MP3::Tag πŸ‘€


πŸ’– DESCRIPTION πŸ’–

so MP3::Tag::CDDB_File is literally designed to be called from the MP3::Tag module. it's not out here doing its own thing, it's a team player 🫢

what does it do? it parses the content of a CDDB file. iconic behavior, no notes.

where does it find that file tho? it looks in the same directory as the audio file. and the list of possible file names? that comes from the field cddb_files, but only if it was set by the MP3::Tag config() method. so like, if nobody set it, don't come crying to us πŸ™ˆ


πŸ¦‹ parse() πŸ¦‹

  ($title, $artist, $album, $year, $comment, $track) =
     $db->parse($what);

parse_filename() extracts info about artist, title, track number, album and year from the CDDB record. yes bestie, all five. ate and left no crumbs ⭐

$what is optional, and it can be one of: title, track, artist, album, year, genre or comment. if $what is defined, parse() will return only that one element. minimalism, we respect it πŸ’…

and ALSO β€” plot twist β€” $what can take these extra values too:

  • "artist_collection" β€” returns the value of artist in the disk-info field DTITLE, but only if author is specified in the track-info field TTITLE. conditional queen πŸ‘‘
  • "title_track" β€” returns the title specifically from the track-info field; the "track" may fall back to the info from the disk-info field. fallback era πŸ“
  • "comment_collection" β€” the processed EXTD comment
  • "comment_track" β€” the processed EXTT comment

the returned year and genre are taken from the DYEAR, DGENRE, EXTT, EXTD fields. the recognized prefixes in those last two fields are YEAR, ID3Y, ID3G. and bestie, the declarations of this form get stripped from the returned comment. bye, prefixes πŸ‘‹

there's also an alternative syntax that's supported: "Recorded" / "Recorded on" / "Recorded in" / β€” the format of the date recognized by ID3v2::year(), or just a date field without a prefix. versatile fr fr 🌈


πŸŽ€ title() πŸŽ€

  $title = $db->title();

returns the title, obtained from the 'Tracktitle' entry of the file. cute, short, does what it says on the tin ✨


πŸ’œ artist() πŸ’œ

  $artist = $db->artist();

returns the artist name, obtained from the 'Performer' or 'Albumperformer' entries β€” whichever one is present first wins. first come, first served, that's the rule πŸ’…


🌸 track() 🌸

  $track = $db->track();

returns the track number, which was stored during object creation, or queried from the parent. either way, you're getting your track number bestie 🫢


⭐ year() ⭐

  $year = $db->year();

returns the year, obtained from the 'Year' entry of the file. (Often not present. β€” so like, don't be shocked if it ghosts you 😭)


🧚 album() 🧚

  $album = $db->album();

returns the album name, obtained from the 'Albumtitle' entry of the file. slay πŸ‘‘


πŸ“ comment() πŸ“

  $comment = $db->comment();

returns the 'Trackcomment' entry of the file. (Often not present. β€” yeah this one's also a little flaky, just so you know πŸ’€)


πŸ”₯ genre() πŸ”₯

  $genre = $db->genre($filename);

that's the whole thing, that's the function, we don't elaborate further in this doc. mystery is part of the charm ✨


😭 POD ERRORS 😭

hey! plot twist! the above document had some coding errors, and here's the tea on them:

Around line 36: =over without closing =back

yeah. an =over with no =back. it's giving unclosed parenthesis energy. we've all been there, no judgment πŸ«ΆπŸ’€


and that's a wrap bestie!! this was perl v5.36.0, dated 2022-12-30, from the MP3::T...DB_File(3pm) era of the User Contributed Perl Documentation. go forth and parse those CDDB files, you absolute main character πŸŒŸπŸ’–πŸŽ€