Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Commit 1706f03

Browse files
committed
[v2.6] Bugfix and option to choose to add cover art
1 parent 0096b98 commit 1706f03

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lsd.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def get_sink_id(key):
6767
print("{} Output-Directory: {}".format(INFO, OUTPUT_DIR))
6868
mute_recording = input("\n{} Do you want to mute Spotify while recording? [YES / no] ".format(REQUEST)).lower() != "no"
6969
show_folder = input("{} Should I open the folder after conversion? [YES / no] ".format(REQUEST)).lower() != "no"
70+
add_covers = input("{} Should I add the cover arts to your tracks? [YES / no] ".format(REQUEST)).lower() != "no"
7071

7172
# initialize session-bus for Spotify and create the interface
7273
print("\n" + "---- DEPENDENCIES " + "-" * (T_WIDTH - 18) + "\n")
@@ -205,7 +206,7 @@ def get_sink_id(key):
205206
# the timestamps are too imprecise, therefore the next position is searched where silence starts / stops and then both values are compared
206207
slice_start = min(chunks_starts, key=lambda x: abs(x - timestamp_start))
207208
slice_end = min(chunks_ends, key=lambda x: abs(x - timestamp_end))
208-
recording[slice_start:slice_end].export(filename, format="mp3", bitrate="192k", tags=tags, cover=OUTPUT_DIR + "/.cover.jpg")
209+
recording[slice_start:slice_end].export(filename, format="mp3", bitrate="192k", tags=tags, cover=OUTPUT_DIR + "/.cover.jpg" if add_covers else None)
209210

210211
if genius is not None and genius.access_token.startswith("Bearer"):
211212
while True:
@@ -234,7 +235,7 @@ def get_sink_id(key):
234235
print("\n{}{} Done! Recorded and converted {} tracks. Bye!{}".format(INFO, GREEN, counter, RST))
235236

236237
if show_folder:
237-
subprocess.Popen("xdg-open {}".format(OUTPUT_DIR).split(), stdout=subprocess.PIPE)
238+
subprocess.Popen("xdg-open \"{}\"".format(OUTPUT_DIR).split(), stdout=subprocess.PIPE)
238239

239240
except KeyboardInterrupt:
240241
subprocess.Popen("systemctl --user restart pipewire pipewire-pulse && systemctl --user daemon-reload", stdout=subprocess.DEVNULL, shell=True)

0 commit comments

Comments
 (0)