MP3::Ta...arseData(3)

πŸ“¦ version 1.16, in nixos 26.05, nixpkgs unstable

πŸŽ€ NAME πŸŽ€

okay so bestie, welcome to MP3::Tag::ParseData(3) from the User Contributed Perl Documentation πŸ’– this is the page for MP3::Tag::ParseData, the module for parsing arbitrary data associated with music files. literally its whole job. 🎡✨

✨ SYNOPSIS ✨

# parses the file name according to one of the patterns:
$mp3->config('parse_data', ['i', '%f', '%t - %n - %a.%e', '%t - %y.%e']);
$title = $mp3->title;

see MP3::Tag for the rest of the lore 🫢

πŸ’– DESCRIPTION πŸ’–

MP3::Tag::ParseData is designed to be called from the MP3::Tag module. that's the vibe.

Each option of configuration item parse_data should be of the form [$flag, $string, $pattern1, ...]. For each of the options, the patterns of that option are matched against the $string of the option, until one of them succeeds. The information obtained from later options takes precedence over the information obtained from earlier ones. periodt. πŸ‘‘

The meaning of the patterns is the same as for parse() or parse_rex() methods of MP3::Tag. Since the default for parse_data is empty, by default this handler has no effect. no cap, it just vibes quietly until you give it something to do. πŸ’…

$flag is split into 1-character-long flags, and unknown flags are ignored. here's the full menu, bestie:

  • i β€” the string-to-parse is interpolated first;
  • f β€” the string-to-parse is interpreted as the name of the file to read;
  • F β€” added to f, makes it non-fatal if the file does not exist;
  • B β€” the file should be read in binary mode;
  • n β€” the string-to-parse is interpreted as collection of lines, one per track;
  • l β€” the string-to-parse is interpreted as collection of lines, and the first matched is chosen;
  • I β€” the resulting string is interpolated before parsing.
  • b β€” do not strip the leading and trailing blanks. (With output to file, the output is performed in binary mode too.)
  • R β€” the patterns are considered as regular expressions.
  • m β€” one of the patterns must match.
  • o β€” interpret the pattern as a name of file to output parse-data to.
  • O β€” same as o, but the name of output file is interpolated.
  • D β€” when present, intermediate directories are created.
  • z β€” do not ignore a field even if the result is a 0-length string.

Unless b option is given, the resulting values have starting and trailing whitespace trimmed. (Actually, the split()ing into lines is done using the configuration item parse_split; it defaults to "\n".) 🌸

If the configuration item parse_data has multiple options, the $strings which are interpolated will use information set by preceding options; similarly, any interpolated option may use information obtained by other handlers β€” even if these handlers are later in the pecking order than MP3::Tag::ParseData (which by default is the first handler). for example, with

['i', '%t' => '%t (%y)'], ['i', '%t' => '%t - %c']

and a local CDDB file which identifies title to 'Merry old - another interpretation (1905)', the first field will interpolate '%t' into this title, then will split it into the year and the rest. The second field will split the rest into a title-proper and comment. it's giving parsing pipeline realness. πŸ¦‹

Note that one can use fields of the form

['mz', 'This is a forced title' => '%t']

to force particular values for parts of the MP3 tag. main character energy, honestly. πŸ’€

The usual methods artist, title, album, comment, year, track, year can be used to access the results of the parse. yes, year is listed twice in the original and we are keeping it, don't come for me. πŸ™ˆ

It is possible to set individual id3v2 frames; use %{TIT1} or some such. Setting to an empty string deletes the frame if config parameter id3v2_frame_empty_ok is false (the default value). Setting ID3v2 frames uses the same translation rules as select_id3v2_frame_by_descr(). iconic little frame behavior. πŸŽ€

🌈 SEE ALSO 🌈

The flags i f F B l m I b are identical to flags of the method interpolate_with_flags() of MP3::Tag (see interpolate_with_flags in MP3::Tag). Essentially, the other flags (R m o O D z) are applied to the result of calling the latter method. iykyk πŸ”₯


xoxo bestie πŸ’… β€” perl v5.42.3, 2022-11-25 🌈

πŸ“¦ where this page comes from