beetbox / beets

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

beet update deletes custom album type #4419

Closed emanuele-virgillito closed 2 years ago

emanuele-virgillito commented 2 years ago

Problem

I have defined a custom albumtype 'collection' with the album types plugin. Everytime i issue beet update it proposes to remove the relative albumtype field with an empty value

beet update -p albumtype:collection

Led to this problem:

root@beets:/# beet update -p albumtype:collection
/beets-copyartifacts/beetsplug/copyartifacts.py:8: UserWarning: beets.mediafile is deprecated; use mediafile instead
  from beets.mediafile import TYPES
[29222] [2590] [False] Various Artists - The Winans - Let My People Go (New Club Mix) [1985] -  - 0000 - [MP3 - 320kbps 7:38 18350438]
  albumtype: collection ->
  albumartist: Various Artists ->
  title: The Winans - Let My People Go (New Club Mix) [1985] ->
[29306] [2591] [False] Various Artists - passengers - he's speedy like gonzales -  - 0000 - [MP3 - 320kbps 6:33 15734472]
  albumtype: collection ->
  albumartist: Various Artists ->
  title: passengers - he's speedy like gonzales ->
[29425] [2597] [False] Various Artists - 01 - Delegation - You And I -  - 0000 - [MP3 - 320kbps 5:14 12560752]
  track: 01 -> 00
  albumtype: collection ->
  albumartist: Various Artists ->
  title: 01 - Delegation - You And I ->
[29430] [2597] [False] Various Artists - 05 - Sister Power - Gimme Back My Love Affair -  - 0000 - [MP3 - 256kbps 7:38 14688326]
  track: 05 -> 00
  albumtype: collection ->
  albumartist: Various Artists ->
  title: 05 - Sister Power - Gimme Back My Love Affair ->
[29407] [2595] [False] Various Artists - 11b -  Don Armando's Second Avenue Rhumba Band - Deputy Of Love -  - 0000 - [MP3 - 320kbps 8:05 19433524]
  track: 11 -> 00
  albumtype: collection ->
  albumartist: Various Artists ->
  title: 11b -  Don Armando's Second Avenue Rhumba Band - Deputy Of Love ->
[29664] [2611] [False] Various Artists - 15 - Danielle - Let's Have A Party 1979 12'' -  - 0000 - [MP3 - 320kbps 6:33 15742826]
  track: 15 -> 00
  albumtype: collection ->
  albumartist: Various Artists ->
  title: 15 - Danielle - Let's Have A Party 1979 12'' ->
[26885] [2579] [False] Various Artists - Carletto Principe Dei Mostri - [Collection] Trashate - 0000 - [MP3 - 320kbps 3:12 7724076]
  albumtype: collection ->
[26940] [2579] [False] Various Artists - Super - [Collection] Trashate - 0000 - [MP3 - 320kbps 3:59 9568287]
  albumtype: collection ->
[26969] [2579] [False] Various Artists - Love At First Sight (Kid Creme Vocal Dub) - [Collection] Trashate - 0000 - [MP3 - 320kbps 6:25 15433357]
  albumtype: collection ->
[26970] [2579] [False] Various Artists - Love At First Sight - [Collection] Trashate - 0000 - [MP3 - 320kbps 4:03 9726029]
  albumtype: collection ->
[26991] [2579] [False] Various Artists - Living On V

Here's a link to the music files that trigger the bug (if relevant):

Setup

My configuration (output of beet config) is:

root@beets:/# beet config
/beets-copyartifacts/beetsplug/copyartifacts.py:8: UserWarning: beets.mediafile is deprecated; use mediafile instead
  from beets.mediafile import TYPES
directory: /media/music-library/library
library: /mnt/efesto-data/beets/library.db
ignore:
- .*
- '*~'
- System Volume Information
- lost+found
- '@eaDir'
ignore_hidden: yes

