3 Commits

Author SHA1 Message Date
ab
f873542d02 Merge pull request 'DEV' (#4) from DEV into main
Some checks failed
Publish Metadata Agent Image / build-and-push-image (push) Failing after 10s
Publish Web Player Image / build-and-push-image (push) Failing after 10s
Reviewed-on: #4
2026-03-20 00:02:49 +00:00
ab
3f2013e9d5 Merge pull request 'Fix phantom duplicate tracks created on Merged file ingestion' (#3) from DEV into main
All checks were successful
Publish Metadata Agent Image / build-and-push-image (push) Successful in 1m47s
Publish Web Player Image / build-and-push-image (push) Successful in 1m41s
Publish Server Image / build-and-push-image (push) Successful in 3m1s
Reviewed-on: #3
2026-03-19 23:43:36 +00:00
ab
7ede23ff94 Merge pull request 'Improved admin UI' (#2) from DEV into main
All checks were successful
Publish Metadata Agent Image / build-and-push-image (push) Successful in 1m14s
Publish Web Player Image / build-and-push-image (push) Successful in 1m16s
Publish Server Image / build-and-push-image (push) Successful in 2m20s
Reviewed-on: #2
2026-03-19 15:33:26 +00:00
11 changed files with 16 additions and 28 deletions

View File

@@ -4,14 +4,14 @@ You are a music library artist merge assistant. You will receive a list of artis
You will receive a structured list like: You will receive a structured list like:
### Artist ID 42: "deep purple" ### Artist ID 42: "pink floyd"
Album ID 10: "machine head" (1972) Album ID 10: "the wall" (1979)
- 01. "Highway Star" [track_id=100] - 01. "In the Flesh?" [track_id=100]
- 02. "Maybe I'm a Leo" [track_id=101] - 02. "The Thin Ice" [track_id=101]
### Artist ID 43: "Deep Purple" ### Artist ID 43: "Pink Floyd"
Album ID 11: "Burn" (1974) Album ID 11: "Wish You Were Here" (1975)
- 01. "Burn" [track_id=200] - 01. "Shine On You Crazy Diamond (Parts I-V)" [track_id=200]
## Your task ## Your task
@@ -20,7 +20,7 @@ Determine if the artists are duplicates and produce a merge plan.
## Rules ## Rules
### 1. Canonical artist name ### 1. Canonical artist name
- Use correct capitalization and canonical spelling (e.g., "deep purple" → "Deep Purple", "AC DC" → "AC/DC"). - Use correct capitalization and canonical spelling (e.g., "pink floyd" → "Pink Floyd", "AC DC" → "AC/DC").
- If the database already contains an artist with a well-formed name, prefer that exact form. - If the database already contains an artist with a well-formed name, prefer that exact form.
- If one artist has clearly more tracks or albums, their name spelling may be more authoritative. - If one artist has clearly more tracks or albums, their name spelling may be more authoritative.
- Fix obvious typos or casing errors. - Fix obvious typos or casing errors.
@@ -54,7 +54,7 @@ Determine if the artists are duplicates and produce a merge plan.
You MUST respond with a single JSON object, no markdown fences, no extra text: You MUST respond with a single JSON object, no markdown fences, no extra text:
{"canonical_artist_name": "...", "winner_artist_id": 42, "album_mappings": [{"source_album_id": 10, "canonical_name": "Machine Head", "merge_into_album_id": null}, {"source_album_id": 11, "canonical_name": "Burn", "merge_into_album_id": null}], "notes": "..."} {"canonical_artist_name": "...", "winner_artist_id": 42, "album_mappings": [{"source_album_id": 10, "canonical_name": "The Wall", "merge_into_album_id": null}, {"source_album_id": 11, "canonical_name": "Wish You Were Here", "merge_into_album_id": null}], "notes": "..."}
- `canonical_artist_name`: the single correct name for this artist after merging. - `canonical_artist_name`: the single correct name for this artist after merging.
- `winner_artist_id`: the integer ID of the artist whose record survives (must be one of the IDs provided). - `winner_artist_id`: the integer ID of the artist whose record survives (must be one of the IDs provided).

View File

@@ -3,10 +3,10 @@ You are a music metadata normalization assistant. Your job is to take raw metada
## Rules ## Rules
1. **Artist names** must use correct capitalization and canonical spelling. Examples: 1. **Artist names** must use correct capitalization and canonical spelling. Examples:
- "deep purple" → "Deep Purple" - "pink floyd" → "Pink Floyd"
- "AC DC" → "AC/DC" - "AC DC" → "AC/DC"
- "guns n roses" → "Guns N' Roses" - "Guns n roses" → "Guns N' Roses"
- "led zepplin" → "Led Zeppelin" (fix common misspellings) - "Led zepplin" → "Led Zeppelin" (fix common misspellings)
- "саша скул" → "Саша Скул" (fix capitalization, keep the language as-is) - "саша скул" → "Саша Скул" (fix capitalization, keep the language as-is)
- If the database already contains a matching artist (same name in any case or transliteration), always use the existing canonical name exactly. For example, if the DB has "Саша Скул" and the file says "саша скул" or "Sasha Skul", use "Саша Скул". - If the database already contains a matching artist (same name in any case or transliteration), always use the existing canonical name exactly. For example, if the DB has "Саша Скул" and the file says "саша скул" or "Sasha Skul", use "Саша Скул".
- **Compound artist fields**: When the artist field or path contains multiple artist names joined by "и", "and", "&", "/", ",", "x", or "vs", you MUST split them. The "artist" field must contain ONLY ONE primary artist. All others go into "featured_artists". If one of the names already exists in the database, prefer that one as the primary artist. - **Compound artist fields**: When the artist field or path contains multiple artist names joined by "и", "and", "&", "/", ",", "x", or "vs", you MUST split them. The "artist" field must contain ONLY ONE primary artist. All others go into "featured_artists". If one of the names already exists in the database, prefer that one as the primary artist.
@@ -43,12 +43,12 @@ You are a music metadata normalization assistant. Your job is to take raw metada
- Preserve original language for non-English albums. - Preserve original language for non-English albums.
- If the database already contains a matching album under the same artist, use the existing name exactly. - If the database already contains a matching album under the same artist, use the existing name exactly.
- Do not alter the creative content of album names (same principle as track titles). - Do not alter the creative content of album names (same principle as track titles).
- **Remastered editions**: A remastered release is a separate album entity, even if it shares the same title and tracks as the original. If the tags or path indicate a remaster (e.g., "Remastered", "Remaster", "REMASTERED" anywhere in tags, filename, or path), append " (Remastered)" to the album name if not already present, and use the year of the remaster release (not the original). Example: original album "Paranoid" (1970) remastered in 2009 → album: "Paranoid (Remastered)", year: 2009. - **Remastered editions**: A remastered release is a separate album entity, even if it shares the same title and tracks as the original. If the tags or path indicate a remaster (e.g., "Remastered", "Remaster", "REMASTERED" anywhere in tags, filename, or path), append " (Remastered)" to the album name if not already present, and use the year of the remaster release (not the original). Example: original album "The Wall" (1979) remastered in 2011 → album: "The Wall (Remastered)", year: 2011.
4. **Track titles** must use correct capitalization, but their content must be preserved exactly. 4. **Track titles** must use correct capitalization, but their content must be preserved exactly.
- Use title case for English titles. - Use title case for English titles.
- Preserve original language for non-English titles. - Preserve original language for non-English titles.
- Remove leading track numbers if present (e.g., "01 - Smoke on the Water" → "Smoke on the Water"). - Remove leading track numbers if present (e.g., "01 - Have a Cigar" → "Have a Cigar").
- **NEVER remove, add, or alter words, numbers, suffixes, punctuation marks, or special characters in titles.** Your job is to fix capitalization and encoding, not to edit the creative content. If a title contains unusual punctuation, numbers, apostrophes, or symbols — they are intentional and must be kept as-is. - **NEVER remove, add, or alter words, numbers, suffixes, punctuation marks, or special characters in titles.** Your job is to fix capitalization and encoding, not to edit the creative content. If a title contains unusual punctuation, numbers, apostrophes, or symbols — they are intentional and must be kept as-is.
- If all tracks in the same album follow a naming pattern (e.g., numbered names like "Part 1", "Part 2"), preserve that pattern consistently. Do not simplify or truncate individual track names. - If all tracks in the same album follow a naming pattern (e.g., numbered names like "Part 1", "Part 2"), preserve that pattern consistently. Do not simplify or truncate individual track names.

View File

@@ -188,20 +188,8 @@ async fn reprocess_pending(state: &Arc<AppState>) -> anyhow::Result<usize> {
} }
} }
} else { } else {
// Source file is gone — check if already in library by hash tracing::error!(id = %pt.id, "Source file missing: {:?}", source);
let in_library: (bool,) = sqlx::query_as( db::update_pending_status(&state.pool, pt.id, "error", Some("Source file missing")).await?;
"SELECT EXISTS(SELECT 1 FROM tracks WHERE file_hash = $1)"
)
.bind(&pt.file_hash)
.fetch_one(&state.pool).await.unwrap_or((false,));
if in_library.0 {
tracing::info!(id = %pt.id, "Source missing but track already in library — merging");
db::update_pending_status(&state.pool, pt.id, "merged", None).await?;
} else {
tracing::error!(id = %pt.id, "Source file missing: {:?}", source);
db::update_pending_status(&state.pool, pt.id, "error", Some("Source file missing")).await?;
}
continue; continue;
}; };