Skip to content

Commit

Permalink
Fix erroring when no results found.
Browse files Browse the repository at this point in the history
Fixes an issue where harmony would quit when no songs were found. Update documentation.
  • Loading branch information
ZingyTomato committed Jun 3, 2022
1 parent 2472fca commit fc00f42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

## ❔ What's this?

Harmony is a command line tool to stream music from the command line without worrying about tracking/profiling. Harmony uses a [`Jiosaavn API`](https://github.com/sumitkolhe/jiosaavn-api) to both fetch results and stream music. [`Piped`](https://github.com/TeamPiped/Piped) is used to both fetch videos and stream videos. It has support for features that are normally only found on mainstream services like Spotify. (Real-time synced lyrics)
Harmony is a command line tool to stream music from the command line without worrying about tracking/profiling. Harmony streams music from [`Jiosaavn`](https://jiosaavn.com), using a [`Jiosaavn API`](https://github.com/sumitkolhe/jiosaavn-api) to both fetch results and stream music. Instead of streaming videos directly from [`Youtube`](https://youtube.com), [`Piped`](https://github.com/TeamPiped/Piped) is used instead to both fetch videos and stream videos. It's meant to act as a privacy respecting Spotify TUI.

## 🎧 Features

- [x] Minimal Resource Usage. **1-5%** CPU usage while streaming music, **5-15%** CPU usage while streaming videos.
- [x] No tracking whatsoever either while streaming music or videos.
- [x] Streams **320 kbps** audio and streams the **highest** quality video.
- [x] No tracking whatsoever while streaming music or videos.
- [x] Streams **320 kbps** audio and streams the **highest** quality video available.
- [x] Support for real-time synced lyrics.
- [x] A proper queue system.

Expand Down
4 changes: 2 additions & 2 deletions harmony/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def getSongs(query):
print(colored("\nSearching for songs...", 'cyan', attrs=['bold']))
searchurl = requests.request("GET", f"{SEARCH_URL}/search/songs?query={query}&page=1&limit=20", headers=headers).text.encode()
searchjson = json.loads(searchurl)
if len(searchjson['results']) == 0:
if searchjson['status'] == "FAILED" or len(searchjson['results']) == 0:
return noResults(query), songs.searchSongs()
print(colored("\nFound results!", 'green', attrs=['bold']), end="\r")
time.sleep(0.5)
Expand Down Expand Up @@ -152,7 +152,7 @@ def playTracks():
print(colored("Launching MPV and searching for Lyrics...", 'green', attrs=['bold']), end="\r")
for track, title, author in zip(queue_list, title_list, author_list):
lyricsToVtt(f"{title} - {author}")
os.system(f"mpv --no-video --term-osd-bar --no-resume-playback --term-playing-msg='{fixFormatting(colored(title, 'red'))} - {fixFormatting(colored(author, 'cyan'))}' '{track}' {SUB_FILE} ")
os.system(f"mpv --no-video --term-osd-bar --no-resume-playback {SUB_FILE} --term-playing-msg='{fixFormatting(colored(title, 'red'))} - {fixFormatting(colored(author, 'cyan'))}' '{track}'")
removeSubs()
return emptyQueue(), removeSubs(), songs.searchSongs()

Expand Down

0 comments on commit fc00f42

Please sign in to comment.