Skip to content

Commit 3efd560

Browse files
committed
feat(ototoy): retain original release date
1 parent ab99fc3 commit 3efd560

File tree

8 files changed

+18
-10
lines changed

8 files changed

+18
-10
lines changed

providers/Ototoy/json_types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export interface PackagePage {
77
export interface AlbumMeta {
88
title: string;
99
artists: Artist[];
10-
releaseDate: string;
10+
originalReleaseDate?: string;
11+
releaseDate?: string;
1112
label?: Label;
1213
}
1314

providers/Ototoy/mod.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ export default class OtotoyProvider extends MetadataProvider {
253253
// * The release can have an "original" release date, a platform release date, or both. "Release date" is the preferred date.
254254
// * In the case that only one date is present, sometimes "Original" is used, sometimes not. Whatever's available will
255255
// be used.
256+
// * In the case of releases with only an "Original" date (e.g. https://ototoy.jp/_/default/p/1822344), that date seems
257+
// to represent both the original and platform release dates.
256258
parseAlbumMeta(doc: HTMLDocument): AlbumMeta | undefined {
257259
const albumMetadata = doc.querySelector('div.album-meta-data');
258260
if (!albumMetadata) return undefined;
@@ -291,20 +293,20 @@ export default class OtotoyProvider extends MetadataProvider {
291293

292294
releaseElements.forEach((el) => {
293295
const text = el.textContent.trim();
296+
console.log(text);
294297
if (text.startsWith('Original release date:')) {
295298
originalReleaseDate = text.replace('Original release date:', '').trim();
296299
} else if (text.startsWith('Release date:')) {
297300
releaseDate = text.replace('Release date:', '').trim();
298301
}
299302
});
300303

301-
releaseDate = releaseDate || originalReleaseDate;
302-
if (!releaseDate) return undefined;
303304

304305
const albumMeta: AlbumMeta = {
305306
title,
306307
artists,
307308
releaseDate,
309+
originalReleaseDate,
308310
};
309311

310312
const labelAnchor = details.querySelector('p.label-name > a');
@@ -371,11 +373,16 @@ export class OtotoyReleaseLookup extends ReleaseLookup<OtotoyProvider, PackagePa
371373
convertRawRelease(albumPage: PackagePage): HarmonyRelease {
372374
const { albumMeta, trackList } = albumPage;
373375

376+
// OTOTOY might only provide one type of date, see `parseAlbumMeta()`
377+
//
378+
// For now, `originalReleaseDate` has no special interpretation, and is just used as a fallback when there's no
379+
// platform release date specified.
380+
const releaseDate = albumMeta.releaseDate || albumMeta.originalReleaseDate;
374381
const release: HarmonyRelease = {
375382
title: albumMeta.title,
376383
artists: albumMeta.artists.map(this.convertRawArtist.bind(this)),
377384
labels: albumMeta.label ? [this.convertRawLabel(albumMeta.label)] : undefined,
378-
releaseDate: parseISODateTime(albumMeta.releaseDate),
385+
releaseDate: releaseDate ? parseISODateTime(releaseDate) : undefined,
379386
media: this.convertRawTracklist(trackList),
380387
status: 'Official',
381388
packaging: 'None',
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"thumbUrl":"https://imgs.ototoy.jp/imgs/jacket/1822/00000003.1695204881.8512_320.jpg","albumMeta":{"title":"THE BOOK 3","artists":[{"name":"YOASOBI","url":"https://ototoy.jp/_/default/a/731939"}],"releaseDate":"2023-10-04","label":{"name":"YOASOBI","url":"https://ototoy.jp/labels/856521","catalogNumber":"YOASOBI-081"}},"trackList":[{"title":"勇者","trackNumber":1,"duration":194},{"title":"Interlude \"Awakening\"","trackNumber":2,"duration":48},{"title":"祝福","trackNumber":3,"duration":192},{"title":"海のまにまに","trackNumber":4,"duration":256},{"title":"ミスター","trackNumber":5,"duration":185},{"title":"Interlude \"Worship\"","trackNumber":6,"duration":67},{"title":"アイドル","trackNumber":7,"duration":211},{"title":"セブンティーン","trackNumber":8,"duration":198},{"title":"アドベンチャー","trackNumber":9,"duration":198},{"title":"好きだ","trackNumber":10,"duration":217}]}
1+
{"thumbUrl":"https://imgs.ototoy.jp/imgs/jacket/1822/00000003.1695204881.8512_320.jpg","albumMeta":{"title":"THE BOOK 3","artists":[{"name":"YOASOBI","url":"https://ototoy.jp/_/default/a/731939"}],"originalReleaseDate":"2023-10-04","label":{"name":"YOASOBI","url":"https://ototoy.jp/labels/856521","catalogNumber":"YOASOBI-081"}},"trackList":[{"title":"勇者","trackNumber":1,"duration":194},{"title":"Interlude \"Awakening\"","trackNumber":2,"duration":48},{"title":"祝福","trackNumber":3,"duration":192},{"title":"海のまにまに","trackNumber":4,"duration":256},{"title":"ミスター","trackNumber":5,"duration":185},{"title":"Interlude \"Worship\"","trackNumber":6,"duration":67},{"title":"アイドル","trackNumber":7,"duration":211},{"title":"セブンティーン","trackNumber":8,"duration":198},{"title":"アドベンチャー","trackNumber":9,"duration":198},{"title":"好きだ","trackNumber":10,"duration":217}]}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"thumbUrl":"https://imgs.ototoy.jp/imgs/jacket/3016/00000003.1756598333.417_320.jpg","albumMeta":{"title":"トゥイー・ボックスの人形劇場","artists":[{"name":"sasakure.UK","url":"https://ototoy.jp/_/default/a/153628"}],"releaseDate":"2025-09-01","label":{"name":"sasakuration","url":"https://ototoy.jp/labels/215734"}},"trackList":[{"title":"トゥイー・ボックスの人形劇場","trackNumber":1,"duration":238}]}
1+
{"thumbUrl":"https://imgs.ototoy.jp/imgs/jacket/3016/00000003.1756598333.417_320.jpg","albumMeta":{"title":"トゥイー・ボックスの人形劇場","artists":[{"name":"sasakure.UK","url":"https://ototoy.jp/_/default/a/153628"}],"originalReleaseDate":"2025-09-01","label":{"name":"sasakuration","url":"https://ototoy.jp/labels/215734"}},"trackList":[{"title":"トゥイー・ボックスの人形劇場","trackNumber":1,"duration":238}]}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"thumbUrl":"https://imgs.ototoy.jp/imgs/jacket/3228/00000003.3228080.1763569536.7217_320.jpg","albumMeta":{"title":"UNTIL","artists":[{"name":"Benjazzy","url":"https://ototoy.jp/_/default/a/666017"}],"releaseDate":"2025-11-19"},"trackList":[{"title":"UNITE","trackNumber":1,"duration":212},{"title":"BLINDLY","trackNumber":2,"duration":207},{"title":"TRAUMATIC","trackNumber":3,"duration":192},{"title":"NOOFFSEASON (feat. Watson, MIKADO & ¥ellow Bucks)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/963757","name":"Watson"},{"url":"https://ototoy.jp/_/default/a/725029","name":"MIKADO"},{"url":"https://ototoy.jp/_/default/a/671436","name":"¥ellow Bucks"}],"trackNumber":4,"duration":314},{"title":"1 2 3 (feat. CFN MALIK)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/1337903","name":"CFN MALIK"}],"trackNumber":5,"duration":186},{"title":"PRIDE","trackNumber":6,"duration":239},{"title":"WWW (feat. Bonbero)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/693436","name":"Bonbero"}],"trackNumber":7,"duration":212},{"title":"UWASA (feat. JP THE WAVY)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/343797","name":"JP THE WAVY"}],"trackNumber":8,"duration":186},{"title":"シケモク (feat. Daichi Yamamoto)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/464312","name":"Daichi Yamamoto"}],"trackNumber":9,"duration":221},{"title":"NEVER CHANGE (feat. SZK)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/1569279","name":"SZK"}],"trackNumber":10,"duration":227},{"title":"HATERS","trackNumber":11,"duration":137},{"title":"LIFE LINE","trackNumber":12,"duration":199},{"title":"THE BALANCE (feat. 般若)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/214647","name":"般若"}],"trackNumber":13,"duration":192},{"title":"UNTIL","trackNumber":14,"duration":308}]}
1+
{"thumbUrl":"https://imgs.ototoy.jp/imgs/jacket/3228/00000003.3228080.1763569536.7217_320.jpg","albumMeta":{"title":"UNTIL","artists":[{"name":"Benjazzy","url":"https://ototoy.jp/_/default/a/666017"}],"originalReleaseDate":"2025-11-19"},"trackList":[{"title":"UNITE","trackNumber":1,"duration":212},{"title":"BLINDLY","trackNumber":2,"duration":207},{"title":"TRAUMATIC","trackNumber":3,"duration":192},{"title":"NOOFFSEASON (feat. Watson, MIKADO & ¥ellow Bucks)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/963757","name":"Watson"},{"url":"https://ototoy.jp/_/default/a/725029","name":"MIKADO"},{"url":"https://ototoy.jp/_/default/a/671436","name":"¥ellow Bucks"}],"trackNumber":4,"duration":314},{"title":"1 2 3 (feat. CFN MALIK)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/1337903","name":"CFN MALIK"}],"trackNumber":5,"duration":186},{"title":"PRIDE","trackNumber":6,"duration":239},{"title":"WWW (feat. Bonbero)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/693436","name":"Bonbero"}],"trackNumber":7,"duration":212},{"title":"UWASA (feat. JP THE WAVY)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/343797","name":"JP THE WAVY"}],"trackNumber":8,"duration":186},{"title":"シケモク (feat. Daichi Yamamoto)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/464312","name":"Daichi Yamamoto"}],"trackNumber":9,"duration":221},{"title":"NEVER CHANGE (feat. SZK)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/1569279","name":"SZK"}],"trackNumber":10,"duration":227},{"title":"HATERS","trackNumber":11,"duration":137},{"title":"LIFE LINE","trackNumber":12,"duration":199},{"title":"THE BALANCE (feat. 般若)","artists":[{"url":"https://ototoy.jp/_/default/a/666017","name":"Benjazzy"},{"url":"https://ototoy.jp/_/default/a/214647","name":"般若"}],"trackNumber":13,"duration":192},{"title":"UNTIL","trackNumber":14,"duration":308}]}

