diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-05-05 22:20:59 +0200 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2014-05-05 22:20:59 +0200 |
commit | 40ece6e1e381f38a0514b0fc04beb14898bc7206 (patch) | |
tree | f2101b0d2474bcc4e9b3e38785a4aaec59768123 /plugins/lastfm | |
parent | a458f10ba42c08e471cfdf54e18312d2925f60e7 (diff) |
lastfm: option to submit tracks shorter than 30 sec
Diffstat (limited to 'plugins/lastfm')
-rw-r--r-- | plugins/lastfm/lastfm.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c index fa36c74d..c725bc9d 100644 --- a/plugins/lastfm/lastfm.c +++ b/plugins/lastfm/lastfm.c @@ -549,8 +549,12 @@ lastfm_songchanged (ddb_event_trackchange_t *ev, uintptr_t data) { // duration/playtime must be >= 30 sec float dur = deadbeef->pl_get_item_duration (ev->from); if (dur < 30 && ev->playtime < 30) { - trace ("track duration is %f sec, playtime if %f sec. not eligible for submission\n", dur, ev->playtime); - return 0; + // the lastfm.send_tiny_tracks option can override this rule + // only if the track played fully, and has determined duration + if (!(dur > 0 && fabs (ev->playtime - dur) < 1.f && deadbeef->conf_get_int ("lastfm.submit_tiny_tracks", 0))) { + trace ("track duration is %f sec, playtime if %f sec. not eligible for submission\n", dur, ev->playtime); + return 0; + } } // must be played for >=240sec or half the total time if (ev->playtime < 240 && ev->playtime < dur/2) { @@ -974,6 +978,7 @@ static const char settings_dlg[] = "property \"Scrobble URL\" entry lastfm.scrobbler_url \""SCROBBLER_URL_LFM"\";" "property \"Prefer Album Artist over Artist field\" checkbox lastfm.prefer_album_artist 0;" "property \"Send MusicBrainz ID\" checkbox lastfm.mbid 0;" + "property \"Submit tracks shorter than 30 seconds (not recommended)\" checkbox lastfm.submit_tiny_tracks 0;" ; // define plugin interface |