Skip to content

Commit 42e0eb8

Browse files
authored
Release 0.5.5 (#63)
- Song recognition: match using song title and artist (avoid spurious scrobbles if more servers are configured)
1 parent dbc3f3c commit 42e0eb8

5 files changed

Lines changed: 19 additions & 10 deletions

File tree

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"flake8.args": [
33
"--max-line-length=140",
4-
"--ignore=E128,E701,E704,W504,W718,C0116,C0321"
4+
"--ignore=E128,E701,E704,W504,W718,C0116,C0321,E1136"
55
],
66
"pylint.args": [
77
"--max-line-length=140",
8-
"--disable=C0111,W0718,C0321"]
8+
"--disable=C0111,W0718,C0321,E1136"]
99
}

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ In order to avoid issues with password, which might contain special characters,
158158

159159
## Releases
160160

161+
### Release 0.5.5
162+
163+
- Song recognition: match using song title and artist (avoid spurious scrobbles if more servers are configured)
164+
161165
### Release 0.5.4
162166

163167
- Introduced caching against subsonic servers

mpd_subsonic_scrobbler/scrobbler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import time
2+
import socket
3+
import importlib.metadata
24

35
import mpd_util
46
import subsonic_util
@@ -15,9 +17,6 @@
1517
from context import Context
1618
from subsonic_track_id import SubsonicTrackId
1719

18-
import socket
19-
import importlib.metadata
20-
2120

2221
def execute_scrobbling(
2322
context: Context,
@@ -235,7 +234,8 @@ def main():
235234
mpd_index: int
236235
for mpd_index in range(len(mpd_list)):
237236
imposed_sleep_iteration_count: int = mpd_util.must_sleep_for(context=context, mpd_index=mpd_index)
238-
if imposed_sleep_iteration_count and imposed_sleep_iteration_count > 0: continue
237+
if imposed_sleep_iteration_count and imposed_sleep_iteration_count > 0:
238+
continue
239239
delete_elapsed_stats(context=context, index=mpd_index)
240240
last_state: str = context.get(context_key=ContextKey.MPD_LAST_STATE, index=mpd_index)
241241
current_state: str = None

mpd_subsonic_scrobbler/subsonic_util.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from subsonic_server_config import SubsonicServerConfig
22
from context import Context
33
from mpd_util import get_mpd_current_song_file
4+
from mpd_util import get_mpd_current_song_title
5+
from mpd_util import get_mpd_current_song_artist
46

57
from urllib.parse import urlparse
68
from urllib.parse import parse_qs
@@ -83,8 +85,11 @@ def __get_subsonic_track_id_for_config(
8385
except URLError:
8486
# server is probably unavailable
8587
pass
86-
except Exception as anyExc:
88+
except Exception as any_exc:
8789
print("__get_subsonic_track_id_for_config failed on "
8890
f"[{subsonic_server_config.get_friendly_name()}] "
89-
f"[{type(anyExc)}] [{anyExc}]")
90-
return right if song else None
91+
f"[{type(any_exc)}] [{any_exc}]")
92+
# check if the song is the one that is playing.
93+
song_title: str = get_mpd_current_song_title(context=context, index=index)
94+
song_artist: str = get_mpd_current_song_artist(context=context, index=index)
95+
return right if song and song_title == song.getTitle() and song_artist == song.getArtist() else None

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "mpd-subsonic-scrobbler"
33
description = "A Subsonic Scrobbler for Music Player Daemon"
44
license = {text = "MIT License"}
5-
version = "0.5.4"
5+
version = "0.5.5"
66
authors = [
77
{name = "Giovanni Fulco"}
88
]

0 commit comments

Comments
 (0)