Fix music file matching: Mvt3 was resolving to Mvt1 for every season
The old pattern *Mvt*3* matched .mp3 in every MP3 filename, so sort|head-1 always picked track 01 (Mvt1). Fix by finding all files for the season then filtering with grep -iE "Mvt[^0-9]*N[^0-9]", which requires the movement number to be surrounded by non-digit characters (space, dot, underscore) and cannot match digits embedded in .mp3 or track prefixes. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
+2
-1
@@ -36,7 +36,8 @@ eval "$_season_info"
|
||||
echo "Season=$SEASON Mvt=$MVT_NUM Year=$ASTRO_YEAR Day=$DAY_OF_MVT/$DAYS_IN_MVT LastDay=$IS_LAST_DAY"
|
||||
|
||||
# ── Locate music file and get its duration ────────────────────────────────────
|
||||
music_file=$(find "$music_base_dir" -type f -iname "*${SEASON}*Mvt*${MVT_NUM}*" | sort | head -n 1)
|
||||
music_file=$(find "$music_base_dir" -type f -iname "*${SEASON}*" \
|
||||
| grep -iE "Mvt[^0-9]*${MVT_NUM}[^0-9]" | sort | head -n 1)
|
||||
if [ -z "$music_file" ] || [ ! -f "$music_file" ]; then
|
||||
echo "ERROR: Music file not found for $SEASON Mvt $MVT_NUM in $music_base_dir"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user