Coder Social home page Coder Social logo

lastfm-sharp's Introduction

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.

lastfm-sharp's People

Contributors

clancey avatar

Stargazers

Julian L avatar

Watchers

James Cloos avatar Fabio Fernandes avatar  avatar

Forkers

phrasmotica

lastfm-sharp's Issues

Don't report a duration of zero

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.