diff --git a/assets/code-style.css b/assets/code-style.css index 1aa7541..f584615 100644 --- a/assets/code-style.css +++ b/assets/code-style.css @@ -5,7 +5,7 @@ code { border-radius: 3px; font-family: "Maple Mono", monospace; font-style: normal; - /*font-size: 14pt;*/ + font-size: 13pt; } div.code-toolbar { @@ -30,7 +30,6 @@ code[class*="language-"] { overflow: auto; font-family: "Maple Mono", monospace; border-radius: 13px; - white-space: pre-wrap; } pre > code{ diff --git a/assets/fonts/MapleMono-Regular.ttf b/assets/fonts/MapleMono-Regular.ttf index 470e6c8..9388a2f 100644 Binary files a/assets/fonts/MapleMono-Regular.ttf and b/assets/fonts/MapleMono-Regular.ttf differ diff --git a/assets/fonts/MapleMono-Regular.woff2 b/assets/fonts/MapleMono-Regular.woff2 index 1ceeec1..fd0b49c 100644 Binary files a/assets/fonts/MapleMono-Regular.woff2 and b/assets/fonts/MapleMono-Regular.woff2 differ diff --git a/assets/img-style.css b/assets/img-style.css index 9c1e48e..f618645 100644 --- a/assets/img-style.css +++ b/assets/img-style.css @@ -1,4 +1,4 @@ -/* Image grid stuff */ +/* --- Image grid stuff --- */ section.img_grid { display: flex; align-items: center; diff --git a/assets/lib/scripts/music_status.css b/assets/lib/scripts/music_status.css new file mode 100755 index 0000000..7b9a1ea --- /dev/null +++ b/assets/lib/scripts/music_status.css @@ -0,0 +1,54 @@ +.music_tile { + font-family: "Noto Sans JP", sans-serif; + + display: flex; + flex-direction: column; + max-width: 300px; + margin: auto; + + .track_name { + font-size: 1.2em; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + } + + .artist_name { + font-size: 1em; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + } + + .album_name { + font-size: 0.9em; + color: #c1bfae; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + } + + p { + margin: 0; + } + + p#musicStatus { + text-align: center; + margin-bottom: 20px; + } + + hr { + margin: 10px 0px; + border: none; + height: 1px; + background-color: grey; + } + + img { + margin: 20px; + border-radius: 10px; + height: 260px; + width: 260px; + object-fit: contain; + } +} diff --git a/assets/lib/scripts/music_status.js b/assets/lib/scripts/music_status.js new file mode 100644 index 0000000..7aaae75 --- /dev/null +++ b/assets/lib/scripts/music_status.js @@ -0,0 +1,100 @@ +async function getData(url) { + try { + const response = await fetch(url); + if (!response.ok) { + throw new Error(`Response status: ${response.status}`); + } + + const json = await response.json(); + return json + } catch (error) { + console.error(error.message); + } +} + +const USERNAME = "G2"; +const LUCENE_ESCAPE = /([\!\*\+\-\=\<\>\&\|\(\)\[\]\{\}\^\~\?\:\\/"])/g; + +let artworkTile = document.getElementById("mainArtwork"); +let albumTitle = document.getElementById("albumTitle"); +let albumArtist = document.getElementById("albumArtist"); +let track = document.getElementById("track"); +let status = document.getElementById("musicStatus"); +let prev_mbid = null; + +async function main() { + // Get my currently playing song! + let statusTmp = "Currently playing:"; + let songInfo = await getData("https://api.listenbrainz.org/1/user/" + USERNAME + "/playing-now") + if (songInfo["payload"]["count"] == 0) { + // If no current song, get last played + songInfo = await getData("https://api.listenbrainz.org/1/user/" + USERNAME + "/listens?count=1") + statusTmp = "Last played song:"; + } + + if (prev_mbid != null && prev_mbid == JSON.stringify(songInfo)) { + return; + } + prev_mbid = JSON.stringify(songInfo); + + let artistName = songInfo["payload"]["listens"][0]["track_metadata"]["artist_name"]; + let trackName = songInfo["payload"]["listens"][0]["track_metadata"]["track_name"]; + let releaseMBID = songInfo["payload"]["listens"][0]["track_metadata"]["additional_info"]["release_mbid"]; + if (releaseMBID == null && songInfo["payload"]["listens"][0]["track_metadata"]["mbid_mapping"] != null) { + releaseMBID = songInfo["payload"]["listens"][0]["track_metadata"]["mbid_mapping"]["release_mbid"]; + } + + // Search for the MBID if it's not included in the data + if (releaseMBID == null) { + let artistSearchName = encodeURIComponent(artistName.replace(LUCENE_ESCAPE, "\\$1")); + let trackSearchName = encodeURIComponent(trackName.replace(LUCENE_ESCAPE, "\\$1")); + + console.log("https://musicbrainz.org/ws/2/recording/?query=" + trackSearchName + " AND artist:%22" + artistSearchName + "%22&fmt=json"); + let searchedReleases = await getData( + "https://musicbrainz.org/ws/2/recording/?query=" + trackSearchName + " AND artist:%22" + artistSearchName + "%22&fmt=json" + ); + + console.log(searchedReleases); + + if (searchedReleases["count"] >= 1) { + if (searchedReleases["recordings"][0]["releases"][0]) { + + } + releaseMBID = searchedReleases["recordings"][0]["releases"][0]["id"]; + console.log("Found MBID by search " + releaseMBID); + } + } + + let albumName = "Unknown Album"; + let artworkSrc = "https://placehold.co/260/2220/FFFDE6?text=?&font=roboto"; + if (releaseMBID != null) { + // Get release information (like album title) + let releaseInfo = await getData("https://musicbrainz.org/ws/2/release/" + releaseMBID + "?fmt=json&inc=release-groups"); + albumName = releaseInfo["title"]; + + let releaseGroupMBID = releaseInfo["release-group"]["id"]; + + // Grab the image from the release ID + let coverArtGroup = await fetch("https://coverartarchive.org/release-group/" + releaseGroupMBID + "/front-500"); + if (coverArtGroup.status == 200) { + artworkSrc = coverArtGroup.url + } else { + let coverArtTrack = await fetch("https://coverartarchive.org/release/" + releaseMBID + "/front-500"); + if (coverArtTrack.status == 200) { + artworkSrc = coverArtTrack.url; + } + } + } + + console.log("%s %s by %s (%s)", statusTmp, trackName, artistName, albumName); + + // Fill in the data + status.textContent = statusTmp; + albumArtist.textContent = artistName; + track.textContent = trackName; + albumTitle.textContent = albumName; + artworkTile.src = artworkSrc; +} + +main().catch(console.log); +setInterval(main, 10000); diff --git a/assets/main-style.css b/assets/main-style.css index 686967a..80f3ead 100644 --- a/assets/main-style.css +++ b/assets/main-style.css @@ -35,8 +35,7 @@ hr { margin-bottom: 20px; } -/* Header */ - +/* --- Header --- */ header { margin-top: 20px; margin-bottom: 50px; @@ -121,8 +120,7 @@ abbr { text-decoration-line: dotted; } -/* Main Content */ - +/* --- Main Content --- */ main { display: grid; grid-template-columns: 50% 50%; @@ -185,13 +183,23 @@ main section { .centered { grid-column: span 2; - max-width: 800px; - min-width: 100%; + /*max-width: 800px;*/ + /*min-width: 100%;*/ +} + +.three_column { + display: flex; + flex-wrap: wrap; + + > * { + width: fit-content; + padding-right: 10px; + } } main section img { max-width: 95%; - margin: auto; + margin: 20px auto; display: block; border-radius: 13px; } @@ -308,8 +316,7 @@ main .tags p:first-child { margin-bottom: 0; } -/* Footer */ - +/* --- Footer --- */ footer { width: auto; margin-top: auto; @@ -326,36 +333,7 @@ footer p:last-child { margin-bottom: 0; } -nav.paginator { - display: flex; - gap: 10px; - align-items: center; - justify-content: center; - margin-bottom: 20px; - font-size: 1.8em; - position: relative; - - font-style: normal; - font-weight: bold; -} - -nav.paginator::hover { - all: unset; -} - -nav.paginator .next { - display: block; - position: absolute; - right: 10px; -} - -nav.paginator .prev { - display: block; - position: absolute; - left: 10px; -} - -/* Blog Style */ +/* --- Blog Style --- */ blockquote { font-family: "IBM Plex Serif", serif; font-size: 15pt; @@ -397,7 +375,36 @@ mark::selection { border-left: 1px solid grey; } -/* Mobile/Small Screens */ +nav.paginator { + display: flex; + gap: 10px; + align-items: center; + justify-content: center; + margin-bottom: 20px; + font-size: 1.8em; + position: relative; + + font-style: normal; + font-weight: bold; +} + +nav.paginator::hover { + all: unset; +} + +nav.paginator .next { + display: block; + position: absolute; + right: 10px; +} + +nav.paginator .prev { + display: block; + position: absolute; + left: 10px; +} + +/* --- Mobile/Small Screens --- */ @media(max-width: 700px) { header { flex-direction: column; @@ -428,6 +435,11 @@ mark::selection { .centered { grid-column: span 1; + min-width: 100%; + } + + .three_column { + grid-template-columns: 1fr; } figure.showcase { @@ -442,8 +454,7 @@ mark::selection { } } - -/* Dark theme stuff */ +/* --- Dark theme stuff --- */ @media (prefers-color-scheme: dark) { body { color: #fffde6; @@ -467,13 +478,13 @@ mark::selection { color: #b4e2ff; } - /* Header */ + /* --- Header --- */ header .navigation a.active::after { border-bottom: 2px solid #fffde6; } - /* Main Content */ + /* --- Main Content --- */ main > a:link, main > a:visited, main > a:hover { color: #FFF; @@ -483,11 +494,6 @@ mark::selection { background-color: aliceblue; } - /* - main p { - color: #FFF; - }*/ - section.clickable { color: white; background-color: #2b2b32; diff --git a/index.html b/index.html index b6cabb3..09318a3 100644 --- a/index.html +++ b/index.html @@ -20,8 +20,11 @@ A place for personal projects and things. Enjoy!"> - + + + +
Some more of my links:
GitHub ⧫ - Gitea ⧫ - Ko-fi + Forgejo ⧫ + Ko-fi ⧫ + Search ⧫ + Portfolio
@@ -70,13 +75,6 @@ A place for personal projects and things. Enjoy!"> always. -This portfolio is a list of things I have done and things I am - currently doing. Not comprehensive, and also I dislike selling - myself.
-I tend to make a lot of random things on the internet. You can @@ -111,52 +109,63 @@ A place for personal projects and things. Enjoy!">
A small list of things I enjoy. Favorites! This isn't at - all comprehensive and I'd love to add more.
-General Apps:
+ -General Apps:
- +Editors:
+ -Text/Code Editor:
-Fonts:
+Fonts:
-Programming Languages:
+Programming Languages:
-Shell:
+Shell:
-Desktop Environment:
+Desktop Environment:
-Currently listening to:
+???
+???
+???
+