beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.89k stars 1.82k forks source link

Configuration override for operations that currently only affect files inside the library directory #2290

Open mfiano opened 7 years ago

mfiano commented 7 years ago

I have duplicate_action: ask so i type 'r' to remove the old ones on import. I just noticed that the filesystem is not affected, so 2 copies of the albums now exist - only the database is affected on pressing 'r'. The only way I can fix this is to 'beet mv' the entire library to a temporary location, remove the files from the original location, then 'beet mv' everything back.

nathdwek commented 7 years ago

I am sorry I do not use that plugin a lot, but by looking at the documentation and the source I cannot find this duplicate_action config key you are talking about. Could you tell us what version of beets you are running?

In the latest version it seems there is a -d CLI option which is advertised as removing the items from the db and disk.

mfiano commented 7 years ago

duplicate_action is an option for the importer in 1.3.19

nathdwek commented 7 years ago

wooops, sorry. Going to look into that then.

sampsyo commented 7 years ago

Can you please include your configuration and the verbose output (as suggested by the issue template)?

sampsyo commented 7 years ago

Also, for what it's worth: the importer only removes duplicate files if they're inside your directory as listed in your configuration file.

mfiano commented 7 years ago

I'll have to post the verbose log later when I have to do it again, but here is my configuration. When I import, I always do 'beet -d /mnt/extra1/music/unsorted im', so that new stuff goes to a separate directory for me to manually review. Once reviewed, I then do a 'beet mv' to move them into the main directory specified in the config below. The problem is that those albums I told beets to remove during import, are still on the filesystem and only removed from the database. When i move the files in 'unsorted' to 'sorted', they are placed alongside the old versions (in the case they are not overwritten, such as a different $format). Therefor I have to move EVERYTHING to unsorted (it only moves those in the db, leaving those orphaned files alone), remove the orphans in sorted, then move EVERYTHING back to sorted.

library: ~/.config/beets/library.db
directory: /mnt/extra1/music/sorted
plugins: inline missing duplicates lastgenre replaygain scrub zero the ftintitle info
ignore: [ ".*", "*~", "System Volume Information" ]
replace:
    '[\\/]': '-'
    '^\.\.\.': '…'
    '^\.': ''
    '\.$': ''
    '[\x00-\x1f]3': '-'
    '[<>:"\?\*\|]': ''
    '\s+$': ''
threaded: yes
format_item: $artist - $album - $title
format_album: $albumartist - $album ($year)
original_date: yes
per_disc_numbering: yes
terminal_encoding: utf8
max_filename_length: 0
path_sep_replace: '-'
asciify_paths: no
verbose: no
ui:
    color: yes
import:
    write: yes
    copy: no
    move: yes
    resume: no
    link: no
    incremental: no
    quiet_fallback: skip
    none_rec_action: ask
    timid: no
    log: ~/.config/beets/import.log
    default_action: none
    languages: [ "en" ]
    detail: no
    autotag: yes
    duplicate_action: ask
match:
    strong_rec_thresh: 0.04
    max_rec:
        missing_tracks: none
        unmatched_tracks: low
    preferred:
        original_year: yes
    ignored: missing_tracks
item_fields:
    hifi: |
        khz = str(samplerate/1000.0)
        rate = khz.rstrip('0').rstrip('.') if '.' in khz else khz
        if format == 'FLAC':
            return u'[%s %sbit-%skHz]' % (format, bitdepth, rate)
        else:
            return u'[%s]' % (format)
    disc_and_track: u'%02i' % (track) if disctotal == 1 else u'%02i-%02i' % (disc, track)
    release: u'(%s)' % (year) if year else u'(0000)'
paths:
    default: artists/%the{$albumartist}/$release $album%aunique{} $hifi/$disc_and_track $title
    singleton: singles/%the{$artist} - $title $hifi
    comp: compilations/$album%aunique{} $hifi/$disc_and_track $title ($artist)
    albumartist:[unknown]: compilations/$album%aunique{} $hifi/$disc_and_track $title ($artist)
    album:"pickin' on": compilations/$album%aunique{} $hifi/$disc_and_track $title ($artist)
ftintitle:
    auto: yes
lastgenre:
    auto: yes
    fallback: ''
    source: artist
    canonical: yes
    count: 1
    force: yes
replaygain:
    auto: yes
    albumgain: yes
    noclip: yes
    backend: bs1770gain
scrub:
    auto: yes
zero:
    fields: comments month day
    update_database: true
the:
    the: yes
    a: no
    strip: no
sampsyo commented 7 years ago

When I import, I always do 'beet -d /mnt/extra1/music/unsorted im', so that new stuff goes to a separate directory for me to manually review.

Aha, that would do it: since you've pointed -d at a directory where the old music does not reside, beets cautiously avoids deleting your files from a different directory. If you're curious, you can see the logic here: https://github.com/beetbox/beets/blob/9de27c6b70d460a43839728704332fc71587191c/beets/importer.py#L517-L527

I'm not sure what the best way to resolve this is. We can add an override setting, but that seems a bit clunky. Any ideas?

mfiano commented 7 years ago

This would probably also be why the de-clutter is failing. After I 'beet mv' from unsorted->sorted, unsorted has every directory intact and not cleaned. An override option would solve this, and I think is the best method as it will solve multiple issues.

sampsyo commented 7 years ago

Yep, that would explain it.

OK, I'm transforming this into a feature request. The idea would be to find all the places where we currently only do some file operation on things in your directory, which works most of the time, and add a configuration override that lets those things happen anywhere.

mfiano commented 5 years ago

Is this supported yet?