regosen / get_cover_art

Batch cover art downloader and embedder for audio files
MIT License
69 stars 8 forks source link

Add top-level script. #15

Closed vext01 closed 2 years ago

vext01 commented 2 years ago

(great project! Thank you)

It would be more user-friendly if when you install get_cover_art a script is installed in bin/ so that instead of:

python -m get_cover_art ...

Users run:

get_cover_art ...

Thanks

regosen commented 2 years ago

Hi, that sounds like an easy win, but I'm not familiar with how to achieve this. Can you point me to another github project that does this? I'll use that as reference. Thanks!

vext01 commented 2 years ago

I think you'd usually do it in your setup.py script (or setup.cfg).

You need to define an entry point. Docs here.

Examples:

regosen commented 2 years ago

Thanks for the examples, that helps a lot! I just uploaded v1.4.10 to pypi with these changes, and I think it should work, but I'm not used to your use case.

Can you try pip install get_cover_art --upgrade and give it a shot? If it works, I'll git push my changes as well.

vext01 commented 2 years ago

Hi,

Thanks for the fast response.

The script is being installed correctly, but something is wrong with your dependencies.

On a system that i've not installed get_cover_art on yet:

$ pip3.8 install get_cover_art
Defaulting to user installation because normal site-packages is not writeable
Collecting get_cover_art
  Downloading get_cover_art-1.4.10-py3-none-any.whl (20 kB)
Installing collected packages: get-cover-art
Successfully installed get-cover-art-1.4.10
$ ~/.local/bin/get_cover_art 
Traceback (most recent call last):
  File "/home/edd/.local/bin/get_cover_art", line 5, in <module>
    from get_cover_art import main
  File "/home/edd/.local/lib/python3.8/site-packages/get_cover_art/__init__.py", line 1, in <module>
    from .cover_finder import CoverFinder
  File "/home/edd/.local/lib/python3.8/site-packages/get_cover_art/cover_finder.py", line 5, in <module>
    from .meta.meta_mp3 import MetaMP3
  File "/home/edd/.local/lib/python3.8/site-packages/get_cover_art/meta/meta_mp3.py", line 2, in <module>
    from mutagen.mp3 import MP3
ModuleNotFoundError: No module named 'mutagen'

Did you list your dependencies in setup.py (or in a requirements.txt)?

See these docs.

regosen commented 2 years ago

Ah, thanks for trying this out. I just discovered I can use python setup.py develop to test locally. Can you try upgrading to 1.4.11 and try it again?

vext01 commented 2 years ago

I saw it install mutagen this time. LGTM :)

Thanks!

vext01 commented 2 years ago

By the way, where are you making these changes? I can't see the commits.

regosen commented 2 years ago

I was holding out from pushing until you verified the fix, pushed now.

(Until now I've excluded setup.py from the repo because it includes the version number and changing that would be a lot of noise... but I'm reading now of ways around that, so I'll introduce setup.py soon)

vext01 commented 2 years ago

I wouldn't worry about the noise. It's standard practice to include version bump commits. Then the whole process is reproducible for third parties.

regosen commented 2 years ago

Fair point, added!