Closed whatphilipcodes closed 1 month ago
Hm weird. Could you check the which versions of beets
and beetcamp
you are using?
Sure.
This is the version print from beets:
beet version
beets version 2.0.0
Python version 3.12.6
plugins: bandcamp, fromfilename
And the beetcamp plugin version I verified from pipx list (the discogs client and pyacoustid are not used as seen in the minimal config):
pipx list --include-injected
venvs are in /Users/philip/.local/pipx/venvs
apps are exposed on your $PATH at /Users/philip/.local/bin
manual pages are exposed at /Users/philip/.local/share/man
package beets 2.0.0, installed using Python 3.12.6
- beet
Injected Packages:
- beetcamp 0.19.2
- pyacoustid 1.3.0
- python3-discogs-client 2.7
Maybe this is important as well:
- OS: macOS Sonoma Version 14.6.1 (23G93), Edit: Also confirmed on macOS Sequoia Version 15.0 (24A335)
- Architecture: Intel-based
Managed to get the CLI working, see PR: https://github.com/snejus/beetcamp/pull/67
As my PR only addresses the CLI not being available (might have been a bit confusing on my part due to this being my first time filing a PR to a public repo) the actual issue about the autotagger still remains. You might want to consider keeping it open after merging #67...
As my PR only addresses the CLI not being available (might have been a bit confusing on my part due to this being my first time filing a PR to a public repo) the actual issue about the autotagger still remains. You might want to consider keeping it open after merging #67...
You're right!
As I was going through the plugin code I noticed that singletons are handled differently than albums. I was not aware of the concept of singleton imports as part of beets which meant I was trying to import single tracks directly resulting in the empty album part of the query. This means that everything is working fine now and this issue is obsolete.
One minor thing I noticed when forking the repo though, the pyproject.toml does not include the 'requests' library.
Nice, happy it works fine!
Though, now that I had a better look at the the beets output that you're seeing, specifically here
...
Tagging ARTIST -
No album ID found.
Search terms: ARTIST -
...
I realize this is something I see often when I try to import a track that contains bad metadata.
beets
reads the file you're trying to import and populates this line Tagging ARTIST -
, which should normally say something like Tagging Artist - Album
.
Given your output, I'm sensing that your file has the following metadata:
artist="ARTIST "
album=
where album
is missing.
Could you check whether this is the case?
Yes you are right. In fact the files I was using didn't include any metadata with just the fromfilename plugin generating the artist and title tag.
You can deal with it by pressing E in the import prompt and specifying the artist and album to search. Though I find this takes too long, so I try to make sure the file has correct metadata before I import it: I use mid2v2
and this zsh
function for mp3s:
tag() {
# args: [-aAtT <arg>] [-d] [<mp3-file(s)>...]
# info: (un)tag an mp3 file. Show current tags if no flags given
## -d clears all tags
## use -a to set artist, -A album, -T track, -t title
local -a delete
zparseopts -D -E d=delete
if (( $#delete )); then
mid3v2 -D $@
elif (( ${@[(I)-*]} )); then
mid3v2 $@
else
mid3v2 -l $@
fi
}
You can use tag <file>
to see the tags and, say tag -A 'Album Name' <file>
to set album. The available flags are the same as for the mid3v2
command.
One minor thing I noticed when forking the repo though, the pyproject.toml does not include the 'requests' library.
Forgot to reply - requests
is not needed as we recently switched over to httpx
.
One minor thing I noticed when forking the repo though, the pyproject.toml does not include the 'requests' library.
Forgot to reply -
requests
is not needed as we recently switched over tohttpx
.
I can remove it from #68. This does however mean that the plugin stops working entirely with a module not found error:
(beetcamp-py3.12) philip@MacBook-Pro-von-Philip beetcamp % beetcamp -h
Traceback (most recent call last):
File "[...]/Caches/pypoetry/virtualenvs/beetcamp-Qr4N4ZLT-py3.12/bin/beetcamp", line 3, in <module>
from beetsplug.bandcamp import main
File "[...]/repos/beetcamp/beetsplug/bandcamp/__init__.py", line 31, in <module>
from beetsplug import fetchart # type: ignore[attr-defined]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[...]/Caches/pypoetry/virtualenvs/beetcamp-Qr4N4ZLT-py3.12/lib/python3.12/site-packages/beetsplug/fetchart.py", line 24, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
and running as plugin:
plugin paths:
** error loading plugin bandcamp:
Traceback (most recent call last):
File "[...]/Caches/pypoetry/virtualenvs/beetcamp-Qr4N4ZLT-py3.12/lib/python3.12/site-packages/beets/plugins.py", line 268, in load_plugins
namespace = __import__(modname, None, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[...]/repos/beetcamp/beetsplug/bandcamp/__init__.py", line 31, in <module>
from beetsplug import fetchart # type: ignore[attr-defined]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[...]/Caches/pypoetry/virtualenvs/beetcamp-Qr4N4ZLT-py3.12/lib/python3.12/site-packages/beetsplug/fetchart.py", line 24, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
** error loading plugin fetchart:
Traceback (most recent call last):
File "[...]/Caches/pypoetry/virtualenvs/beetcamp-Qr4N4ZLT-py3.12/lib/python3.12/site-packages/beets/plugins.py", line 268, in load_plugins
namespace = __import__(modname, None, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[...]/Caches/pypoetry/virtualenvs/beetcamp-Qr4N4ZLT-py3.12/lib/python3.12/site-packages/beetsplug/fetchart.py", line 24, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Ah I see your issue. Here you want to install beets with fetchart
extra which pulls the relevant requests
dependency: I think pipx install beets[fetchart]
should work
The error I described is thrown regardless of the configuration. The init.py from beetcamp imports fetchart from beetsplug which then throws the error if requests is not present. Even though this is a fetchart dependency, the dev env installed from the pyproject.toml file for beetcamp won't work out of the box unless requests is present. Also let'say someone installs beets and beetcamp using pipx and the person does not configure fetchart with no intention of using it. As it is still imported the error will also show (tested in an empty poetry env). The alternative to including requests in the dependencies would be to make the fetchart import conditional but then we would have to reference the config in the init.py if I am not mistaken.
You are completely right, I will comment under the PR with a suggestion how to adjust pyproject.toml
for this!
'bandcamp' is enabled as a plugin in the beets config and there are no errors from beets or the plugin. When enabling verbose mode the search query is empty (with the exeption of the artist) and only looking for albums:
expected query format (type empty because docs suggested that would include all types of results):
Here is the minimal config I used for testing:
I also noticed that the 'beetcamp' cli commands are missing in my terminal (I followed the installation instruction using pipx inject and also ran pipx ensurepath). However because 'beets' seems to find the plugin and I don't get any errors in regards to that this is not the main concern of this issue. As I am new to pipx in general this can possibly be due to me not understanding correctly how to interface with the plugin via pipx and the beets env.
Also just to clarify, I did use actual track and artist names in my testing while also making sure they are listed on bandcamp.