Open AndydeCleyre opened 3 years ago
It would make sense that not passing --save
would send the results to stdout.
As to what happens when you don't pass --save
, nothing! The song is fetched and it ends there.
Hi!
I noticed that when you search for songs on the CLI nothing is returned as you said, but when searching for an artist their top song titles are returned until the api doesn't find any more songs.
I tried doing this:
Added the last else to the CLI handler to print lyrics in case --save
was not specified
# Handle the command-line inputs
if args.search_type == "song":
song = api.search_song(*args.terms)
if not song:
if not args.quiet:
print("Could not find specified song. Check spelling?")
return
if args.save:
if not args.quiet:
print("Saving lyrics to '{s}'...".format(s=safe_unicode(song.title)))
song.save_lyrics()
else: # new code
print(song.to_dict()['lyrics'])
I tried doing it and it seems to work. I haven't really contributed to any open source project before and I don't know exactly how to check if this "else" clause breaks something. I saw there are no detailed contributing guidelines: how would you proceed? Sorry for the noob question, I just wanted to help and couldn't really understand how
@fcagnola, search_artist
only prints the progress of the search. Ultimately when the search is done, it doesn't return anything either.
Currently, we don't have any contributing guidelines, but I'll make sure to add one in the future. If you'd like to contribute to this issue, make the changes you intend and open a pull request. We'll review it there.
Now as to the changes themselves, I'm not sure which way to go here. When there's no --save
we could print the lyrics or maybe the whole JSON. Or we could make the commands save to a JSON file by default and --save
(or an equivalent) would only act as a path for the JSON file.
Describe the bug Neither the help output nor the stdout/stderr indicate what is done with the lyrics, when
--save
is not passed.Expected behavior I thought maybe the same json produced with
--save
would be sent (alone) to stdout, or maybe just the plaintext lyrics content.But more confidently, the
--help
output should include what is to be expected when--save
is not passed, and it should be made more obvious via the--save
-less command's stdout/err.To Reproduce
Version info
3.0.0
Thanks so much for this project!