Git Product home page Git Product logo

musictools's Introduction

banner

PyPI version Build Status

Library to download, sort and tag music files

Social

GitHub stars GitHub followers
Twitter Follow

Dependencies

Mac

$ brew install libav

Ubuntu

$ sudo apt-get install libav-tools

Windows

Install libav

Installing

From Source:

$ git clone https://github.com/kalbhor/MusicTools
$ cd MusicTools
$ python setup.py install

From PyPI:

$ pip install musictools

Methods

Provides a list of youtube videos of the song with urls and titles
musictools.get_song_urls(song_name)
Download song from youtube
musictools.download_song(song_url, song_title)
Provides artist name, song name, album name and album art for a particular song. Requires Client ID and Client Secret for Spotify API
musictools.get_metadata(file_name, client_id, client_secret)
Adds an image as the album art of a mp3 file
musictools.add_albumart(file_name, albumart)
Adds title, artist and album name in a mp3 file
musictools.add_metadata(file_name, title, artist, album)
Removes all metadata and album art from songs
musictools.revert_metadata(file_name)
Returns specified metadata field for a music file
musictools.get_current_metadata_tag(file_name, tag)

Example

>>> from musictools import musictools

>>> songs_list = musictools.get_song_urls("Hey Jude")
>>> print(songs_list[0])
('https://www.youtube.com/watch?v=A_MjCqQoLLA', 'The Beatles - Hey Jude')

>>> url, title = songs_list[0]
>>> print(url)
https://www.youtube.com/watch?v=A_MjCqQoLLA
>>> print(title)
The Beatles - Hey Jude

>>> musictools.download_song(url, title, dl_directory='~/Desktop/Music/')

>>> musictools.get_metadata(title)
('The Beatles', '1 (Remastered)', 'Hey Jude - Remastered 2015', 'https://i.scdn.co/image/9ecfdf528562cae879748b73bd81b64dfa3d5704')

>>> artist, album , song_name, albumart = musictools.get_metadata(title, 'YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET')

>>> musictools.add_albumart(title, albumart)
>>> musictools.add_metadata(title, song_name, artist, album)

✨✨VOILA✨✨

image

Contributing

To contribute, post issues without hesitation and open pull requests to add/improve features.

License

musictools's People

Contributors

dependabot[bot] avatar kalbhor avatar thejohnsub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

musictools's Issues

More information on development / contributing

I'm thinking about adding a couple features to this library like direct url support and maybe soundcloud support.

Perhaps I'm missing something here, maybe something obvious, not sure.
I followed through with the steps in the README and the setup finished successfully.
How do I test this?

I did python test/musictools_tests.py but I get an basic error

Traceback (most recent call last):
  File "tests/musictools_tests.py", line 1, in <module>
    from musictools import musictools
  File "/usr/local/lib/python2.7/site-packages/musictools/musictools.py", line 10, in <module>
    from urllib.request import urlopen
ImportError: No module named request

Which seems like I'm missing something fundamental in this setup.

Is there some kind of dev environment setup necessary here similar to npm install?
I'm developing on OS X 10.11.6 if that helps. Thanks

Could not find suitable distribution for Requirement.parse('requests')

My python 2.7.10 run install error: Could not find suitable distribution for Requirement.parse('requests'),the detailed content:
running install
Checking .pth file support in /Library/Python/2.7/site-packages/
/usr/bin/python -E -c pass
TEST PASSED: /Library/Python/2.7/site-packages/ appears to support .pth files
running bdist_egg
running egg_info
creating musictools.egg-info
writing requirements to musictools.egg-info/requires.txt
writing musictools.egg-info/PKG-INFO
writing top-level names to musictools.egg-info/top_level.txt
writing dependency_links to musictools.egg-info/dependency_links.txt
writing manifest file 'musictools.egg-info/SOURCES.txt'
reading manifest file 'musictools.egg-info/SOURCES.txt'
writing manifest file 'musictools.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.13-intel/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/tests
copying tests/init.py -> build/lib/tests
copying tests/musictools_tests.py -> build/lib/tests
creating build/lib/musictools
copying musictools/musictools.py -> build/lib/musictools
copying musictools/init.py -> build/lib/musictools
copying musictools/custom_exceptions.py -> build/lib/musictools
creating build/bdist.macosx-10.13-intel
creating build/bdist.macosx-10.13-intel/egg
creating build/bdist.macosx-10.13-intel/egg/tests
copying build/lib/tests/init.py -> build/bdist.macosx-10.13-intel/egg/tests
copying build/lib/tests/musictools_tests.py -> build/bdist.macosx-10.13-intel/egg/tests
creating build/bdist.macosx-10.13-intel/egg/musictools
copying build/lib/musictools/musictools.py -> build/bdist.macosx-10.13-intel/egg/musictools
copying build/lib/musictools/init.py -> build/bdist.macosx-10.13-intel/egg/musictools
copying build/lib/musictools/custom_exceptions.py -> build/bdist.macosx-10.13-intel/egg/musictools
byte-compiling build/bdist.macosx-10.13-intel/egg/tests/init.py to init.pyc
byte-compiling build/bdist.macosx-10.13-intel/egg/tests/musictools_tests.py to musictools_tests.pyc
byte-compiling build/bdist.macosx-10.13-intel/egg/musictools/musictools.py to musictools.pyc
byte-compiling build/bdist.macosx-10.13-intel/egg/musictools/init.py to init.pyc
byte-compiling build/bdist.macosx-10.13-intel/egg/musictools/custom_exceptions.py to custom_exceptions.pyc
creating build/bdist.macosx-10.13-intel/egg/EGG-INFO
copying musictools.egg-info/PKG-INFO -> build/bdist.macosx-10.13-intel/egg/EGG-INFO
copying musictools.egg-info/SOURCES.txt -> build/bdist.macosx-10.13-intel/egg/EGG-INFO
copying musictools.egg-info/dependency_links.txt -> build/bdist.macosx-10.13-intel/egg/EGG-INFO
copying musictools.egg-info/requires.txt -> build/bdist.macosx-10.13-intel/egg/EGG-INFO
copying musictools.egg-info/top_level.txt -> build/bdist.macosx-10.13-intel/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/musictools-2.2.0-py2.7.egg' and adding 'build/bdist.macosx-10.13-intel/egg' to it
removing 'build/bdist.macosx-10.13-intel/egg' (and everything under it)
Processing musictools-2.2.0-py2.7.egg
Copying musictools-2.2.0-py2.7.egg to /Library/Python/2.7/site-packages
Adding musictools 2.2.0 to easy-install.pth file

Installed /Library/Python/2.7/site-packages/musictools-2.2.0-py2.7.egg
Processing dependencies for musictools==2.2.0
Searching for requests
Reading https://pypi.python.org/simple/requests/
Couldn't find index page for 'requests' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or download links found for requests
error: Could not find suitable distribution for Requirement.parse('requests')

download_song issue

Hopefully this is helpful and not just something wrong with my computer lol. get_song_url seems to work fine but when I try and use download_song, I get the error

[0;31mERROR:�[0m Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)> (caused by URLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),))

as well as

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>

and also

youtube_dl.utils.ExtractorError: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)> (caused by URLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),))

&

youtube_dl.utils.DownloadError: �[0;31mERROR:�[0m Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)> (caused by URLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),))

Here's the exact module I was using

from musictools import musictools

songs_list = musictools.get_song_urls("Tunnel Vision")
print(songs_list[0])

url, title = songs_list[0]
print("TITLE : ", title)
print("URL : ", url)

musictools.download_song(url, title)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.