Skip to content

Commit

Permalink
Update files for PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwmillr committed Feb 21, 2018
1 parent 600a5ae commit 9741f29
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 7 deletions.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions lyricsgenius/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Command line usage:
# $python -m lyricsgenius --search_song 'Begin Again' 'Andy Shauf'
# $python -m lyricsgenius --search_artist 'Lupe Fiasco' 3

import sys
import os
import lyricsgenius as genius

def main(args=None):
if args is None:
args = sys.argv[1:]

client_access_token = os.environ.get("GENIUS_CLIENT_ACCESS_TOKEN", None)
assert client_access_token is not None, "Must declare environment variable: GENIUS_CLIENT_ACCESS_TOKEN"
api = genius.Genius(client_access_token)

# There must be a standard way to handle "--" inputs on the command line
if sys.argv[1] == '--search-song':
if len(sys.argv) == 4:
song = api.search_song(sys.argv[2],sys.argv[3])
elif len(sys.argv) == 3:
song = api.search_song(sys.argv[2])
print('"{title}" by {artist}:\n {lyrics}'.format(title=song.title,artist=song.artist,lyrics=song.lyrics.replace('\n','\n ')))
elif sys.argv[1] == '--search-artist':
if len(sys.argv) == 4:
max_songs = int(sys.argv[3])
else:
max_songs = 5
artist = api.search_artist(sys.argv[2], max_songs=max_songs)
print("Saving {} lyrics...".format(artist.name))
api.save_artist_lyrics(artist)
else:
print("Usage: python -m lyricsgenius [--search-song song_name] [--search-artist artist_name num_songs]")
return

if __name__ == "__main__":
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added setup.cfg
Empty file.
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
requirements = f.read().splitlines()

setup(
name='geniuslyrics',
version='0.0',
description='GeniusLyrics',
name='lyricsgenius',
version='0.1',
description='Download lyrics and metadata from Genius.com',
long_description=README,
classifiers=[
'Programming Language :: Python', # TODO
],
author='John W. Miller',
author_email='',
url='https://github.com/johnwmillr/GeniusAPI',
author_email='john.w.millr@gmail.com',
url='https://github.com/johnwmillr/lyricsgenius',
keywords='genius api music lyrics artists albums songs',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=requirements,
entry_points={
'console_scripts': [
'genius-api = genius.api:main']
'lyricsgenius = lyricsgenius.__main__:main']
},
)
)

0 comments on commit 9741f29

Please sign in to comment.