Skip to content

Commit

Permalink
1.2.1 (#88)
Browse files Browse the repository at this point in the history
- fixed spytify deadlock when requesting album info #82
- fixed artist info that was missing after getting album info #84
- fixed/should resolve a delay after dectecting the next track #85

close #82 #84
should resolve #85
  • Loading branch information
jwallet authored Apr 3, 2019
1 parent d08a20b commit 4a31f6e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion EspionSpotify/AudioSessions/SpotifyAudioSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public bool IsSpotifyCurrentlyPlaying()
samples.Add(spotifySoundValue);
}

return samples.DefaultIfEmpty().Average() > 0.0;
return samples.DefaultIfEmpty().Average() > 1.0;
}

public void SetSpotifyToMute(bool mute)
Expand Down
2 changes: 1 addition & 1 deletion EspionSpotify/MediaTags/LastFMAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public async Task<bool> UpdateTrack(Track track)
{
var retryWithTrack = track;
retryWithTrack.Title = Regex.Replace(retryWithTrack.Title, @" \(.*?\)| \- .*", "");
if (await UpdateTrack(retryWithTrack))
if (retryWithTrack.Title != track.Title && await UpdateTrack(retryWithTrack))
{
MapLastFMTrackToTrack(retryWithTrack, trackExtra);
}
Expand Down
13 changes: 5 additions & 8 deletions EspionSpotify/MediaTags/MP3Tags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,19 @@ public async Task SaveMediaTags()
{
mp3.Tag.Track = (uint)Count.Value;
}

mp3.Tag.Title = Track.Title;
mp3.Tag.AlbumArtists = new[] { Track.Artist };
mp3.Tag.Performers = new[] { Track.Artist };

if (Track.AlbumPosition != null)
else if (Track.AlbumPosition != null)
{
mp3.Tag.Track = (uint)Track.AlbumPosition;
}

mp3.Tag.Title = Track.Title;
mp3.Tag.AlbumArtists = Track.AlbumArtists ?? new[] { Track.Artist };
mp3.Tag.Performers = Track.Performers ?? new[] { Track.Artist };

mp3.Tag.Album = Track.Album;
mp3.Tag.Genres = Track.Genres;

mp3.Tag.Performers = Track.Performers;
mp3.Tag.Disc = Track.Disc;
mp3.Tag.AlbumArtists = Track.AlbumArtists;
mp3.Tag.Year = Track.Year;

if (File.Exists(CurrentFile))
Expand Down
2 changes: 1 addition & 1 deletion EspionSpotify/MediaTags/SpotifyAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task<bool> UpdateTrack(Track track)
if (playback.HasError() || playback.Item == null)
{
// fallback in case getting the playback did not work
// user migh be connected with a different account that the one that granted rights
// user might be connected with a different account that the one that granted rights
return await _lastFmApi.UpdateTrack(track);
}

Expand Down
3 changes: 2 additions & 1 deletion EspionSpotify/Watcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ private void OnPlayStateChanged(object sender, PlayStateEventArgs e)

private void OnTrackChanged(object sender, TrackChangeEventArgs e)
{
if ((RecorderUpAndRunning && IsOldSong) || e.OldTrack.Ad)
// do not add current track is an ad validation, audio is already muted
if (RecorderUpAndRunning && IsOldSong)
{
_userSettings.SpotifyAudioSession.SleepWhileTheSongEnds();
}
Expand Down

0 comments on commit 4a31f6e

Please sign in to comment.