User Tools

Site Tools


config:beets

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
config:beets [2024/03/21 21:54] Wulf Rajekconfig:beets [2024/12/24 01:08] (current) – [Path template information] Wulf Rajek
Line 7: Line 7:
 <code> <code>
 #mint21 #mint21
-sudo apt-get install libchromaprint1 +sudo apt-get install libchromaprint1 mp3val flac python3-acoustid
- +
-sudo apt-get install python3-acoustid+
 sudo apt-get remove python-pip sudo apt-get remove python-pip
 sudo apt-get install python3-setuptools sudo apt-get install python3-setuptools
 +
 sudo easy_install pip sudo easy_install pip
 pip install beets pip install beets
Line 20: Line 19:
 pip install discogs-client pip install discogs-client
 pip install beets-web-import pip install beets-web-import
 +pip install python3-discogs-client
 +# see notes below to patch copyartifacts
 pip install beets-copyartifacts pip install beets-copyartifacts
-2to3-2.7 -w ~/.local/lib/python3.10/site-packages/beetsplug/copyartifacts.py 
- 
-#adjust as following: 
-#line 104: 
-                file_ext = os.path.splitext(filename)[1].decode('utf8') 
-#line 143: 
-                print('   ', str(os.path.basename(f.decode('utf8')))) 
-#line 147: 
-        print('Copying artifact: {0}'.format(os.path.basename(dest_file.decode('utf8')))) 
-#line 156: 
-        print('Moving artifact: {0}'.format(os.path.basename(dest_file.decode('utf8')))) 
- 
-#add line 127 
-                dest_file = beets.util.bytestring_path(dest_file) 
- 
- 
-vi ~/.local/lib/python3.10/site-packages/beets/autotag/__init__.py 
-change line 75 from 
-def unidecode_punc_only(text): 
-to 
-def unicode_punc_only(text): 
- 
- 
  
 #Buggy as of 19/Sept/2020: #Buggy as of 19/Sept/2020:
 pip install beets-copyartifacts3 pip install beets-copyartifacts3
 pip install beets-extrafiles pip install beets-extrafiles
 +
 +#Mint22:
 +sudo apt-get install python3-acoustid libchromaprint1 mp3val flac
 +pipx install beets
 +pipx inject beets flask=2.2.5 discogs_client requests pylast pyacoustid pycairo pygobject python3-discogs-client discogs-client beets-copyartifacts beets-extrafiles
 +pipx inject beets beets-yearfixer beets-web-import
 +pipx inject beets git+https://github.com/edgars-supe/beets-importreplace.git
 +
 </code> </code>
  
Line 55: Line 41:
 </code> </code>
  
-Latest source snapshot tarball installation:+As beets 1.6.0 is a bit buggy and 3 years old, use latest source snapshot tarball installation:
 <code> <code>
 pip uninstall beets pip uninstall beets
Line 61: Line 47:
 </code> </code>
  
-====== Unicode in Tag replace ======+====== copyartifacts python3 patch ====== 
 +<code> 
 +2to3-2.7 -w ~/.local/lib/python3.10/site-packages/beetsplug/copyartifacts.py
  
-https://github.com/edgars-supe/beets-importreplace+#Mint22: 
 +sudo apt-get install 2to3 
 +2to3 -w ~/.local//share/pipx/venvs/beets/lib/python3.12/site-packages/beetsplug/copyartifacts.py 
 +</code> 
 +then adjust as following:
 <code> <code>
