Skip to content

Commit

Permalink
Fix certain tracks title's not displaying.
Browse files Browse the repository at this point in the history
Fixed an issue where if the title contained single quotes, mpv would not play the track.
  • Loading branch information
ZingyTomato committed May 1, 2022
1 parent aa95853 commit efa4d8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Harmony/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def queueIsEmpty():
return empty

def fixTitle(title):
final_title = re.sub("[\"\']", "", title)
final_title = re.sub("[\"\']", " ", title)
return final_title

def showQueue():
Expand Down Expand Up @@ -140,7 +140,7 @@ def playTracks():
queuemsg = print(colored("\nPlaying items in the queue", 'cyan', attrs=['bold']) + colored(' (q to quit)\n', 'red'))
show_queue = print(f"\n".join([f"{colored(i, 'green')}. {track} \n" for i, track in enumerate((item_list), start=1)]))
print(colored("Launching MPV...", 'green', attrs=['bold']), end="\r")
play_tracks = [os.system(f"mpv --vo=null --cache=yes --video=no --no-video --term-osd-bar --term-playing-msg='{title}' --no-resume-playback '{track}' ") for track, title in zip(queue_list, item_list)]
play_tracks = [os.system(f"mpv --vo=null --cache=yes --video=no --no-video --term-osd-bar --term-playing-msg='{fixTitle(title)}' --no-resume-playback '{track}' ") for track, title in zip(queue_list, item_list)]
return queuemsg, show_queue, play_tracks

def playVideos():
Expand Down

0 comments on commit efa4d8a

Please sign in to comment.