mmontag / chip-player-js

Web-based music player for a variety of video game and chiptune music formats.
https://chiptune.app
GNU General Public License v3.0
345 stars 19 forks source link

Fix inferred metadata #8

Closed mmontag closed 5 years ago

mmontag commented 5 years ago

game-music-emu sometimes finds artist metadata.

Yuzo Koshiro - The Super Three Streets of Rage II - Sega Master System / Game Gear (1993/7/23)

4 bits of information:

should be

Game Title - Track Title Composer - Game System

i.e.

Streets of Rage II - The Super Three Yuzo Koshiro - Sega Master System / Game Gear (1993/7/23)

some formats have a different set of metadata, such as MIDI, where there is virtually none. Any metadata has to be inferred from file path, which varies in use:

/Piano+E-Competition+MIDI/2014/Cheng+Guang+-+5th+Prize/Rachmaninoff+-+Prelude+in+D+Major,+Op.+23,+No.+4.mid yields

2014 - Rachmaninoff - Prelude in D Major, Op. 23, No. 4.mid Piano E-Competition MIDI

vs.

/MIDI/Frankie+Valli/December+1963+(Oh+What+a+Night).mid yields

Frankie Valli - December 1963 (Oh What a Night).mid MIDI

vs.

/Game+MIDI/Ultima+Online/CREATE1.MID

CREATE1.MID Ultima Online - Game MIDI

A solution

The metadata formatting and fallback behavior should be consolidated in one place. The app, after receiving metadata back from whichever player engine is in use, should combine the info with the file path and reconcile something. The player can return whatever sparse metadata it knows about, but the app is responsible for resolving all this to a "Title" and "Subtitle".

i.e.

getTitleAndSubtitleFromMetadataAndFilepath(metadata, filepath) {
  let title, subtitle;
  // inspect metadata
  if (metadata.artist) { ... }
  ...
  // make a decision about how to put together a title and subtitle
  return { title, subtitle };
}