Skip to content

Instantly share code, notes, and snippets.

@cletusw
Last active June 6, 2026 06:39
Show Gist options
  • Select an option

  • Save cletusw/2680d8c8d8866d1760523e0d3b63b321 to your computer and use it in GitHub Desktop.

Select an option

Save cletusw/2680d8c8d8866d1760523e0d3b63b321 to your computer and use it in GitHub Desktop.
Re-imports files imported without an album so that can be fixed
FILE=$(ls /music/Non-Album/ | head -n 1) && \
TITLE=$(basename "$FILE" | sed 's/\.[^.]*$//' | cut -d'-' -f2- | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') && \
echo "=== Processing Title: $TITLE ===" && \
IFS='|' read -r ID FILE_PATH <<< "$(beet ls -f '$id|$path' "$TITLE" | head -n 1)" && \
[ -n "$FILE_PATH" ] && \
beet remove "id:$ID" && \
beet import -t "$FILE_PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment