Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions spotifycli/spotifycli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import textwrap
import datetime
from subprocess import Popen, PIPE
import logging
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this import needed?

import lyriq

import lyricwikia
logging.getLogger("lyriq.lyriq").setLevel(logging.CRITICAL)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this call neded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without it the lyriq library will print a 404 error when it does not found the song specified on it's database. So to make the logging more clean i added that call.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


from jeepney import DBusAddress, new_method_call
from jeepney.io.blocking import open_dbus_connection
Expand Down Expand Up @@ -229,14 +231,15 @@ def show_song_short():

def show_lyrics():
artist, title = get_song()
try:
lyrics = lyricwikia.get_all_lyrics(artist, title)
except lyricwikia.LyricsNotFound:
raise SpotifyCLIException(
'Lyrics not found or could not connect'
) from None
lyrics = ''.join(lyrics[0])
print(lyrics)
lyrics = lyriq.get_lyrics(title, artist)

if lyrics is None:
# Lyrics not found
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment is not necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

print(f"Lyrics for '{title}' by {artist} were not found.")
print("This could happen if the track is missing from the lyrics database or is unsupported.")
return

print(lyrics.plain_lyrics)


def show_artist():
Expand Down