clutter:
- Thumbs.db
- .DS_Store
- '*.m3u'
- '*.pls'
- '*.db'
asciify_paths: yes
art_filename: cover

format_item: '[$id] [$album_id] [$singleton] $albumartist - $title - $album - $original_year - [$format - $bitrate $length $filesize]'
format_album: '[$id] $albumartist - $album - $original_year [$catalognum]'
threaded: yes
per_disc_numbering: yes
original_date: no

aunique:
    keys: albumartist album
    disambiguators: catalognum label year albumtype albumdisambig releasegroupdisambig
    bracket: '[]'

ui:
    color: yes

import:
    write: yes
    move: yes
    copy: no
    delete: no
    resume: ask
    incremental: no
    incremental_skip_later: yes
    from_scratch: no
    quiet: no
    timid: yes
    log: /mnt/efesto-data/beets/beets-log.log
    detail: yes
    group_albums: no
    bell: yes

musicbrainz:
    enabled: no

match:
    strong_rec_thresh: 0.07
    medium_rec_thresh: 0.25
    rec_gap_thresh: 0.25
    max_rec:
        missing_tracks: medium
        unmatched_tracks: medium
    preferred:
        media: [CD, Vinyl]
        original_year: no
    ignored: []
    ignore_video_tracks: yes
    ignore_data_tracks: yes
    ignored_media:
    - Data CD
    - DVD
    - DVD-Video
    - Blu-ray
    - HD-DVD
    - VCD
    - SVCD
    - UMD
    - VHS

plugins:
- albumtypes
- bpd
- convert
- discogs
- duplicates
- edit
- export
- fetchart
- fromfilename
- hook
- info
- inline
- mbsync
- missing
- rewrite
- types
- web
- usertag
- spotify
- copyartifacts

paths:
    singleton: Non-Album/%lower{%asciify{$artist}}/%lower{%asciify{$artist}} - %lower{%asciify{$title}}
    comp: Compilations/%lower{%asciify{$album}} %lower{$atypes} [%lower{%asciify{$catalognum}}] %lower{[%aunique{}]}/%if{disctotal>1, $disc}$track %lower{%asciify{$artist}} - %lower{%asciify{$title}}
    default: Album/%lower{%asciify{$albumartist}}/[$original_year] %lower{%asciify{$albumartist}} - %lower{%asciify{$album}} %lower{$atypes} [%lower{%asciify{$catalognum}}] %lower{%aunique{}}/%if{$multidisc, disc $disc_number/}$disc_and_track %lower{%asciify{$artist}} - %lower{%asciify{$title}}
    albumtype:liverec: Live-Recordings/%lower{%asciify{$album}}/$track. %lower{%asciify{$artist}} - %lower{%asciify{$title}}
    albumtype:collection: Collections/%lower{%asciify{$album}}/$track. %lower{%asciify{$artist}} - %lower{%asciify{$title}}
scrub:
    auto: no
copyartifacts:
    print_ignored: yes
    extensions: .*
edit:
    itemfields: track title artist album disc disctitle disctotal tracktotal
    albumfields: album albumartist albumtype
    ignore_fields: id path
item_fields:
    multidisc: 1 if disctotal > 1 else 0
    disc_number: "if disctotal > 1 and disctotal < 10:\n  return '{:01d}'.format(disc)\nelif disctotal > 9:\n  return '{:02d}'.format(disc)\n"
    disc_and_track: "if disctotal > 1 and disctotal < 10:\n  return '{:01d}.{:02d}'.format(disc, track)\nelif disctotal > 9:\n  return '{:02d}.{:02d}'.format(disc, track)\nelse:\n  return '{:02d}'.format(track)\n"
albumtypes:
    types:
    -   ep: EP
    -   single: Single
    -   soundtrack: OST
    -   live: Live
    -   compilation: Compilation
    -   remix: Remix
    -   liverec: Live Recording
    -   collection: Collection
    ignore_va: compilation
    bracket: '[]'
