beetbox / beets

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

Feat: Use spotify as Album / Song reference #4572

Closed Emporea closed 1 year ago

Emporea commented 1 year ago

I am looking for the possibility to use a spotify playlist url as reference to choose the right album release and so on, additionally to Musicbrainz etc .

arsaboo commented 1 year ago

You can use Spotify as a tag source. Just configure the Spotify plugin, and it will be automatically used as a tag source. You can also manually specify the album after selecting the i option during the tagging process and entering the album URL.

Emporea commented 1 year ago

So its only possible manually? I am searching for away to import a whole library using beets by providing a spotify playlist containing most of the songs. Musicbrainz has a hard time finding the correct album versions and I have a lot of duplicates or unmapped files errors. So I searched for all songs i could find on spotify and added them to a single playlist.

Then it should be possible to automatically tag those songs that match?

JOJ0 commented 1 year ago

I am not sure if I understand how a single Spotify playlist would help to match to several albums. Maybe you try to elaborate how a feature like this would work.

Tagging a rather messy library, which means with missing tags and albums not in sorted in folders already means a lot of manual work. beets can help but fully automatic is not possible in that case. Been there, done that! ;-)

Have you tried the fromfilename plugin (helps finding artist and title if those metadata tags are missing entirely from the files),

You'll find how to set it up in the plugins section of https://beets.readthedocs.io

Have you tried this option for the import command?

-g, --group-albums    group tracks in a folder into separate albums

Configure beets to use Discogs and Spotify alongside MusicBrainz as tagging sources. It helps to find as much metadata information as possible. Set your preferred source using the source_weight option. For example set 0.8 for MusicBrainz, 0.6 for Spotify and 0.4. for Discogs..

As a last resort solution with messed up tags: Use an id3 tagging tool to fix the most important tags (artist, title, album) prior to beets import.

HTH

Emporea commented 1 year ago

I am not sure how to explain it better.

I have songs on my hard drive ~3000. Some of them are part of an album, some are singles etc.

I already tried using MusicBrainz Picard and Lidarr. ~2500 have been recognized, but often Picard or Lidarr chose the wrong album, which sometimes results in having several Album Folders and my offline songs are distributed among them.

~500 havent been recognized, sometimes because there simply is no entry on MusicBrainz.

Tagging all of them invidivually is a huuuge work. I thought to myself that there must be a solution. So what I did, was try to find the correct album on Spotify to every song I have on my drive.

I did, and now I have a big playlist on spotify ~3000 individual songs.

So in theory it should be possible to give beets the URL of this spotify playlist, and beets will automatically go through everysong I have on my drive + on spotify playlist and tagg my songs on my drive according to the match in the playlist.

It should also be possible to create missing MusicBrainz Entrys by a spotify playlist. It should then parse the whole playlist and all of its songs and related albums in the specific Release version represented on spotify.

Because somehow it botheres me, That I have so much songs, and most of them are falsy recognized, and not the correct album or not even recognized at all EVEN tho I have them on spotify, which automatically means, metadata is existing in theory.

Am I thinking too complicated?

JOJ0 commented 1 year ago

Probably the time u spent for finding on spotify could have been invested better. Sorry to say and no offence! You couldnt know.

Try using spotify as a tagging source as arsaboo suggested!

Have you tried the -g option yet?

But I think your main problem is your badly tagged files. Have you checked some of them with eg mediainfo tool? Whats the situation?

JOJ0 commented 1 year ago

And no: There is no existing plugin that works by working through a list of spotify tracks and uses them as a helper/reference. Even if there would be one: How should it match spotify track to a badly tagged file with a broken tag. no artist? no title? no match possible :-))

JOJ0 commented 1 year ago

one possible solution: use only chroma plugin and nothing else!!

Emporea commented 1 year ago

Are these tags not sufficent? This is one of the 500 tracks that have no matches. image

JOJ0 commented 1 year ago

I already tried using MusicBrainz Picard and Lidarr.