-pip install git+https://github.com/edgars-supe/beets-importreplace.git+#line 104: 
 +                file_ext = os.path.splitext(filename)[1].decode('utf8'
 +#line 143: 
 +                print('   ', str(os.path.basename(f.decode('utf8')))) 
 +#line 147: 
 +        print('Copying artifact: {0}'.format(os.path.basename(dest_file.decode('utf8')))) 
 +#line 156: 
 +        print('Moving artifact: {0}'.format(os.path.basename(dest_file.decode('utf8')))) 
 + 
 +#add line 127 
 +                dest_file = beets.util.bytestring_path(dest_file) 
 +</code> 
 +Change the init: 
 +<code> 
 +vi ~/.local/lib/python3.10/site-packages/beets/autotag/__init__.py 
 +</code> 
 +<code> 
 +#change line 75 from 
 +def unidecode_punc_only(text): 
 +#to 
 +def unicode_punc_only(text):
 </code> </code>
  
 ====== Unicode in Tag Patch ====== ====== Unicode in Tag Patch ======
 +
 +NOTE: use import-replace plugin instead!
  
 MusicBrainz uses unicode characters for apostrophes, dashes etc rather than ascii versions. A beets plugin for filenames (asciify) solves some issues with this, but tags are unaffected. This patch for v1.5.0/v1.6.0 on python 3.8 solves this for imports: MusicBrainz uses unicode characters for apostrophes, dashes etc rather than ascii versions. A beets plugin for filenames (asciify) solves some issues with this, but tags are unaffected. This patch for v1.5.0/v1.6.0 on python 3.8 solves this for imports:
Line 151: Line 165:
 <code> <code>
 vi ~/.local/lib/python3.10/site-packages/beets/ui/commands.py vi ~/.local/lib/python3.10/site-packages/beets/ui/commands.py
-#add as line 476:+#add as line 476 in beets 1.6.0, around line 740 in beets 1.6.1:
         summary_parts.append(displayable_path(item.path))         summary_parts.append(displayable_path(item.path))
 </code> </code>
Line 229: Line 243:
     search_ids: []     search_ids: []
     duplicate_action: ask     duplicate_action: ask
 +    #duplicate verbose uses format_item settings
 +    duplicate_verbose_prompt: yes
     bell: no     bell: no
     set_fields: {}     set_fields: {}
Line 239: Line 255:
 ignore: [".*", "*~", "System Volume Information", "lost+found", "cover.jpg"] ignore: [".*", "*~", "System Volume Information", "lost+found", "cover.jpg"]
 ignore_hidden: yes ignore_hidden: yes
- 
 # replace special characters in generated filenames # replace special characters in generated filenames
 replace: replace:
Line 247: Line 262:
     '[<>\?\*\|]': _     '[<>\?\*\|]': _
     '[:]': ' -'     '[:]': ' -'
 +    # dot at end of directories causes problems with some clients on samba shares
     '\.$': _     '\.$': _
     '\s+$': ''     '\s+$': ''
Line 254: Line 270:
     '[\u2018\u2019]': ''''     '[\u2018\u2019]': ''''
     '[\u201c\u201d]': '"'     '[\u201c\u201d]': '"'
 +    '[\x91\x92]': "'"
     # double quotes to single quote     # double quotes to single quote
     '"': ''''     '"': ''''
Line 278: Line 295:
   track: []   track: []
  
-plugins: [fetchart,lyrics,lastgenre,embedart,bucket,the,chroma,ftintitle,discogs,scrub,inline,fromfilename,edit,importadded,duplicates,replaygain]+plugins: [fetchart,lyrics,lastgenre,embedart,bucket,the,chroma,ftintitle,discogs,scrub,inline,fromfilename,edit,importadded,duplicates,replaygain,web,bpd,webimport,yearfixer,zero,badfiles,importreplace]
 #copyartifacts broken #copyartifacts broken
 pluginpath: [] pluginpath: []
Line 310: Line 327:
 #Define how to show items using the list command (formerly list_format_item/list_format_album) #Define how to show items using the list command (formerly list_format_item/list_format_album)
 format_item: %upper{$artist} - $album - $track. $title ($length) format_item: %upper{$artist} - $album - $track. $title ($length)
-format_album: %upper{$albumartist} - $album [$year]+format_album: %upper{$albumartist} - $album [$year] ($totaltracks)
 #format_item: $artist - $album - $title #format_item: $artist - $album - $title
 time_format: '%Y-%m-%d %H:%M:%S' time_format: '%Y-%m-%d %H:%M:%S'
Line 328: Line 345:
     original_date: "'-'.join(filter(None, (original_year and f'{original_year:04}', original_month and f'{original_month:02}', original_day and f'{original_day:02}')))"     original_date: "'-'.join(filter(None, (original_year and f'{original_year:04}', original_month and f'{original_month:02}', original_day and f'{original_day:02}')))"
     album_year: f'{year:04}'     album_year: f'{year:04}'
 +album_fields:
 +    totaltracks: str(items[0].tracktotal) + ' tracks'
 +    album_ends_with_ep: 1 if str({album})[-2:] == "EP" else 0
  
 # Paths and filenames for music files relative to music directory # Paths and filenames for music files relative to music directory
Line 335: Line 355:
     default: Album/%bucket{%the{$albumartist},alpha}/%the{$albumartist}/$albumartist - $album%aunique{} [$year]/$albumartist - $disc_and_track - $title     default: Album/%bucket{%the{$albumartist},alpha}/%the{$albumartist}/$albumartist - $album%aunique{} [$year]/$albumartist - $disc_and_track - $title
     singleton: Non-Album/%bucket{%the{$artist}}/$artist - $title     singleton: Non-Album/%bucket{%the{$artist}}/$artist - $title
 +    albumtype:ep: Album/%bucket{%the{$albumartist},alpha}/%the{$albumartist}/$albumartist - $album%aunique{}%if{$album_ends_with_ep,, EP} [$year]/$albumartist - $disc_and_track - $title
     albumtype:soundtrack: Soundtracks/$album%aunique{} [$year]/$disc_and_track - $artist - $title     albumtype:soundtrack: Soundtracks/$album%aunique{} [$year]/$disc_and_track - $artist - $title
     comp: Compilations/%bucket{$year}/%the{$album%aunique{}}/$disc_and_track - $artist - $title     comp: Compilations/%bucket{$year}/%the{$album%aunique{}}/$disc_and_track - $artist - $title
Line 344: Line 365:
     ratelimit: 1     ratelimit: 1
     ratelimit_interval: 1.0     ratelimit_interval: 1.0
-    searchlimit: 10+    searchlimit: 20
     extra_tags: []     extra_tags: []
  
Line 369: Line 390:
         tracks: 4.0 #default 2         tracks: 4.0 #default 2
         missing_tracks: 0.9         missing_tracks: 0.9
-        unmatched_tracks: 0.6+        unmatched_tracks: 0.4 #default 0.6
         track_title: 3.0         track_title: 3.0
         track_artist: 2.0         track_artist: 2.0
Line 376: Line 397:
         track_id: 5.0         track_id: 5.0
     preferred:     preferred:
-        countries: [US, GB|UK, JP, DE] +        countries: ['XW', 'US''GB|UK''JP''DE'
-        media: [CD, Digital Media|File]+        media: ['Digital Media', 'CD', 'File']
         original_year: yes         original_year: yes
     ignored: []     ignored: []
Line 408: Line 429:
  
 lyrics: lyrics:
-    auto: no+    auto: yes
     on_import: true     on_import: true
     processes: 10     processes: 10
Line 414: Line 435:
     fallback: ''     fallback: ''
  
 +#moves featured artists from artists to the title field
 ftintitle: ftintitle:
     auto: yes     auto: yes
 +    format: feat. {0}
  
 #Scrub plugin removes all non-beet tags #Scrub plugin removes all non-beet tags
Line 427: Line 450:
  
 edit:  edit: 
-    itemfields: track title artist album year+    itemfields: track title artist album year albumartist artist_sort artist_credit
     albumfields: album albumartist year     albumfields: album albumartist year
  
Line 435: Line 458:
  
 duplicates: duplicates:
-    checksum: no # expensive+    # creating checksums is expensive 
 +    #checksum: no
     #By default, the tie-breaking procedure favors the most complete metadata attribute set. If you would like to consider the lower bitrates as duplicates, for example, set      #By default, the tie-breaking procedure favors the most complete metadata attribute set. If you would like to consider the lower bitrates as duplicates, for example, set 
     tiebreak: { items: [bitrate] }     tiebreak: { items: [bitrate] }
Line 450: Line 474:
     #manual analysis  beet replaygain -wf /my/music/directory     #manual analysis  beet replaygain -wf /my/music/directory
     #Note this takes about 10 seconds for 7 files which is about 6h for 15k songs.     #Note this takes about 10 seconds for 7 files which is about 6h for 15k songs.
 +   
 +web:
 +    host: 0.0.0.0
 +    port: 8337
 +
 +webimport:
 +    host: 0.0.0.0
 +    port: 8338
 +
 +bpd:
 +    host: 127.0.0.1
 +    port: 6600
 +    password: seekrit
 +    volume: 30
 +
 +acoustid:
 +    apikey: 9NQqkUUg6p
 +
 +# null/remove specific tag fields on import (not when importing as-is)
 +# regex condition on comments field, this removes useless comments:
 +zero:
 +    fields: comments
 +    comments: [EAC, LAME, from.+collection, 'ripped by']
 +    update_database: true
 +
 +# check integrity of files on import, note that mp3val
 +# required for mp3s: apt-get install mp3val
 +# mp3val is quite verbose, multiple stream errors indicate issues
 +badfiles:
 +    check_on_import: yes
 +    commands:
 +      mp3: mp3val -f -si -nb -t
 +
 +#replace unicode apostrophes from mb with ascii version in tags
 +importreplace:
 +  replacements:
 +    - item_fields: title artist artist_sort artist_credit
 +      album_fields: album artist artist_sort artist_credit
 +      replace:
 +        '[\u2018-\u201B]': ''''
 +        '[\u201C-\u201F]': '"'
 +        '[\u2010-\u2015]': '-'
  
 </code> </code>
Line 480: Line 546:
 beet import -A -C -W -I -s /media/music/beets2/Non-Album/ beet import -A -C -W -I -s /media/music/beets2/Non-Album/
 </code> </code>
 +Update id3 tags after changing db 
 +<code> 
 +beet write 
 +</code>
 ====== Addons ====== ====== Addons ======
  
Line 635: Line 704:
 ====== importreplace ====== ====== importreplace ======
  
-A plugin for beets to perform regex replacements during import.+A plugin for beets to perform regex replacements during import, particularly useful to replace unicode apostrophes, double quotes, single quotes and hyphens/en dash from musicbrainz db with ascii equivalents.
  
 https://github.com/edgars-supe/beets-importreplace https://github.com/edgars-supe/beets-importreplace
 +
 +Installation:
 +<code>
 +pip install git+https://github.com/edgars-supe/beets-importreplace.git
 +</code>
 +
 +add config and add importreplace to plugins config string:
 +<code>
 +#replace unicode apostrophes from mb with ascii version in tags
 +importreplace:
 +  replacements:
 +    - item_fields: title artist artist_sort artist_credit
 +      album_fields: album artist artist_sort artist_credit
 +      replace:
 +        '[\u2018-\u201B]': ''''
 +        '[\u201C-\u201F]': '"'
 +        '[\u2010-\u2015]': '-'
 +</code>
 +
 +As this plugin works for import only, use the following to retag/reimport after installation, make sure to copy&paste as the below uses the unicode characters:
 +<code>
 +#for albums:
 +beet import -L ":[’”‐–—]"
 +
 +#for singletons:
 +beet import -L -s ":[’”‐–—]"
 +</code>
config/beets.1711058061.txt.gz · Last modified: by Wulf Rajek