beetbox / beets

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

Folders left behind with .jpg file after moving files despite *.jpg in clutter #5016

Open jdrewsteiner opened 10 months ago

jdrewsteiner commented 10 months ago

Problem

Folders that are processed by beets (all music files are moved out of the folder) are not always being deleted. Often times they are left behind with only a single .jpg file remaining even though I have *.jpg added to my clutter list.

Setup

My configuration (output of beet config) is:


plugins: fetchart embedart lastgenre inline ftintitle zero bucket duplicates web
# plexupdate

#- /volume1/data/torrents/incoming/music:/downloads
#- /volume1/data/media/music:/music
directory: /music/
library: /config/musiclibrary.blb 
art_filename: albumart
threaded: yes
original_date: yes
per_disc_numbering: yes

# If [x] and other non standard signs won't be printed correctly try some different values here
# https://docs.python.org/2/library/codecs.html#standard-encodings
terminal_encoding: utf-8

bucket:
  bucket_alpha:
    - "#-!"
    - "0-9"
    - "A"
    - "B"
    - "C"
    - "D"
    - "E"
    - "F"
    - "G"
    - "H"
    - "I"
    - "J"
    - "K"
    - "L"
    - "M"
    - "N"
    - "O"
    - "P"
    - "Q"
    - "R"
    - "S"
    - "T"
    - "U"
    - "V"
    - "W"
    - "X"
    - "Y"
    - "Z"
  bucket_alpha_regex:
    "#-!": ^[^a-zA-Z]
  bucket_year: []
  extrapolate: no

# Each line is a small python script which should return a string or an int
item_fields:
# 'Nine Inch Nails - ' or '' depending if the artist differs from the album artist
  mySongartist: artist + ' - ' if artist != albumartist and artist != '' else ''

# Release with multiple discs? For boolean operations
  isMultidisc: 1 if disctotal > 1 else 0

# Changes the case of the album type 
  myAlbumType: ('' if albumtype == '' else ' [' + ('EP' if albumtype == 'ep' else albumtype.capitalize()) + ']')

# '1 - ' or '' depending if there are multiple discs or not
  myDisc: ('' if disctotal <= 1 else str(disc) + ' - ')

# First Charachter of Artist
  #initial: albumartist[0].upper() if albumartist[0:4].lower() != 'the ' and albumartist[0].isalpha() else albumartist[4].upper() if albumartist[4].isalpha() and albumartist[0:4].lower() == 'the ' else "#"
  initial: albumartist[4].upper() if albumartist[0:4].lower() == 'the ' else albumartist[0].upper() 
#  initial:
#   if albumartist[0:4].lower() == 'the ':
#     albumartist[4].upper()
#   else:
#     albumartist[0].upper()

album_fields:
#  bitrate: |
#    if items[0].format.upper() == "MP3":
#      total = 0
#      for item in items:
#          total += item.bitrate
#      return total / len(items)
#    else: return items[0].format
  iscd: |
    return "CD" in items[0].media
  mediatype: |
    mediaList = {
      '12" Vinyl': "Vinyl",
      '7" Vinyl': "Vinyl",
      "Digital Media": "WEB",
    }
    try:
      return mediaList[items[0].media]
    except KeyError:
      return items[0].media
  bitdepthmost: |
    bitdepths = dict()
    for item in items:
      try:
        bitdepths[item.bitdepth] += 1
      except KeyError:
        bitdepths[item.bitdepth] = 1
    sorted_depths = {k: v for k, v in sorted(bitdepths.items(), key=lambda item: item[1])}
    return list(sorted_depths)[-1]
  sampleratemost: |
    samplerates = dict()
    for item in items:
      try:
        samplerates[item.samplerate] += 1
      except KeyError:
        samplerates[item.samplerate] = 1
    sorted_rates = {k: v for k, v in sorted(samplerates.items(), key=lambda item: item[1])}
    formatted_num = int(list(sorted_rates)[-1]/1000) if int(list(sorted_rates)[-1]/1000) == float(list(sorted_rates)[-1]/1000) else float(list(sorted_rates)[-1]/1000)
    return str(formatted_num) + "kHz"
  bettercatalognum: |
    return items[0].catalognum if items[0].catalognum != "[none]" else ""
  mp3_quality: |
    if items[0].format.upper() == "MP3":
      total_bitrate = 0
      for item in items:
        total_bitrate += item.bitrate
      average_bitrate = total_bitrate / len(items) / 1000
      if average_bitrate == 320:
        return "320"
      elif average_bitrate == 192:
        return "192"
      elif average_bitrate == 160:
        return "160"
      elif average_bitrate == 128:
        return "128"
      elif average_bitrate >= 200:
        return "V0"
      else:
        return "TOO LOW FIND NEW SOURCE"
    else: return items[0].format 

