clancey / lastfm-sharp Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
lastfm-sharp ------------ lastfm-sharp is a Mono/.Net utility for accessing the Last.fm webservices including music scrobbling support. To compile this lib you'll have to use MonoDevelop.
From 60499168cdbbe65d0221cd4cc64d14c81331d73d Mon Sep 17 00:00:00 2001
From: Alan McGovern <[email protected]>
Date: Mon, 6 Feb 2017 02:12:16 +0000
Subject: [PATCH] [Scrobbling] Ignore the duration when it's zero
If the duration has not been supplied, don't bother
reporting a zero duration. This is an optional parameter
anyway so there's no point in reporting obviously
false information.
---
lastfm-sharp/Scrobbling/Connection.cs | 3 ++-
lastfm-sharp/Scrobbling/Entry.cs | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lastfm-sharp/Scrobbling/Connection.cs b/lastfm-sharp/Scrobbling/Connection.cs
index 3cc95bd..b3964ac 100644
--- a/lastfm-sharp/Scrobbling/Connection.cs
+++ b/lastfm-sharp/Scrobbling/Connection.cs
@@ -55,7 +55,8 @@ namespace Lastfm.Scrobbling
p["api_key"] = session.APIKey;
p["album"] = track.Album;
p["artist"] = track.Artist;
- p["duration"] = ((int)track.Duration.TotalSeconds).ToString();
+ if ((int) track.Duration.TotalSeconds != 0)
+ p["duration"] = ((int)track.Duration.TotalSeconds).ToString();
p["method"] = "track.updateNowPlaying";
p["sk"] = session.SessionKey;
p["track"] = track.Title;
diff --git a/lastfm-sharp/Scrobbling/Entry.cs b/lastfm-sharp/Scrobbling/Entry.cs
index cd8ac43..9e31306 100644
--- a/lastfm-sharp/Scrobbling/Entry.cs
+++ b/lastfm-sharp/Scrobbling/Entry.cs
@@ -110,7 +110,8 @@ namespace Lastfm.Scrobbling
p["api_key"] = session.APIKey;
p["album"] = Album;
p["artist"] = Artist;
- p["duration"] = ((int)Duration.TotalSeconds).ToString();
+ if ((int) Duration.TotalSeconds != 0)
+ p["duration"] = ((int)Duration.TotalSeconds).ToString();
p["method"] = "track.scrobble";
p["sk"] = session.SessionKey;
p["timestamp"] = Utilities.DateTimeToUTCTimestamp(TimeStarted).ToString();
--
2.7.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.