diff --git a/content/notes/twitter/6461762496/index.md b/content/notes/twitter/6461762496/index.md index 08a5a9e5..a206b6d0 100644 --- a/content/notes/twitter/6461762496/index.md +++ b/content/notes/twitter/6461762496/index.md @@ -8,4 +8,4 @@ tags: --- likes Bop 'Enjoy The Moment' (Thinnen Remix) [Remix Competition Winner] by Med School Music -{{< soundcloud path="/tracks/986177" artist="Med School Music" title="Bop 'Enjoy The Moment'" url="https://songwhip.com/medschoolmusic/bop-enjoy-the-moment-remix-competition-winner">}} +{{< music "66a4bf39-d0f4-4006-b649-21808845b3bf" >}} diff --git a/data/music/musicbrainz/013efa85-b7f5-4f95-809b-ff47c53726a9.json b/data/music/musicbrainz/013efa85-b7f5-4f95-809b-ff47c53726a9.json index 898d3efd..c0b6a6ce 100644 --- a/data/music/musicbrainz/013efa85-b7f5-4f95-809b-ff47c53726a9.json +++ b/data/music/musicbrainz/013efa85-b7f5-4f95-809b-ff47c53726a9.json @@ -2,7 +2,9 @@ "title": "Get A Wiggle On", "artist": "HENGE", "musicbrainz": "https://musicbrainz.org/recording/013efa85-b7f5-4f95-809b-ff47c53726a9", - "spotify": "https://open.spotify.com/track/62sJsTpsZ81vLnJQ0xuqWY", - "applemusic": "https://music.apple.com/gbus/song/1668860445", - "youtubemusic": "https://music.youtube.com/watch?v=1BQviCBPMSk" + "links": [ + "https://open.spotify.com/track/62sJsTpsZ81vLnJQ0xuqWY", + "https://music.apple.com/gb/song/1668860445", + "https://music.youtube.com/watch?v=1BQviCBPMSk" + ] } diff --git a/data/music/musicbrainz/31387690-27f2-4966-95e3-eaf83192378e.json b/data/music/musicbrainz/31387690-27f2-4966-95e3-eaf83192378e.json index a920e263..f3ad7d0c 100644 --- a/data/music/musicbrainz/31387690-27f2-4966-95e3-eaf83192378e.json +++ b/data/music/musicbrainz/31387690-27f2-4966-95e3-eaf83192378e.json @@ -2,7 +2,9 @@ "title": "Peach", "artist": "salute", "musicbrainz": "https://musicbrainz.org/recording/31387690-27f2-4966-95e3-eaf83192378e", - "spotify": "https://open.spotify.com/track/5cGZN0P1QnSfhCFBCHtp2N", - "applemusic": "https://music.apple.com/gb/album/peach/1676610854?i=1676611187", - "youtubemusic": "https://music.youtube.com/watch?v=4SOeAzErjxM" + "links": [ + "https://open.spotify.com/track/5cGZN0P1QnSfhCFBCHtp2N", + "https://music.apple.com/gb/album/peach/1676610854?i=1676611187", + "https://music.youtube.com/watch?v=4SOeAzErjxM" + ] } diff --git a/data/music/musicbrainz/66a4bf39-d0f4-4006-b649-21808845b3bf.json b/data/music/musicbrainz/66a4bf39-d0f4-4006-b649-21808845b3bf.json new file mode 100644 index 00000000..2610fe89 --- /dev/null +++ b/data/music/musicbrainz/66a4bf39-d0f4-4006-b649-21808845b3bf.json @@ -0,0 +1,12 @@ +{ + "title": "Enjoy the Moment (Thinnen remix)", + "artist": "BOP", + "musicbrainz": "https://musicbrainz.org/recording/66a4bf39-d0f4-4006-b649-21808845b3bf", + "links": [ + "https://open.spotify.com/track/09kytpdyU1kz9kMXTh2xsf", + "https://soundcloud.com/medschoolmusic/bop-enjoy-the-moment-thinnen-remix-competition-winner", + "https://music.apple.com/gb/song/1686476816", + "https://music.youtube.com/watch?v=JjNtkLIiC18" + ], + "soundcloudtrackid": "986177" +} diff --git a/data/music/musicbrainz/bfbd2167-db3a-469a-a0a3-3fdeacbd4344.json b/data/music/musicbrainz/bfbd2167-db3a-469a-a0a3-3fdeacbd4344.json index a079f47d..753cb560 100644 --- a/data/music/musicbrainz/bfbd2167-db3a-469a-a0a3-3fdeacbd4344.json +++ b/data/music/musicbrainz/bfbd2167-db3a-469a-a0a3-3fdeacbd4344.json @@ -3,7 +3,9 @@ "artist": "Borodin Quartet", "composer": "Alexander Borodin", "musicbrainz": "https://musicbrainz.org/recording/bfbd2167-db3a-469a-a0a3-3fdeacbd4344", - "spotify": "https://open.spotify.com/track/7Hi4r3EULEJfLrwli8iw5Q", - "applemusic": "https://music.apple.com/gb/album/string-quartet-no-2-in-d-major-iii-nocturne-andante/1452699105?i=1452699113", - "youtubemusic": "https://music.youtube.com/watch?v=T1aZdvRWEcc&si=HVI4SivmbVCa9Jev" + "links": [ + "https://open.spotify.com/track/7Hi4r3EULEJfLrwli8iw5Q", + "https://music.apple.com/gb/album/string-quartet-no-2-in-d-major-iii-nocturne-andante/1452699105?i=1452699113", + "https://music.youtube.com/watch?v=T1aZdvRWEcc" + ] } diff --git a/data/music/musicbrainz/e0de1616-0514-43b3-a2ce-9e7cf0fc1e64.json b/data/music/musicbrainz/e0de1616-0514-43b3-a2ce-9e7cf0fc1e64.json index e859f0c1..00909294 100644 --- a/data/music/musicbrainz/e0de1616-0514-43b3-a2ce-9e7cf0fc1e64.json +++ b/data/music/musicbrainz/e0de1616-0514-43b3-a2ce-9e7cf0fc1e64.json @@ -2,7 +2,9 @@ "album": "Kaleidoscope", "artist": "Kelis", "musicbrainz": "https://musicbrainz.org/release/e0de1616-0514-43b3-a2ce-9e7cf0fc1e64", - "spotify": "https://open.spotify.com/album/33viW1sFm3sCCmzs7FZ9MI", - "applemusic": "https://music.apple.com/gb/album/kaleidoscope-expanded-edition/1712490712", - "youtubemusic": "https://music.youtube.com/playlist?list=OLAK5uy_kkW-cvsQIeox0qb4BREdvllFVaIZy9A30" + "links": [ + "https://open.spotify.com/album/33viW1sFm3sCCmzs7FZ9MI", + "https://music.apple.com/gb/album/kaleidoscope-expanded-edition/1712490712", + "https://music.youtube.com/playlist?list=OLAK5uy_kkW-cvsQIeox0qb4BREdvllFVaIZy9A30" + ] } diff --git a/layouts/shortcodes/music.html b/layouts/shortcodes/music.html index be5a1376..199a5440 100644 --- a/layouts/shortcodes/music.html +++ b/layouts/shortcodes/music.html @@ -3,16 +3,38 @@ {{- $displayArtist := .composer | default .artist -}} {{- $displayTitle := .title | default .album -}} {{- $musicbrainz := .musicbrainz -}} - {{- with .spotify -}} + {{- $klass := "" -}} + {{- $embed := "" -}} + + {{- range .links -}} {{- $u := urls.Parse . -}} -
- -
- 🎶 {{ $displayArtist }}{{ with $displayTitle }}{{ if $displayArtist }}: {{ end }}{{ . }}{{ end }}
- {{ with $musicbrainz }}Listen elsewhere{{ end }} -
-
+ + {{- if eq $u.Hostname "sopen.spotify.com" -}} + {{- $klass = "spotify" -}} + {{- $embed = printf "" $u.Path -}} + {{- break -}} + + {{- else if eq $u.Hostname "smusic.apple.com" -}} + {{- $klass = "apple-music" -}} + {{- $embed = printf "" $u.Path -}} + {{- break -}} + + {{- else if and (eq $u.Hostname "soundcloud.com") (isset $data "soundcloudtrackid") -}} + {{- $klass = "soundcloud" -}} + {{- $embed = printf "" $data.soundcloudtrackid -}} + {{- break -}} + + {{- end -}} + {{- end -}} + +
+ {{ $embed | safeHTML }} +
+ 🎶 {{ $displayArtist }}{{ with $displayTitle }}{{ if $displayArtist }}: {{ end }}{{ . }}{{ end }}
+ {{ with $musicbrainz }}Listen elsewhere{{ end }} +
+
{{- else -}} {{ errorf "Missing musicbrainz data for %s" (.Get 0) }} {{- end -}} diff --git a/todo.md b/todo.md index 71ea4026..c527af76 100644 --- a/todo.md +++ b/todo.md @@ -29,7 +29,13 @@ Things I might work on within my personal blog's software. - [ ] Remove lychee failing links - [ ] Import Facebook posts - [ ] Songwhip is dead 😭 replace with something else - - Musicbrainz will be good eg. [using release IDs](https://musicbrainz.org/ws/2/recording/013efa85-b7f5-4f95-809b-ff47c53726a9?inc=artist-credits%20url-rels&fmt=json) — but doesn't appear to have composer info (eg. [here](https://musicbrainz.org/ws/2/recording/bfbd2167-db3a-469a-a0a3-3fdeacbd4344?inc=artist-credits%20url-rels&fmt=json)) + - [x] Approach complete. Use Musicbrainz + - Annoyingly soundcloud URLs don't include the data needed to create an embed, so have to add that manually + - [ ] Auto-import from UUID [using release IDs](https://musicbrainz.org/ws/2/recording/013efa85-b7f5-4f95-809b-ff47c53726a9?inc=artist-credits%20artist-rels%20url-rels&fmt=json) — more complex to get composer info (eg. [here](https://musicbrainz.org/ws/2/recording/bfbd2167-db3a-469a-a0a3-3fdeacbd4344?inc=artist-credits%20artist-rels%20url-rels%20work-rels%20work-level-rels&fmt=json)) + - `composer: .relations[type=performance].work.relations[type=composer].name` + - `title: .title` (Or album, if path is `/release` not `/recording`) + - `artist: .artist-credit.name` + - `links: .relations[type="free streaming"|"streaming"].url.resource` ### Done ✓