refactor(integrations): move MB location and genre helpers to qbz-integrations

Pure-logic move of two helper modules out of src-tauri/src/musicbrainz/
into the qbz-integrations crate, where the MusicBrainzClient and DTOs
already live:

  src-tauri/src/musicbrainz/location_discovery.rs
    -> crates/qbz-integrations/src/musicbrainz/location.rs
  src-tauri/src/musicbrainz/genre_normalization.rs
    -> crates/qbz-integrations/src/musicbrainz/genre.rs

The functions exposed are unchanged: extract_metadata,
compute_affinity_score, build_scene_cache_key, format_life_span_date
(from location); normalize_genre, is_broad_genre, extract_affinity_seeds,
genre_summary (from genre). Imports in src-tauri/src/commands_v2/
integrations.rs are repointed to the new home; the legacy file
declarations are removed from src-tauri/src/musicbrainz/mod.rs. No
behavior change.

Unblocks the Slint side from reaching the same helpers via qbz-core
without depending on src-tauri.

cc
This commit is contained in:
vicrodh committed 2026-05-20 08:50:50 -06:00
1 parent b3acb21c37
commit 508609a5d8
6 files changed
+13 -8

No files matched your search

@@ -5,7 +5,7 @@
use std::collections::HashSet;
use qbz_integrations::musicbrainz::{AffinitySeeds, Tag};
use super::{AffinitySeeds, Tag};
/// Tags that provide no useful genre/scene signal
const NOISY_TAGS: &[&str] = &[
@@ -7,8 +7,11 @@
use std::collections::HashSet;
use super::genre_normalization::{extract_affinity_seeds, normalize_genre};
use qbz_integrations::musicbrainz::*;
use super::genre::{extract_affinity_seeds, normalize_genre};
use super::{
AffinitySeeds, Area, ArtistFullResponse, ArtistLocation, ArtistMetadata, ArtistType, LifeSpan,
LocationPrecision,
};
/// Extract artist metadata from the full MB response
pub fn extract_metadata(response: &ArtistFullResponse) -> ArtistMetadata {
@@ -31,5 +31,8 @@ mod models;
#[cfg(feature = "cache")]
pub mod cache;
pub mod genre;
pub mod location;
pub use client::{MusicBrainzClient, MusicBrainzConfig};
pub use models::*;
+1
View File
@@ -5121,6 +5121,7 @@ dependencies = [
"qbz-models",
"qbz-player",
"qbz-qobuz",
"serde",
"serde_json",
"thiserror 2.0.18",
"tokio",
+3 -3
View File
@@ -552,7 +552,7 @@ pub async fn v2_musicbrainz_get_artist_metadata(
drop(client);
// Extract metadata using the location discovery module (now uses V2 types)
let mut metadata = crate::musicbrainz::location_discovery::extract_metadata(&artist);
let mut metadata = qbz_integrations::musicbrainz::location::extract_metadata(&artist);
// Resolve real country from begin_area hierarchy (MB's "country" field is
// where the artist is active, not where they were born/formed)
@@ -606,10 +606,10 @@ pub async fn v2_discover_artists_by_location(
runtime: State<'_, RuntimeManagerState>,
app: tauri::AppHandle,
) -> Result<qbz_integrations::musicbrainz::LocationDiscoveryResponse, RuntimeError> {
use crate::musicbrainz::genre_normalization::{
use qbz_integrations::musicbrainz::genre::{
extract_affinity_seeds, genre_summary, is_broad_genre,
};
use crate::musicbrainz::location_discovery::{build_scene_cache_key, compute_affinity_score};
use qbz_integrations::musicbrainz::location::{build_scene_cache_key, compute_affinity_score};
use qbz_integrations::musicbrainz::{
AffinitySeeds, LocationCandidate, LocationDiscoveryResponse, Tag,
};
-2
View File
@@ -21,8 +21,6 @@ pub mod smart_playlists;
pub use cache::{CacheStats, MusicBrainzCache, MusicBrainzCacheState};
pub use client::{MusicBrainzClient, MusicBrainzConfig};
pub mod genre_normalization;
pub mod location_discovery;
pub use models::{
AffinitySeeds, AlbumAppearance, Area, AreaResult, AreaSearchResponse, ArtistBrowseResponse,