#paths:
#  default: %bucket{$albumartist,alpha}/$albumartist/($year) $album %if{$bettercatalognum, {$bettercatalognum$}} [%if{$iscd,$mediatype - $format,%if{$mediatype,$mediatype - }$format - %if{$bitdepth,$bitdepthmost,$mp3_quality} - $sampleratemost}]/$disc-$track - $title
#  singleton: -singles/%bucket{$artist,alpha}/$artist/$title ($year)%if{$bettercatalognum, {$bettercatalognum$}} [%if{$iscd,$mediatype - $format,%if{$mediatype,$mediatype - }$format - %if{$bitdepth,$bitdepthmost,$mp3_quality} - $sampleratemost}]/$title
#  comp: -compilations/VA - $album ($year)%if{$bettercatalognum, {$bettercatalognum$}} [%if{$iscd,$mediatype - $format,%if{$mediatype,$mediatype - }$format - %if{$bitdepth,$bitdepthmost,$mp3_quality} - $sampleratemost}]/$disc-$track. $artist - $title

paths:
# For the normal albums and eps. Used when none of the other paths should be used
# Interpreten/boysetsfire/(2000) After the Eulogy [Album]/02 - Rookie.flac
# Interpreten/Oliver Koletzki/(2019) We Are All Lost/1 - 02 - Oliver Koletzki; Monolink - We Are All Lost.flac
  #default: $initial/$albumartist/($year) $album%aunique{}$myAlbumType [$bitrate]/%if{$isMultidisc,$disc - }$track - $mySongartist$title
 # (last best) default: %bucket{$initial,alpha}/$albumartist/$albumartist - ($year) $album%aunique{}$myAlbumType [$mp3_quality]/%if{$isMultidisc,$disc - }$track - $mySongartist$title
  default: %bucket{$initial,alpha}/$albumartist/$albumartist - ($year) $album%aunique{}$myAlbumType [$mp3_quality]/%if{$isMultidisc,$disc - }$track - $mySongartist$title

# For individual tracks not part of an entire album. Used when 'singleton:true' is set 
  #singleton: -singles/$initial/$artist/$artist - $title

# For sampler and compilations. Used when 'comp:true' is set
# Compilations/Giegling/(2017) Planet Giegling/03 - Kettenkarussell - Walk With Me.flac
  comp: -compilations/VA - $album%aunique{} ($year)/%if{$isMultidisc,$disc - }$track $artist - $title

# For Soundtracks. Used when 'albumtype:soundtrack'
# Soundtracks/Trent Reznor & Atticus Ross/Watchmen_ Volume 1 (Music From the HBO Series) (2019)/04 - Trent Reznor & Atticus Ross - Nun With a Motherf_&_ing Gun.flac
  albumtype:soundtrack: -soundtracks/$albumartist/$album%aunique{} ($year)/%if{$isMultidisc,$disc - }$track $artist - $title

#  genre:classical: -classical/

import:
  write: yes
  copy: no
  move: yes
  autotag: yes
  resume: ask
  incremental: no
  quiet: no
  quiet_fallback: skip
  timid: no
  log: /config/beet.log

lastgenre:
  auto: yes
  source: album
  count: 3

zero:
  fields: comments

duplicates:
  count: yes
  album: yes
  delete: yes
  merge: yes

ignore_hidden: yes

match:
  strong_rec_thresh: 0.10
#  ignored: missing_tracks unmatched_tracks

ignore: .AppleDouble ._* *~ .DS_Store *.nfo *.ini *.xml *.db *.DB *.sfk *.mediaartlocal *.sfv *.m3u *.m3u8 *.cue *.jpg *.jpeg *.bmp *.png Thumbs.DB *.pls *.url .drive_sync *.txt *.log *.pdf *.exe *.ico
clutter: .AppleDouble ._* *~ .DS_Store *.nfo *.ini *.xml *.db *.DB *.sfk *.mediaartlocal *.sfv *.m3u *.m3u8 *.cue *.jpg *.jpeg *.bmp *.png Thumbs.DB *.pls *.url .drive_sync *.txt *.log *.pdf *.exe *.ico

embedart:
    auto: yes

fetchart:
  auto: yes
  cover_names: cover front album art
  minwidth: 500
  enforce_ratio: yes
  fanarttv_key: REDACTED
  google_key: REDACTED
  sources: coverart albumart amazon google fanarttv filesystem

ftintitle:
  auto: yes
  format: (feat. {0})

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

replace:
    '^\.': _
    '[\x00-\x1f]': _
    '[<>:"\?\*\|]': _
    '[\xE8-\xEB]': e
    '[\xEC-\xEF]': i
    '[\xE2-\xE6]': a
    '[\xF2-\xF6]': o
    '[\xF8]': o
    '\.$': _
    '\s+$': ''

#plex:
#  host: xxxxxxxx
#  port: xxxxx
#  token: xxxxx
#  library_name: "Music"

#web:
#    host: 0.0.0.0
#    port: 8337
sampsyo commented 10 months ago

Hi! Could you please put your configuration into a code block so we can read it? It would also be very helpful to see ls -R output from the directories in question, before and after an import.

jdrewsteiner commented 10 months ago

Sorry. Fixed that. I'll try yo get the ls -R output as well. Might be a bit.