beetbox / beets

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

Why did my filenames turn into a bunch of underscores? #2977

Closed shimizurei closed 6 years ago

shimizurei commented 6 years ago

Problem

I fixed a lot of things in Tagscanner that beets didn't get right, re-arranged some folders, and moved some image files. As a result of the fixes, the db was out of date, so I deleted it and created a new one with beet import -AWC "[LOCATION OF IMPORTED FILES]".

After doing that I decided to check if anything needed updating with beet update -p. That showed a lot of genre fixes that I had done in Tagscanner that didn't seem to carry over, so I did the full update `beet update'.

I then went to see if beets had recreated everything matching my updated config file only to find a mess (image below).

whathappenedtomymusic

What happened?

Setup

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    auto: yes
    fallback: ''
    force: no
    genius_api_key: REDACTED
    google_engine_ID: REDACTED
    sources:
    - google
    - lyricwiki
    - musixmatch
    - genius
    bing_lang_to:
    bing_client_secret: REDACTED
    google_API_key: REDACTED
    local: no
verbose: 0
asciify_paths: no
max_filename_length: 0
library: beets_musiclibrary.db

replace:
    '[\\/]': "\u2215"
    '[^\.]': _
    '[\x00-\x1f]': _
    '[<>"\*\|]': _
    '[\.$]': _
    '[\s+$]': ''
    '[\?]': "\uFF1F"
    '[\*]': "\u2736"
    '[\.]{3}$': "\u2026"
    '[\:]': "\u0589"
    '[^\s+]': ''
original_date: no
ftintitle:
    auto: yes
    format: feat. {0}
    drop: no

clutter:
- Thumbs.DB
- .DS_Store
- '*.m3u'
- '*.html'
- '*.htm'

plugins:
- discogs
- fromfilename
- vgmdb3
- edit
- embedart
- fetchart
- ftintitle
- lastgenre
- lyrics
- metasync
- scrub
- bucket
- inline
- the
- badfiles
- duplicates
- info
- missing
ignore_hidden: yes

paths:
    default: '%bucket{%upper{%left{%the{$albumartist},1}}}/%the{$albumartist}/[%if{$year,$year,0000}] $album %aunique{}/%if{$multidisc,$disc-}$track. %asciify{$title}'
    singleton: _NoAlbum/%%the{$artist}/%asciify{$title}
    albumtype_soundtrack: _Soundtracks/%if{$grouped, %the{$grouping}}/[%if{$year,$year,0000}] $album %aunique{}/%if{$multidisc,$disc-}$track. $title
    comp: _Compilations/%if{$grouped, %the{$grouping}}/[%if{$year,$year,0000}] $album %aunique{}/%if{$multidisc,$disc-}$track. $title

format_item: $artist - $album - $title
sort_case_insensitive: yes
art_filename: '%asciify{albumart_$album}'
missing:
    format: $albumartist - $album - $track - $title
    count: no
    total: no
    album: no
format_album: $albumartist - $album
lastgenre:
    auto: yes
    fallback: ''
    source: artist
    count: 1
    prefer_specific: no
    force: yes
    min_weight: 10
    whitelist: yes
    separator: ', '
    canonical: no
path_sep_replace: _

import:
    log: ~/beets-import.log
    write: yes
    copy: yes
    group_albums: no
    pretend: no
    search_ids: []
    duplicate_action: ask
    bell: yes
    set_fields: {}
    autotag: yes
    timid: yes
    resume: ask
    incremental: no
    incremental_skip_later: no
    quiet_fallback: skip
    none_rec_action: ask
    default_action: apply
    singletons: yes
    languages: []
    detail: no
    flat: no

sort_album: albumartist+ album+

match:
    strong_rec_thresh: 0.04
    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: []
        original_year: no
    ignored: []
    required: []
    track_length_grace: 10
    track_length_max: 30
scrub:
    auto: no
