Use mbid for track search where possible

This commit is contained in:
jude
2026-06-15 19:20:55 +01:00
parent bc8d9908d1
commit 82dd148563
4 changed files with 129 additions and 47 deletions
+2
View File
@@ -78,3 +78,5 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
.junie/
+112 -46
View File
@@ -17,14 +17,10 @@
</component>
<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.">
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" 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$/src/daemon/create_playlists.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/daemon/create_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/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/models.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/models.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/subsonic.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/subsonic.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/listenbrainz.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/listenbrainz.rs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -35,7 +31,7 @@
<option name="formatViaClangd" value="false" />
</component>
<component name="EmbeddingIndexingInfo">
<option name="cachedIndexableFilesCount" value="48" />
<option name="cachedIndexableFilesCount" value="55" />
<option name="fileBasedEmbeddingIndicesEnabled" value="true" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="RsBuildProfile:dev" />
@@ -58,6 +54,69 @@
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="McpProjectServerCommands">
<commands />
<urls />
</component>
<component name="NextEditCompletionFeaturesState">
<decayedCancelled>
<entry key="MS100" value="1.7832100461155516E-49" />
<entry key="MS500" value="1.779264445376079E-10" />
<entry key="S2" value="0.003652247521800762" />
<entry key="S5" value="0.10614339261181734" />
<entry key="S10" value="0.34003735252927425" />
<entry key="S30" value="1.0141819772215594" />
<entry key="S60" value="2.6976232295670823" />
<entry key="M2" value="7.235293047806507" />
<entry key="M5" value="14.947740695354689" />
<entry key="M10" value="21.02881866903945" />
<entry key="M15" value="28.317060210937925" />
<entry key="M30" value="53.26114480046425" />
<entry key="H1" value="85.7690309902811" />
<entry key="H2" value="112.72845131338053" />
<entry key="H4" value="130.1882968053762" />
<entry key="D1" value="147.2723769995884" />
<entry key="W1" value="150.46076637067708" />
</decayedCancelled>
<decayedSelected>
<entry key="MS100" value="1.0" />
<entry key="MS500" value="1.0" />
<entry key="S2" value="1.0000049403229003" />
<entry key="S5" value="1.0091309729890607" />
<entry key="S10" value="1.1271614733862405" />
<entry key="S30" value="1.7861806484453573" />
<entry key="S60" value="2.2514830516727353" />
<entry key="M2" value="2.581298838268658" />
<entry key="M5" value="2.820735662670735" />
<entry key="M10" value="2.9330735250313964" />
<entry key="M15" value="3.045973523232095" />
<entry key="M30" value="3.4330893462953656" />
<entry key="H1" value="3.94793113496648" />
<entry key="H2" value="4.380377629877762" />
<entry key="H4" value="4.662338988235804" />
<entry key="D1" value="4.939407224543" />
<entry key="W1" value="4.991231810430241" />
</decayedSelected>
<decayedShown>
<entry key="MS100" value="0.014680042956468931" />
<entry key="MS500" value="0.4298782432672315" />
<entry key="S2" value="0.8131974375944065" />
<entry key="S5" value="1.0260655929325786" />
<entry key="S10" value="1.3691875685363921" />
<entry key="S30" value="2.6468546225018925" />
<entry key="S60" value="4.8229190871623215" />
<entry key="M2" value="9.734676535071735" />
<entry key="M5" value="17.729990071329567" />
<entry key="M10" value="23.94139714757257" />
<entry key="M15" value="31.348735575722195" />
<entry key="M30" value="56.68614182340377" />
<entry key="H1" value="89.71231876108209" />
<entry key="H2" value="117.10626038721348" />
<entry key="H4" value="134.84927155802265" />
<entry key="D1" value="152.21154380465404" />
<entry key="W1" value="155.4519634874815" />
</decayedShown>
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 2
}</component>
@@ -66,48 +125,51 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"Cargo.Run.executor": "Run",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
"RunOnceActivity.cidr.known.project.marker": "true",
"RunOnceActivity.git.unshallow": "true",
"RunOnceActivity.rust.reset.selective.auto.import": "true",
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
"WebServerToolWindowFactoryState": "false",
"cf.first.check.clang-format": "false",
"cidr.known.project.marker": "true",
"com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true",
"git-widget-placeholder": "master",
"junie.onboarding.icon.badge.shown": "true",
"last_opened_file_path": "/home/jude/Documents/navidrome-playlists",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"org.rust.cargo.project.model.PROJECT_DISCOVERY": "true",
"org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon": "",
"org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/client/mod.rs": "true",
"org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/client/playlists.rs": "true",
"org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/lib.rs": "true",
"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"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;Cargo.Run.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.MCP Project settings loaded&quot;: &quot;true&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252&quot;: &quot;true&quot;,
&quot;RunOnceActivity.cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;RunOnceActivity.rust.reset.selective.auto.import&quot;: &quot;true&quot;,
&quot;RunOnceActivity.typescript.service.memoryLimit.init&quot;: &quot;true&quot;,
&quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
&quot;cf.first.check.clang-format&quot;: &quot;false&quot;,
&quot;cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;codeWithMe.voiceChat.enabledByDefault&quot;: &quot;false&quot;,
&quot;com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;junie.onboarding.icon.badge.shown&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/jude/Documents/navidrome-playlists&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;org.rust.cargo.project.model.PROJECT_DISCOVERY&quot;: &quot;true&quot;,
&quot;org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon&quot;: &quot;&quot;,
&quot;org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/client/mod.rs&quot;: &quot;true&quot;,
&quot;org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/client/playlists.rs&quot;: &quot;true&quot;,
&quot;org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/lib.rs&quot;: &quot;true&quot;,
&quot;org.rust.disableDetachedFileInspection/home/jude/navidrome-playlists/navidrome/src/models.rs&quot;: &quot;true&quot;,
&quot;org.rust.first.attach.projects&quot;: &quot;true&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;language.rust.cargo.check&quot;,
&quot;to.speed.mode.migration.done&quot;: &quot;true&quot;,
&quot;ts.external.directory.path&quot;: &quot;/home/jude/Documents/navidrome-playlists/app/node_modules/typescript/lib&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
},
"keyToStringList": {
"DatabaseDriversLRU": [
"postgresql"
&quot;keyToStringList&quot;: {
&quot;DatabaseDriversLRU&quot;: [
&quot;postgresql&quot;
],
"com.intellij.ide.scratch.LRUPopupBuilder$1/SQL Dialect": [
"PostgreSQL"
&quot;com.intellij.ide.scratch.LRUPopupBuilder$1/SQL Dialect&quot;: [
&quot;PostgreSQL&quot;
]
}
}]]></component>
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/daemon" />
@@ -189,7 +251,11 @@
<workItem from="1716650511971" duration="14000" />
<workItem from="1723834879628" duration="4208000" />
<workItem from="1758303664979" duration="1688000" />
<workItem from="1768333949616" duration="1109000" />
<workItem from="1768333949616" duration="1336000" />
<workItem from="1768335441947" duration="213000" />
<workItem from="1781027103068" duration="90000" />
<workItem from="1781027311696" duration="3180000" />
<workItem from="1781547110087" duration="406000" />
</task>
<task id="LOCAL-00001" summary="Structure">
<created>1692008860369</created>
+14 -1
View File
@@ -79,12 +79,25 @@ async fn update_playlist(
continue;
}
// Try to find track by MusicBrainz ID first
if let Some(mbid) = &recording.recording_mbid {
let mbid_results = media_client.as_ref().song_search(mbid.clone()).await?;
if mbid_results.len() == 1 {
if let Some(track) = mbid_results.first() {
tracks.push(track.id.clone());
continue;
}
}
}
// Fall back to lookup by name/artist
let search_results = media_client
.as_ref()
.song_search(format!(
"{} {}",
recording.track_name,
recording.artists.unwrap_or(vec![])[0].artist_credit_name
recording.artists.clone().unwrap_or(vec![])[0].artist_credit_name
))
.await?;
+1
View File
@@ -85,6 +85,7 @@ pub struct RecordingsEntry {
pub release_name: Option<String>,
pub artist_name: String,
pub artists: Option<Vec<Artist>>,
pub recording_mbid: Option<String>,
}
pub async fn recordings(