Fix type error in listenbrainz response

This commit is contained in:
jude
2025-09-19 19:00:22 +01:00
parent bca4cd4eb1
commit 558c79d0cb
4 changed files with 50 additions and 38 deletions

79
.idea/workspace.xml generated
View File

@@ -9,12 +9,15 @@
</configurations> </configurations>
</component> </component>
<component name="CargoProjects"> <component name="CargoProjects">
<cargoProject FILE="$PROJECT_DIR$/Cargo.toml" /> <cargoProject FILE="$PROJECT_DIR$/Cargo.toml">
<package file="$PROJECT_DIR$">
<feature name="default" enabled="true" />
</package>
</cargoProject>
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="52900e09-9584-4b6c-95ff-fbd4ed5d8b2c" name="Changes" comment="Add interface package. Start adding auth stuff for refreshing tokens."> <list default="true" id="52900e09-9584-4b6c-95ff-fbd4ed5d8b2c" name="Changes" comment="Add interface package. Start adding auth stuff for refreshing tokens.">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Cargo.lock" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.toml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/daemon/update_playlists.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/daemon/update_playlists.rs" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/daemon/update_playlists.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/daemon/update_playlists.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/listenbrainz.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/listenbrainz.rs" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/listenbrainz.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/listenbrainz.rs" afterDir="false" />
@@ -27,6 +30,7 @@
<component name="ClangdSettings"> <component name="ClangdSettings">
<option name="formatViaClangd" value="false" /> <option name="formatViaClangd" value="false" />
</component> </component>
<component name="ExecutionTargetManager" SELECTED_TARGET="RsBuildProfile:dev" />
<component name="FileTemplateManagerImpl"> <component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES"> <option name="RECENT_TEMPLATES">
<list> <list>
@@ -54,42 +58,46 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent">{ <component name="PropertiesComponent"><![CDATA[{
&quot;keyToString&quot;: { "keyToString": {
&quot;Cargo.Run.executor&quot;: &quot;Run&quot;, "Cargo.Run.executor": "Run",
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;, "RunOnceActivity.OpenProjectViewOnStart": "true",
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, "RunOnceActivity.ShowReadmeOnStart": "true",
&quot;RunOnceActivity.cidr.known.project.marker&quot;: &quot;true&quot;, "RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
&quot;RunOnceActivity.rust.reset.selective.auto.import&quot;: &quot;true&quot;, "RunOnceActivity.cidr.known.project.marker": "true",
&quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;, "RunOnceActivity.git.unshallow": "true",
&quot;cf.first.check.clang-format&quot;: &quot;false&quot;, "RunOnceActivity.rust.reset.selective.auto.import": "true",
&quot;cidr.known.project.marker&quot;: &quot;true&quot;, "WebServerToolWindowFactoryState": "false",
&quot;git-widget-placeholder&quot;: &quot;master&quot;, "cf.first.check.clang-format": "false",
&quot;last_opened_file_path&quot;: &quot;/home/jude/Documents/navidrome-playlists&quot;, "cidr.known.project.marker": "true",
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;, "git-widget-placeholder": "master",
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;, "junie.onboarding.icon.badge.shown": "true",
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;, "last_opened_file_path": "/home/jude/Documents/navidrome-playlists",
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;, "node.js.detected.package.eslint": "true",
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;, "node.js.detected.package.tslint": "true",
&quot;org.rust.cargo.project.model.PROJECT_DISCOVERY&quot;: &quot;true&quot;, "node.js.selected.package.eslint": "(autodetect)",
&quot;org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon&quot;: &quot;&quot;, "node.js.selected.package.tslint": "(autodetect)",
&quot;org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/client/mod.rs&quot;: &quot;true&quot;, "nodejs_package_manager_path": "npm",
&quot;org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/client/playlists.rs&quot;: &quot;true&quot;, "org.rust.cargo.project.model.PROJECT_DISCOVERY": "true",
&quot;org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/lib.rs&quot;: &quot;true&quot;, "org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon": "",
&quot;org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/models.rs&quot;: &quot;true&quot;, "org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/client/mod.rs": "true",
&quot;org.rust.first.attach.projects&quot;: &quot;true&quot;, "org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/client/playlists.rs": "true",
&quot;settings.editor.selected.configurable&quot;: &quot;language.rust.cargo.check&quot;, "org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/lib.rs": "true",
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot; "org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/models.rs": "true",
"org.rust.first.attach.projects": "true",
"settings.editor.selected.configurable": "language.rust.cargo.check",
"to.speed.mode.migration.done": "true",
"vue.rearranger.settings.migration": "true"
}, },
&quot;keyToStringList&quot;: { "keyToStringList": {
&quot;DatabaseDriversLRU&quot;: [ "DatabaseDriversLRU": [
&quot;postgresql&quot; "postgresql"
], ],
&quot;com.intellij.ide.scratch.LRUPopupBuilder$1/SQL Dialect&quot;: [ "com.intellij.ide.scratch.LRUPopupBuilder$1/SQL Dialect": [
&quot;PostgreSQL&quot; "PostgreSQL"
] ]
} }
}</component> }]]></component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/daemon" /> <recent name="$PROJECT_DIR$/src/daemon" />
@@ -169,7 +177,8 @@
<workItem from="1716640392358" duration="367000" /> <workItem from="1716640392358" duration="367000" />
<workItem from="1716642009543" duration="1546000" /> <workItem from="1716642009543" duration="1546000" />
<workItem from="1716650511971" duration="14000" /> <workItem from="1716650511971" duration="14000" />
<workItem from="1723834879628" duration="4009000" /> <workItem from="1723834879628" duration="4208000" />
<workItem from="1758303664979" duration="1155000" />
</task> </task>
<task id="LOCAL-00001" summary="Structure"> <task id="LOCAL-00001" summary="Structure">
<created>1692008860369</created> <created>1692008860369</created>

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "playlistd" name = "playlistd"
version = "0.2.4" version = "0.2.5"
edition = "2021" edition = "2021"
authors = ["Jude Southworth (judesouthworth@pm.me)"] authors = ["Jude Southworth (judesouthworth@pm.me)"]
license = "AGPL-3.0 only" license = "AGPL-3.0 only"

View File

@@ -92,7 +92,10 @@ async fn update_playlist(
.iter() .iter()
.find(|s| { .find(|s| {
alpha_compare(&s.title, &recording.track_name) alpha_compare(&s.title, &recording.track_name)
&& alpha_compare(&s.album, &recording.release_name) && match &recording.release_name {
Some(release_name) => alpha_compare(&s.album, release_name),
None => true,
}
}) })
.cloned(); .cloned();

View File

@@ -82,7 +82,7 @@ pub struct Artist {
#[derive(Deserialize)] #[derive(Deserialize)]
pub struct RecordingsEntry { pub struct RecordingsEntry {
pub track_name: String, pub track_name: String,
pub release_name: String, pub release_name: Option<String>,
pub artist_name: String, pub artist_name: String,
pub artists: Option<Vec<Artist>>, pub artists: Option<Vec<Artist>>,
} }