artist_credit: no
fetchart:
    auto: yes
    minwidth: 500
    maxwidth: 2000
    cautious: yes
    cover_names: cover cvr folder album front
    sources: filesystem coverart amazon itunes albumart
    enforce_ratio: no
    store_source: no
    google_key: REDACTED
    fanarttv_key: REDACTED
embedart:
    auto: yes
    compare_threshold: 0
    ifempty: no
    remove_art_file: no
    maxwidth: 0
time_format: '%Y-%m-%d %H:%M:%S'
pluginpath: [~\AppData\Roaming\beets\beetsplug]
item_fields:
    multidisc: 1 if disctotal > 1 else 0
    grouped: 1 if grouping else 0
sort_item: artist+ album+ disc+ track+
threaded: yes
va_name: Various Artists
per_disc_numbering: no
id3v23: yes
bucket:
    bucket_alpha:
    - '[0-9]'
    - '[A-D]'
    - '[E-H]'
    - '[I-L]'
    - '[M-P]'
    - '[Q-U]'
    - '[V-Z]'
    bucket_year: []
    extrapolate: no
    bucket_alpha_regex: {}
ignore:
- .*
- '*~'
- System Volume Information
- lost+found
- .DS_Store
- desktop.ini
- AlbumArtSmall.jpg
- AlbumArt_*_Small.jpg

ui:
    terminal_width: 80
    length_diff_thresh: 10.0
    color: yes
timeout: 5.0
directory: ~/Music
format_raw_length: no
vgmdb3:
    lang-priority: en, ja-latn
    source_weight: 1.0
the:
    a: yes
    patterns: []
    the: yes
    strip: no
    format: '{0}, {1}'
pathfields: {}
album_fields: {}
discogs:
    tokenfile: discogs_token.json
    user_token: REDACTED
    apikey: REDACTED
    apisecret: REDACTED
    source_weight: 0.5
edit:
    itemfields: track title artist album
    albumfields: album albumartist
    ignore_fields: id path
duplicates:
    count: no
    full: no
    format: ''
    keys: []
    move: ''
    tag: ''
    path: no
    copy: ''
    tiebreak: {}
    album: no
    strict: no
    checksum: ''
    merge: no
    delete: no
sampsyo commented 6 years ago

Wow! That is indeed weird!

In order to help out, we'll need a lot more detail—we'll need to rely on you to dig deeply and formulate some hypotheses. Please investigate more to see if you can come up with a phenomenon we can reproduce on our own machines. For example, you might try seeing at which step in this processs things went wrong by trying the commands again in isolation.

I also notice you have a customized replace configuration that replaces several patterns with underscores. Some of the rules look very broad and could misfire. Have you tried investigating that?

shimizurei commented 6 years ago

I could not replicate the issue, but I did find a typo in my "singleton" file naming structure.

Seeing as how my metadata is still intact, how do I get each file back to its respective album folder? I've been trying for hours now using -g, -AW, and regular import, but they all just go into folders with the albumartist in the singleton (_NoAlbum) folder. Whatever caused the underscores really janked my filenames and nothing is going back to how it was before :(

sampsyo commented 6 years ago

Apologies, but this is again not enough detail for us to help. We need specific instructions to create the problem you're seeing in order to understand it. You might be interested in some advice about how to write bug reports: https://www.cs.cornell.edu/~asampson/blog/bugrubric.html

shimizurei commented 6 years ago

Nevermind. Sorry, I couldn't replicate the underline thing. I'll keep an eye out for it.

To any future passers-by, I had already separated the tracks back into albums. I changed my singletons option under import to no since I was working exclusively with albums. Then I imported with -g: beet import -g [YOUR PATH] and then just did "use as-is" to everything since all the tagging had previously been done.

schumar commented 5 years ago

I think the problem is that you have enclosed all regexps in []. Especially bad:

replace:
    '[^\.]': _

This will replace all characters that are not (^) a full stop (\.) with an underscore.

Yes, it's confusing that ^ at the start of an regexp means "start of string", and in [] is "not".