summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c3
-rw-r--r--src/pianobar.15
-rw-r--r--src/settings.c10
-rw-r--r--src/settings.h1
4 files changed, 18 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index f08adeb..0b8b4e0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -264,7 +264,8 @@ int main (int argc, char **argv) {
/* scrobble when >= 90% are played */
if (BarSamplesToSeconds (player.samplerate,
player.channels, player.sampleSizeCurr) * 100 /
- scrobbleSong.length >= 90 &&
+ scrobbleSong.length >=
+ bsettings.lastfmScrobblePercent &&
bsettings.enableScrobbling) {
if (WardrobeSubmit (&wh, &scrobbleSong) ==
WARDROBE_RET_OK) {
diff --git a/src/pianobar.1 b/src/pianobar.1
index c17a3c3..6201d8c 100644
--- a/src/pianobar.1
+++ b/src/pianobar.1
@@ -96,6 +96,11 @@ username.
A password is needed too if you want to scrobble your played song.
.TP
+.B lastfm_scrobble_percent = 50-100
+When should a track be submitted to last.fm. Percent value. Don't append
+percent sign.
+
+.TP
.B password = plaintext_password
Your pandora.com password. Plain-text.
diff --git a/src/settings.c b/src/settings.c
index 91cd851..3a0ed4a 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -111,8 +111,18 @@ void BarSettingsRead (BarSettings_t *settings) {
settings->lastfmUser = strdup (val);
} else if (strcmp ("lastfm_password", key) == 0) {
settings->lastfmPassword = strdup (val);
+ } else if (strcmp ("lastfm_scrobble_percent", key) == 0) {
+ settings->lastfmScrobblePercent = atoi (val);
}
}
+
+ /* some checks */
+ /* last.fm requests tracks to be played at least 50% */
+ if (settings->lastfmScrobblePercent < 50 ||
+ settings->lastfmScrobblePercent > 100) {
+ settings->lastfmScrobblePercent = 50;
+ }
+ /* only scrobble tracks if username and password are set */
if (settings->lastfmUser != NULL && settings->lastfmPassword != NULL) {
settings->enableScrobbling = 1;
}
diff --git a/src/settings.h b/src/settings.h
index 2a6d8c3..b3604fa 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -32,6 +32,7 @@ struct BarSettings {
curl_proxytype controlProxyType;
char *lastfmUser;
char *lastfmPassword;
+ unsigned char lastfmScrobblePercent;
char enableScrobbling;
};