beets icon indicating copy to clipboard operation
beets copied to clipboard

import -C flag fails to override move: yes in config (files are moved unexpectedly) after a previous import got cancelled

Open lbesnard opened this issue 2 months ago • 0 comments

Problem

I am attempting to re-ingest my library using beet import -AWC (as mentionned by https://beets.readthedocs.io/en/stable/faq.html#point-beets-at-a-new-music-directory) after a change of HDD.

Before running beet import -AWC ./beet_library_test, I deleted my beet library as mentioned in the FAQ.

But if my terminal/tmux/computer crashes or a Ctrl C (for any external reason), when I want to pursue the import again with another run of beet import -AWC ./beet_library_test (without deleting the blb libary) some files then get moved! This doesn't happen if the beet import -AWC ./beet_library_test command succeeds, and if I run it again.

My config.yaml has move: yes enabled globally. I expected the -C (no copy) flag to prevent any file movement,however, Beets ignored the flag and moved files based on the move: yes configuration setting.

Because some files had empty metadata, this caused files to be physically moved to a genre folder named Unknown, breaking my file structure.

Setup

  • OS:
  • Python version:
  • beets version:
  • Turning off plugins made problem go away (yes/no):
beets version 2.5.1
Python version 3.12.8
plugins: badfiles, bareasc, chroma, cmus, convert, discogs, duplicates, edit, fetchart, fetchartist, fromfilename, ftintitle, fuzzy, hook, importadded, info, inline, lastgenre, mbsync, musicbrainz, parentwork, play, random, replaygain, rewrite, scrub, smartplaylist, web, xtractor

My configuration (output of beet config) is:

acousticbrainz:
    auto: yes

badfiles:
    commands: {}

chroma:
    auto: yes

convert:
    auto: no
    never_convert_lossy_files: yes
    quiet: false
    dest: /tmp/convert
    formats:
      alac:
        command: ffmpeg -i $source -y -vn -aq 2 $dest
        extension: flac

# MODIFIED: Generic path
directory: /mnt/data/music/beet_library_test/

duplicates:
    album: yes
    path: yes

fetchart:
    auto: yes
    maxwidth: 1000
    cover_names: cover Cover front Front art album portada folder Folder
    # CHECK: Ensure this key is actually empty in your file before posting
    google-key:
    sources:
        - filesystem
        - coverart: release
        - itunes
        - covertart: releasegroup
        - amazon
        - albumart
        - google
        - '*'

ftintitle:
    auto: yes

import:
    copy: no
    move: yes  # This is the important part for the bug report
    write: yes
    languages: en
    resume: yes
    autotag: yes

item_fields:
    multidisc: 1 if disctotal > 1 else 0
    genre_fix: genre.title()
    genre_no_space: genre.lower().replace(' ','_')

lastgenre:
    count: 1
    auto: yes
    fallback: 'unknown'
    source: artist
    canonical: ~/.config/beets/genres-tree.yaml
    whitelist: ~/.config/beets/beets_genre

wlg:
    auto: yes
    force: no
    count: 1
    separator: ', '
    whitelist: ~/.config/beets/beets_genre

# MODIFIED: Generic path
library: /mnt/data/music/beets_library.blb

replaygain:
    backend: ffmpeg

sort_item: albumartist+ album+ disc+ track+
spotify:
    mode: open
    region_filter: US
    show_failures: on
    tiebreak: popularity
    regex: [
        {
            field: "albumartist",
            search: "Something",
            replace: "Replaced"
        },
        {
            field: "title",
            search: "Something Else",
            replace: "AlsoReplaced"
        }
    ]

threaded: yes

paths:
    default: '$genre_fix/%title{$albumartist}/$original_year - $album/%if{$multidisc,Disc $disc/}$track $title'
    albumtype:soundtrack: Soundtracks/$albumartist - $original_year - $album/%if{$multidisc,Disc $disc/}$track $title
    singleton: '$albumartist/$year -  $album/$track $title'
    mis:1: '$albumartist/$year - $album/$track $title'

per_disc_numbering: true

musicbrainz:
    data_source_mismatch_penalty: 0.3
discogs:
    data_source_mismatch_penalty: 0.8

plugins:
    # - acousticbrainz
    # - artistcountry
    - badfiles
    - bareasc
    - chroma
    - cmus
    - convert
    - discogs
    - duplicates
    - edit
    - fetchart
    - fetchartist
    - fromfilename
    - ftintitle
    - fuzzy
    - hook
    - importadded
    - info
    - inline
    - lastgenre
    - mbsync
    - musicbrainz
    - parentwork
    - play
    - random
    - replaygain
    - rewrite
    - scrub
    - smartplaylist
    - web
    # - wlg
    - xtractor

pluginpath:
    - ~/.config/beets/plugins/
    - ~/.config/beets/plugins/bandcamp/beetsplug
    - ~/.config/beets/plugins/airsonic/
    - ~/.config/beets/plugins/fetchartist/beetsplug/
    - ~/.config/beets/whatlastgenre_org/plugin/beets/beetsplug/

smartplaylist:
    # MODIFIED: Generic path
    relative_to: /mnt/data/music/beet_library
    playlist_dir: /mnt/data/music/playlists
    playlists:
        - name: 'New_%time{$added,%Y-%m}_$genre_no_space.m3u'
          query: 'added:2018-10..'

hook:
  hooks:
   - event: cli_exit
      # MODIFIED: Generic username
      command: "sh -c 'bash /home/user/bin/beet_playlist_management.sh'"
    - event: import
      # MODIFIED: Generic username
      command: "sh -c 'bash /home/user/bin/beet_playlist_management.sh'"

edit:
    itemfields: track title artist album albumartist genre year
    albumfields: album albumartist genre year

importadded:
    preserve_mtimes: yes
    preserve_write_mtimes: yes

play:
    command: mp3blaster --list

replace:
    '[\\/]': _
    '^\.':
    '[\x00-\x1f]': _
    '[<>:"\?\*\|]': _
    '\.$': _
    '\s+$': ''
    '^\s+': ''
    '[\xe2\x80\x90]': '-'
    '[\u2010]': '-'
    '‐': '-'
    '’': "'"
    '’': "'"

rewrite:
    artist The Jimi Hendrix Experience: Jimi Hendrix
    albumartist The Jimi Hendrix Experience: Jimi Hendrix
    artist .*Grateful Dead.*: Grateful Dead
    albumartist .*Grateful Dead.*: Grateful Dead
    artist .*Bill Monroe.*: Bill Monroe
    albumartist .*Bill Monroe.*: Bill Monroe

path_sep_replace: _

scrub:
    auto: yes

ui:
    color: yes

match:
    strong_rec_thresh: 0.17
    medium_rec_thresh: 0.25
    rec_gap_thresh: 0.25
    max_rec:
        missing_tracks: medium
        unmatched_tracks: medium
    distance_weights:
        source: 2.0
        artist: 3.0
        album: 3.0
        media: 1.0
        mediums: 1.0
        year: 1.0
        country: 0.5
        label: 0.5
        catalognum: 0.5
        albumdisambig: 0.5
        album_id: 5.0
        tracks: 2.0
        missing_tracks: 0.9
        unmatched_tracks: 0.6
        track_title: 3.0
        track_artist: 2.0
        track_index: 1.0
        track_length: 2.0
        track_id: 5.0
    preferred:
        countries: []
        media: ['CD', 'Digital Media', 'File', 'Vinyl']
        original_year: no
    ignored: []
    track_length_grace: 10
    track_length_max: 30

fetchartist:
    cover_name: "folder"

xtractor:
  auto: no
  dry-run: no
  write: yes
  threads: 1
  force: no
  quiet: no
  keep_output: yes
  keep_profiles: no
  # MODIFIED: Generic paths
  output_path: /mnt/data/music/xtractor/xtraction_data
  essentia_extractor: /mnt/data/music/xtractor/extractors/beta5/streaming_extractor_music
  extractor_profile:
    highlevel:
      svm_models:
        - /mnt/data/music/xtractor/extractors/beta5/svm_models/danceability.history
        - /mnt/data/music/xtractor/extractors/beta5/svm_models/gender.history
        - /mnt/data/music/xtractor/extractors/beta5/svm_models/genre_rosamerica.history
        - /mnt/data/music/xtractor/extractors/beta5/svm_models/mood_acoustic.history
        - /mnt/data/music/xtractor/extractors/beta5/svm_models/mood_aggressive.history
        - /mnt/data/music/xtractor/extractors/beta5/svm_models/mood_electronic.history
        - /mnt/data/music/xtractor/extractors/beta5/svm_models/mood_happy.history
        - /mnt/data/music/xtractor/extractors/beta5/svm_models/mood_sad.history
        - /mnt/data/music/xtractor/extractors/beta5/svm_models/mood_party.history
        - /mnt/data/music/xtractor/extractors/beta5/svm_models/mood_relaxed.history
        - /mnt/data/music/xtractor/extractors/beta5/svm_models/voice_instrumental.history
        - /mnt/data/music/xtractor/extractors/beta5/svm_models/moods_mirex.history

lbesnard avatar Nov 27 '25 07:11 lbesnard