Maybe a backup of prior to any of this would be a good starting point.

~2500 have been recognized, but often Picard or Lidarr chose the wrong album, which sometimes results in having several Album Folders and my offline songs are distributed among them.

This manual work can help a lot in that situation: Move files from those several album folders all into one folder! This is the main sign for beets that it's looking at an album. Usually also if files within that folder now have different album tags, beets will try to tag them to have one album! Most important in that situatio: The track number tag should be alright! Alternatively beets will try to match by mm:ss of the track

HTH

JOJ0 commented 1 year ago

Are these tags not sufficent? This is one of the 500 tracks that have no matches. image

Those tags look good. Are you really sure that your tagging source has that album? What are u using? Which source plugins?

On Discogs I found the release: https://www.discogs.com/release/14460272-Johannes-Brahms-Amadeus-Quartett-Christoph-Eschenbach-Klavierquintett-F-moll-Op-34-

Are you using Discogs as a source plugin?

Check if it is on MusicBrainz, if this is the only source you are using! And again: From my personal experiene: Ther is no source on the internet that has everything. At least that's the experience I have with my rather diverse music collection!

What's your metadata sources?

Emporea commented 1 year ago

No i havent used discogs. I only used musicbrainz so far.

What do you propose my config.yaml should look like / which taggimg sources do you suggest. Should i even still use spotify?

Btw. Thanks that you are trying to head me in the right direction via this github issue. Appreciate it!

JOJ0 commented 1 year ago

Welcome! Try looking up what I describe in this post in the reference docs: https://github.com/beetbox/beets/issues/4572#issuecomment-1338882195

Post your config here and I'll take a look then!

Docs:https://beets.readthedocs.io/en/latest/plugins/index.html#using-metadata-source-plugins

arsaboo commented 1 year ago

@Emporea Please note that beets treats each album separately, and there is no way (at least to my knowledge) of providing a bunch of links to match. You will have to tag each album.

If you are willing to spend some time pre-processing the data, you may be able to use --search-id option https://beets.readthedocs.io/en/v1.6.0/reference/cli.html#import

JOJ0 commented 1 year ago

@Emporea did you try out the suggestions in this thread? Can this issue be closed? Hope something helped! :-)

Emporea commented 1 year ago

Well it helped a little bit because it made me realize i have to tag everything manually. Still need to do it tho. 3000 songs doesnt tag themself appereantly ;). Issue can be closes tho. Thank y'all for the help.

JOJ0 commented 1 year ago

