diff --git a/src/utils/common.js b/src/utils/common.js index ade203a..5424a28 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -107,3 +107,67 @@ export function changeAppearance(appearance) { .querySelector('meta[name="theme-color"]') .setAttribute("content", appearance === "dark" ? "#222" : "#fff"); } + +export function splitSoundtrackAlbumTitle(title) { + let keywords = [ + "Music from the Original Motion Picture Score", + "The Original Motion Picture Soundtrack", + "Original MGM Motion Picture Soundtrack", + "Complete Original Motion Picture Score", + "Original Music From The Motion Picture", + "Original Music From The Netflix Film", + "Original Score to the Motion Picture", + "Original Motion Picture Soundtrack", + "Soundtrack from the Motion Picture", + "Original Television Soundtrack", + "Original Motion Picture Score", + "Music From the Motion Picture", + "Music From The Motion Picture", + "Complete Motion Picture Score", + "Music from the Motion Picture", + "Original Videogame Soundtrack", + "La Bande Originale du Film", + "Music from the Miniseries", + "Bande Originale du Film", + "Die Original Filmmusik", + "Original Soundtrack", + "Complete Score", + "Original Score", + ]; + for (let keyword of keywords) { + if (title.includes(keyword) === false) continue; + return { + title: title + .replace(`(${keyword})`, "") + .replace(`: ${keyword}`, "") + .replace(`[${keyword}]`, "") + .replace(`- ${keyword}`, "") + .replace(`${keyword}`, ""), + subtitle: keyword, + }; + } + return { + title: title, + subtitle: "", + }; +} + +export function splitAlbumTitle(title) { + let keywords = ["Bonus Tracks Edition", "Complete Edition", "Deluxe Edition"]; + for (let keyword of keywords) { + if (title.includes(keyword) === false) continue; + return { + title: title + .replace(`(${keyword})`, "") + .replace(`: ${keyword}`, "") + .replace(`[${keyword}]`, "") + .replace(`- ${keyword}`, "") + .replace(`${keyword}`, ""), + subtitle: keyword, + }; + } + return { + title: title, + subtitle: "", + }; +} diff --git a/src/views/album.vue b/src/views/album.vue index 7e08557..c0471a2 100644 --- a/src/views/album.vue +++ b/src/views/album.vue @@ -11,9 +11,8 @@ :id="album.id" />