diff options
author | Andres G. Aragoneses <knocte@gmail.com> | 2013-03-16 21:20:53 +0000 |
---|---|---|
committer | Andres G. Aragoneses <knocte@gmail.com> | 2013-03-16 21:20:53 +0000 |
commit | 467947d81b20246c71d5eda90ef1215049b9a7cc (patch) | |
tree | 9e3fedae47ab77f2712635d25ffe3cb2e777a8db | |
parent | f0fcf24ea69b79aa1fb6aca6b3ccccf0ddbac50f (diff) |
Lastfm: refactor to avoid duplicated if-else block
After previous commit, this state assignment became duplicated between
the two blocks of the if-else statement. Also, use the ? operator so it
is less verbose.
No change of behaviour in this commit.
-rw-r--r-- | src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs b/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs index dcad8886d..3e685a62b 100644 --- a/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs +++ b/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs @@ -313,26 +313,16 @@ namespace Lastfm // we succeeded, pop the elements off our queue queue.RemoveRange (0, nb_tracks_scrobbled); queue.Save (); - - if (queue.Count > 0) { - state = State.NeedTransmit; - } else { - state = State.Idle; - } } else { // TODO: If error == StationError.InvalidSessionKey, // suggest to the user to (re)do the Last.fm authentication. hard_failures++; queue.RemoveInvalidTracks (); - - // if there are still valid tracks in the queue then retransmit on the next interval - if (queue.Count > 0) { - state = State.NeedTransmit; - } else { - state = State.Idle; - } } + + // if there are still valid tracks in the queue then retransmit on the next interval + state = queue.Count > 0 ? State.NeedTransmit : State.Idle; } private void LogIfIgnored (JsonObject scrobbled_track) |