testdata/https!/jp.ototoy/_/default/p/3237840

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"thumbUrl":"https://imgs.ototoy.jp/imgs/jacket/3286/00000003.3286704.1765252577.9614_320.jpg","albumMeta":{"title":"Friends","artists":[{"name":"Various Artists","url":"https://ototoy.jp/_/default/a/375396"}],"releaseDate":"2025-12-12"},"trackList":[{"title":"arigato","artists":[{"url":"https://ototoy.jp/_/default/a/880492","name":"ZトN"}],"trackNumber":1,"duration":184},{"title":"yami yami","artists":[{"url":"https://ototoy.jp/_/default/a/880492","name":"ZトN"},{"url":"https://ototoy.jp/_/default/a/1851346","name":"5NBi"}],"trackNumber":2,"duration":146},{"title":"Believer","artists":[{"url":"https://ototoy.jp/_/default/a/880492","name":"ZトN"},{"url":"https://ototoy.jp/_/default/a/807897","name":"KUNG-FU"}],"trackNumber":3,"duration":192},{"title":"籠球Pick&Roll","artists":[{"url":"https://ototoy.jp/_/default/a/880492","name":"ZトN"},{"url":"https://ototoy.jp/_/default/a/1851348","name":"retio"}],"trackNumber":4,"duration":170},{"title":"kaisou (Remix)","artists":[{"url":"https://ototoy.jp/_/default/a/880492","name":"ZトN"},{"url":"https://ototoy.jp/_/default/a/1329419","name":"Sun'Tiger"}],"trackNumber":5,"duration":148},{"title":"i'm in Luv (Remix)","artists":[{"url":"https://ototoy.jp/_/default/a/880492","name":"ZトN"},{"url":"https://ototoy.jp/_/default/a/807897","name":"KUNG-FU"},{"url":"https://ototoy.jp/_/default/a/1258599","name":"sumiya takuro"}],"trackNumber":6,"duration":280}]}
1+
{"thumbUrl":"https://imgs.ototoy.jp/imgs/jacket/3286/00000003.3286704.1765252577.9614_320.jpg","albumMeta":{"title":"Friends","artists":[{"name":"Various Artists","url":"https://ototoy.jp/_/default/a/375396"}],"originalReleaseDate":"2025-12-12"},"trackList":[{"title":"arigato","artists":[{"url":"https://ototoy.jp/_/default/a/880492","name":"ZトN"}],"trackNumber":1,"duration":184},{"title":"yami yami","artists":[{"url":"https://ototoy.jp/_/default/a/880492","name":"ZトN"},{"url":"https://ototoy.jp/_/default/a/1851346","name":"5NBi"}],"trackNumber":2,"duration":146},{"title":"Believer","artists":[{"url":"https://ototoy.jp/_/default/a/880492","name":"ZトN"},{"url":"https://ototoy.jp/_/default/a/807897","name":"KUNG-FU"}],"trackNumber":3,"duration":192},{"title":"籠球Pick&Roll","artists":[{"url":"https://ototoy.jp/_/default/a/880492","name":"ZトN"},{"url":"https://ototoy.jp/_/default/a/1851348","name":"retio"}],"trackNumber":4,"duration":170},{"title":"kaisou (Remix)","artists":[{"url":"https://ototoy.jp/_/default/a/880492","name":"ZトN"},{"url":"https://ototoy.jp/_/default/a/1329419","name":"Sun'Tiger"}],"trackNumber":5,"duration":148},{"title":"i'm in Luv (Remix)","artists":[{"url":"https://ototoy.jp/_/default/a/880492","name":"ZトN"},{"url":"https://ototoy.jp/_/default/a/807897","name":"KUNG-FU"},{"url":"https://ototoy.jp/_/default/a/1258599","name":"sumiya takuro"}],"trackNumber":6,"duration":280}]}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"thumbUrl":"https://imgs.ototoy.jp/imgs/jacket/0709/00000003.1614153884.5336_320.jpg","albumMeta":{"title":"Gimme吟味virtuaる最高star!!!! (feat. さくらみこ, 白上フブキ, 夏色まつり & 宝鐘マリン)","artists":[{"name":"sasakure.UK","url":"https://ototoy.jp/_/default/a/153628"},{"name":"さくらみこ","url":"https://ototoy.jp/_/default/a/818883"},{"name":"白上フブキ","url":"https://ototoy.jp/_/default/a/693805"},{"name":"夏色まつり","url":"https://ototoy.jp/_/default/a/817278"},{"name":"宝鐘マリン","url":"https://ototoy.jp/_/default/a/799749"}],"releaseDate":"2021-02-25","label":{"name":"sasakuration","url":"https://ototoy.jp/labels/215734"}},"trackList":[{"title":"Gimme吟味virtuaる最高star!!!! (feat. さくらみこ, 白上フブキ, 夏色まつり & 宝鐘マリン)","trackNumber":1,"duration":223}]}
1+
{"thumbUrl":"https://imgs.ototoy.jp/imgs/jacket/0709/00000003.1614153884.5336_320.jpg","albumMeta":{"title":"Gimme吟味virtuaる最高star!!!! (feat. さくらみこ, 白上フブキ, 夏色まつり & 宝鐘マリン)","artists":[{"name":"sasakure.UK","url":"https://ototoy.jp/_/default/a/153628"},{"name":"さくらみこ","url":"https://ototoy.jp/_/default/a/818883"},{"name":"白上フブキ","url":"https://ototoy.jp/_/default/a/693805"},{"name":"夏色まつり","url":"https://ototoy.jp/_/default/a/817278"},{"name":"宝鐘マリン","url":"https://ototoy.jp/_/default/a/799749"}],"originalReleaseDate":"2021-02-25","label":{"name":"sasakuration","url":"https://ototoy.jp/labels/215734"}},"trackList":[{"title":"Gimme吟味virtuaる最高star!!!! (feat. さくらみこ, 白上フブキ, 夏色まつり & 宝鐘マリン)","trackNumber":1,"duration":223}]}

0 commit comments

Comments
 (0)