Skip to content

Commit fe53cf6

Browse files
fix: fixed bug when playing local files (#27)
* Fixed bug with local files * Update aw_watcher_spotify/main.py --------- Co-authored-by: Erik Bjäreholt <erik.bjareholt@gmail.com>
1 parent 483b753 commit fe53cf6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

aw_watcher_spotify/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ def get_current_track(sp) -> Optional[dict]:
3535

3636
def data_from_track(track: dict, sp) -> dict:
3737
song_name = track["item"]["name"]
38-
data = sp.audio_features(track["item"]["id"])[0] or {}
38+
# local files do not have IDs
39+
data = (
40+
(sp.audio_features(track["item"]["id"])[0] or {}) if track["item"]["id"] else {}
41+
)
3942
data["title"] = song_name
4043
data["uri"] = track["item"]["uri"]
4144

0 commit comments

Comments
 (0)