You can do it! Good luck! I still have thousands in front of me as well. Dont forget to use additional metadata plugins. For my music collection often MusicBrainz doesnt have it in the database. I recommend discogs and spotify plugins in general, and possibly even beatport4 (https://github.com/Samik081/beets-beatport4) if you have a lot of electronic music.

Emporea commented 1 year ago

I have another question. Does beets also consider the filenames everytime? Is there a way to make beets only consider the exifdata?

For example can I tell beets to cluster files into folder only considering album and artist when deciding in which folder something to put?

JOJ0 commented 1 year ago

I have another question. Does beets also consider the filenames everytime?

No. Under 2 conditions: artist and title id3/metadata tags missing AND the fromfilename plugin is enabled.

Is there a way to make beets only consider the exifdata?

no exifdata in audiofiles. what do you mean?

For example can I tell beets to cluster files into folder only considering album and artist when deciding in which folder something to put?

You can configure how beets saves the imported files. Read about the path configurations: https://beets.readthedocs.io/en/stable/reference/config.html#path-format-configuration

I suggest you set copy: yes https://beets.readthedocs.io/en/stable/reference/config.html#copy

to make sure your original files stay untouched and you build a new file tree. If you have the space available...

Dont try to have beets change your original files if you are still experimenting with how you do things.

Emporea commented 1 year ago

How can I only use spotify to recognize song, so that it will only suggest candidates from Spotify, nothing else?

This is my config.yaml. It still uses musicbrainz even tho i disabled it? Could this be because some of my files already have a musicbrainz-id tag? Should I delete all the tags first or is there another way to tell beets to ignore all musicbrainz-id tags (if thats even the case) and only search on spotify?

plugins: spotify

spotify:
    source_weight: 1

musicbrainz:
    enabled: no
    source_weight: 0

Since I have all files in a single folder i use this command to import. beet import -s -m -q .

Also yes, I made a backup of my unmodified files and I am trying out several options without changing my real data. I use the -m option so that I know what files are left to tag. I use the -q option the first time so that it tags automatically without my interaction. (recognized about 2000 of 3000 files using only musicbrainz)

Since I know that almost all (maybe about 100 are not) songs i have are present on spotify this should work.

But When I use spotify the "similarity" is down to 80% for every song it finds, even tho it is the correct one. This makes it unable to use the -q (quite) option, since i would need to modify the strong_rec variable to atleast 0.21, but it still uses musicbrainz as i mentioned earlier, which will give false positives when I automatically pass everything >79%...

JOJ0 commented 1 year ago

Your beets version supports musicbrainz disabling already? Think it's not in a released version, only in current dev. Not sure need to check.

Emporea commented 1 year ago

Well this could explain why its not disabled :D. I am using 1.6.0. Merry Christmas btw.

JOJ0 commented 1 year ago

But When I use spotify the "similarity" is down to 80% for every song it finds, even tho it is the correct one.

The importer UI tells you why you get penalties for the candidates. Usually in yellow color, text in brackets.

Post an example of such an 80% match!

Setting this could help for some context around the match: https://beets.readthedocs.io/en/stable/reference/config.html#detail

JOJ0 commented 1 year ago

Well this could explain why its not disabled :D. I am using 1.6.0.

Merry Christmas btw.

Run it from git. You wont regret it, dev version is perfectly stable usually.

Inside your beets Python virtual env or wherever you installed it:

git clone via http or ssh cd beets pip install -e .

Emporea commented 1 year ago

I already tried the dev version. Still matches using musicbrainz.

Emporea commented 1 year ago
/home/empo/SpotifySingle/!llflow - Ich & mein Rucksack.ogg
Tagging track: !llflow - Ich & mein Rucksack
URL:
    https://open.spotify.com/track/5dPTHCbl7A9flc15j61hLz
(Similarity: 80.0%) (source) (Spotify)
[A]pply, More candidates, Skip, Use as-is, Enter search, enter Id, aBort? 

/home/empo/SpotifySingle/!llflow - Länger als jeder Hype.ogg
Tagging track: !llflow, Lakmann - Länger als jeder Hype
URL:
    https://open.spotify.com/track/779m2dPTPVe8WAG7mEde9X
(Similarity: 80.0%) (source) (Spotify)
[A]pply, More candidates, Skip, Use as-is, Enter search, enter Id, aBort? 

/home/empo/SpotifySingle/10cc - Bloody Tourists - 01 - Dreadlock Holiday.ogg
Tagging track: 10cc - Dreadlock Holiday
URL:
    https://musicbrainz.org/recording/f096fef1-0d0f-41e9-98fc-be4a29e97d09
(Similarity: 100.0%)

/home/empo/SpotifySingle/10cc - Bloody Tourists - 04 - Shock on the Tube (Don’t Want Love).ogg
Tagging track: 10cc - Shock on the Tube (Don’t Want Love)
URL:
    https://musicbrainz.org/recording/8e1a0dab-0a82-4b93-b87c-128268d3ef7f
(Similarity: 100.0%)

/home/empo/SpotifySingle/10cc - I'm Not In Love.ogg
Correcting track tags from:
    10cc - I'm Not In Love
To:
    10cc - Not in Love
URL:
    https://musicbrainz.org/recording/f2a15e1f-75dd-490e-8a87-639deb919980
(Similarity: 89.1%) (title)
[A]pply, More candidates, Skip, Use as-is, Enter search, enter Id, aBort? 

/home/empo/SpotifySingle/2080 - Toco Toco.ogg
Correcting track tags from:
    2080 - Toco Toco
To:
    2080 - Toco Toco (extended mix)
URL:
    https://musicbrainz.org/recording/396a517a-5d83-4e2b-a454-54e37bd2826c
(Similarity: 92.6%) (title)
[A]pply, More candidates, Skip, Use as-is, Enter search, enter Id, aBort? 
(Similarity: 100.0%)

/home/empo/SpotifySingle/3 Sud Est - Focul.ogg
Tagging track: 3 Sud Est - Focul
URL:
    https://open.spotify.com/track/7vm8gelkQdI1uDWzWmBXBK
(Similarity: 80.0%) (source) (Spotify)
[A]pply, More candidates, Skip, Use as-is, Enter search, enter Id, aBort? 

/home/empo/SpotifySingle/36 - Black Soma - 01 - Black Soma.ogg
Tagging track: 36 - Black Soma
URL:
    https://musicbrainz.org/recording/f1ac8aa9-825d-487e-93f9-ef078766dc81
(Similarity: 100.0%)

/home/empo/SpotifySingle/36 - Black Soma - 03 - Black Halcyon.ogg
Tagging track: 36 - Black Halcyon
URL:
    https://musicbrainz.org/recording/6135a0d7-fe51-4369-b27e-f5182fbb2c07
(Similarity: 100.0%)

/home/empo/SpotifySingle/47stillstanding - So Fucked Up.ogg
Tagging track: 47stillstanding, R I S K L I F E - So Fucked Up
URL:
    https://open.spotify.com/track/4QlsZUlfUyoQDUXaDnQKsM
(Similarity: 80.0%) (source) (Spotify)
[A]pply, More candidates, Skip, Use as-is, Enter search, enter Id, aBort?

This is my output with this command beet import -s -m SpotifySingle/ using this config:

plugins: spotify
spotify:
    source_weight: 1
    mode: list
    tiebreak: popularity
    show_failures: no
    artist_field: albumartist
    album_field: album
    track_field: title
    region_filter:
    regex: []
    client_id: xxx
    client_secret: REDACTED
    tokenfile: spotify_token.json

musicbrainz:
    enabled: no
    source_weight: 0
    detail: yes

As you can see, Spotify matches get tagged with 80% everytime.

JOJ0 commented 1 year ago

Not sure but have you tried without --singleton I prefer never to use it and rather match albums

maybe that option forces musicbrainz? not sure, wild guessing

why not open a new discussion asking specifically how to switch off musicbrainz?

Emporea commented 1 year ago

Well it seems like musicbrainz is only turned off for non-singleton. Since all of my files are in a single directory I have to use -g anyway if i am not using -s, right?

Using only -s i get this message:


/home/empo/SpotifySingle (3067 items)
No matching release found for 3067 tracks.
For help, see: https://beets.readthedocs.org/en/latest/faq.html#nomatch
[S]kip, Use as-is, as Tracks, Group albums, Enter search, enter Id, aBort
JOJ0 commented 1 year ago

Exactly, use -g

Emporea commented 1 year ago

Yes I tried -g already, forgot to mention. It still uses musicbrainz if the similarity is higher, which is the case for a lot of my tracks if spotify keeps dangling around at 80% (even much lower when I only have single files of a whole album when -g and not -s)

Opened a new issue: https://github.com/beetbox/beets/issues/4605

If I can disable spotify completly I should be able to lower the minimum similarity (rec_strong_thresh) without getting wrong matches from musicbrainz.

Emporea commented 1 year ago

found a workaround to only use spotify. I just ignore any other media: ignored_media: ['CD-R', 'CD', '12" Vinyl', 'Data CD', 'DVD', 'DVD-Video', 'Blu-ray', 'HD-DVD', 'VCD', 'SVCD', 'UMD', 'VHS', '7" Vinyl', 'Digital Media'] ( probably more to come)