diff options
author | alyx <alyx@aleteoryx.me> | 2024-04-08 11:59:29 -0400 |
---|---|---|
committer | alyx <alyx@aleteoryx.me> | 2024-04-08 11:59:29 -0400 |
commit | f548d2d297bbf452aa206042f2029d7137df0477 (patch) | |
tree | bf126a6c4e7d533631c3bc76f20b627945889611 /src | |
parent | 95fe09db7d64e1ca746ccc5865b8ff577c386aaa (diff) | |
download | lfm_embed-release-0.2.0.tar.gz lfm_embed-release-0.2.0.tar.bz2 lfm_embed-release-0.2.0.zip |
Various fixesrelease-0.2.0
Diffstat (limited to 'src')
-rw-r--r-- | src/cache/user.rs | 2 | ||||
-rw-r--r-- | src/ctx.rs | 4 | ||||
-rw-r--r-- | src/deserialize.rs | 2 | ||||
-rw-r--r-- | src/theming/hbs/plain.hbs | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/src/cache/user.rs b/src/cache/user.rs index 8d6bf64..6d2d414 100644 --- a/src/cache/user.rs +++ b/src/cache/user.rs @@ -54,7 +54,7 @@ fn user_getter(username: &String) -> UserFuture { if trackreq.status() == StatusCode::NOT_FOUND { return Err((StatusCode::NOT_FOUND, "Track does not exist!")); } let trackstr = trackreq.text().await.unwrap(); - log::trace!("Got user.getTrackInfo JSON for `{username}`: {trackstr}"); + log::trace!("Got track.getInfo JSON for `{username}`: {trackstr}"); let trackinfo = serde_json::from_str::<GetTrackInfo>(&trackstr) .map_err(|e| {log::error!("Couldn't parse track.getInfo for `{}` by `{}` on behalf of {username}: {e}", trackstub.name, trackstub.artist.name); (StatusCode::INTERNAL_SERVER_ERROR, "Couldn't parse track.getInfo!")})?.track; @@ -53,7 +53,7 @@ pub mod model { /// The name of the track. pub name: Arc<str>, /// The name of its album. - pub album: Arc<str>, + pub album: Option<Arc<str>>, /// The artist who made it. pub artist: Artist, @@ -126,7 +126,7 @@ pub async fn get_ctx(api_result: Result<UserInfo, (StatusCode, &'static str)>, f }, scrobble: model::Scrobble { name: track.name.clone(), - album: track.album.title.clone(), + album: track.album.as_ref().map(|a| a.title.clone()), artist: model::Artist { name: track.artist.name.clone(), // image_url: track.artist.images.iter().max_by(|a, b| a.size.cmp(&b.size)).map(|a| a.url.clone()).unwrap_or_else(|| "".into()), diff --git a/src/deserialize.rs b/src/deserialize.rs index b1c4da8..0998cbd 100644 --- a/src/deserialize.rs +++ b/src/deserialize.rs @@ -106,7 +106,7 @@ pub struct Track { #[serde(default)] pub images: Vec<Image>, pub mbid: Option<Arc<str>>, - pub album: Album, + pub album: Option<Album>, pub name: Arc<str>, pub url: Arc<str>, #[serde(deserialize_with = "str_num")] diff --git a/src/theming/hbs/plain.hbs b/src/theming/hbs/plain.hbs index b3c0abf..040a079 100644 --- a/src/theming/hbs/plain.hbs +++ b/src/theming/hbs/plain.hbs @@ -1,5 +1,5 @@ <!doctype html> -<html lang="en" style="margin: 20px; overflow: hidden;"> +<html lang="en" style="margin: 4px; overflow: hidden;"> <head> <meta charset="UTF-8"/> <title>{{#if error}}Error!{{else}}@{{user.name}}'s Last.fm Stats{{/if}}</title> |