discogs:
    user_token: REDACTED
    index_tracks: yes
    apikey: REDACTED
    apisecret: REDACTED
    tokenfile: discogs_token.json
    source_weight: 0.5
    separator: ', '
    append_style_genre: no
bandcamp:
    source_weight: 2.5
    preferred_media: Vinyl,CD,Cassette
    include_digital_only_tracks: yes
    search_max: 5
    art: yes
    comments_separator: '

        ---

        '
    exclude_extra_fields: []
    genre:
        capitalize: yes
        maximum: 0
        always_include: []
        mode: progressive
spotify:
    source_weight: 0.0
    mode: open
    show_failures: no
    tiebreak: first
    artist_field: albumartist
    album_field: album
    track_field: title
    region_filter:
    regex: []
    client_id: 4e414367a1d14c75a5c5129a627fcab8
    client_secret: REDACTED
    tokenfile: spotify_token.json
duplicates:
    checksum: ''
    album: no
    copy: ''
    count: no
    delete: no
    format: ''
    full: no
    keys: []
    merge: no
    move: ''
    path: no
    tiebreak: {}
    strict: no
    tag: ''
fetchart:
    auto: yes
    cautious: yes
    cover_names: cover
    quality: 100
    store_source: yes
    sources:
    - filesystem
    -   coverart: release
    -   coverart: releasegroup
    - itunes
    - '*'
    minwidth: 0
    maxwidth: 0
    max_filesize: 0
    enforce_ratio: no
    google_key: REDACTED
    google_engine: 001442825323518660753:hrh5ch1gjzm
    fanarttv_key: REDACTED
    lastfm_key: REDACTED
    high_resolution: no
    deinterlace: no
    cover_format:
types:
    rating: int
web:
    host: 192.168.1.20
    include_paths: yes
    port: 8337
    cors: ''
    cors_supports_credentials: no
    reverse_proxy: no
    readonly: yes
export:
    default_format: json
    json:
        formatting:
            ensure_ascii: no
            indent: 4
            separators: &id001 [',', ': ']
            sort_keys: yes
    jsonlines:
        formatting:
            ensure_ascii: no
            separators: *id001
            sort_keys: yes
    csv:
        formatting:
            delimiter: ','
            dialect: excel
    xml:
        formatting: {}
convert:
    dest:
    pretend: no
    link: no
    hardlink: no
    threads: 4
    format: mp3
    id3v23: inherit
    formats:
        aac:
            command: ffmpeg -i $source -y -vn -acodec aac -aq 1 $dest
            extension: m4a
        alac:
            command: ffmpeg -i $source -y -vn -acodec alac $dest
            extension: m4a
        flac: ffmpeg -i $source -y -vn -acodec flac $dest
        mp3: ffmpeg -i $source -y -vn -aq 2 $dest
        opus: ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest
        ogg: ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest
        wma: ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest
    max_bitrate: 500
    auto: no
    auto_keep: no
    tmpdir:
    quiet: no
    embed: yes

    paths: {}
    no_convert: ''
    never_convert_lossy_files: no
    copy_album_art: no
    album_art_maxwidth: 0
    delete_originals: no
pathfields: {}
album_fields: {}
hook:
    hooks: []
missing:
    count: no
    total: no
    album: no
rewrite: {}
bpd:
    host: ''
    port: 6600
    control_port: 6601
    password: REDACTED
    volume: 100
arsaboo commented 2 years ago

I've not used the plugin but just looking at the docs, it looks like you have an extra colon (:) in the path. You only need albumtype:liverec - remove the colon after that. Hopefully that works.

sampsyo commented 2 years ago

Hello! The update command reads in the current on-disk metadata for files and updates the beets library database accordingly. So this behavior indicates that the files don't have on-disk tags for the album type. You might consider doing beet write to first put this metadata from the database into the files, if that's what you want.

emanuele-virgillito commented 2 years ago

@sampsyo that was actuallty the reason. closing the issue, thank you