Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop into master #376

Merged
merged 24 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
220fa33
fix: playlist view early loading crash
zznty Apr 23, 2024
fa1219b
fix: artist blacklist style missing
zznty Apr 23, 2024
4cbe104
fix: enable mousewheel scroll for queue
zznty Apr 24, 2024
438b61b
restyle titleblock button
zznty Apr 24, 2024
04f0f42
fix: restrict parallel config writes
zznty Apr 25, 2024
2e2e1f4
add check updates button back
zznty Apr 26, 2024
6985b5f
fix: reference counting on winrt decoder
zznty Apr 26, 2024
9f1ab0c
save last player last across restarts
zznty Apr 26, 2024
4872e2c
Merge pull request #371 from Fooxboy/290-save-last-opened-playlist
Fooxboy Apr 26, 2024
815a19c
Merge pull request #361 from Fooxboy/360-titleblock-button-restyle
Fooxboy Apr 26, 2024
b018898
Исправлен дизайн настроек
Fooxboy Apr 26, 2024
d8e0e3b
Merge pull request #370 from Fooxboy/369-вернуть-обратно-кнопку-прове…
Fooxboy Apr 26, 2024
792ce1f
implement hide to tray
zznty Apr 25, 2024
98c7cd8
Merge pull request #364 from Fooxboy/363-hide-to-tray-impl
Fooxboy Apr 26, 2024
0839e86
remove unused method
zznty Apr 26, 2024
b16550c
fix: regression, missing bottom offset on section view
zznty Apr 26, 2024
a0af51e
#373 Изменить дизайн плейлистов "Какой сейчас вайб"
Fooxboy Apr 26, 2024
88a870d
Merge branch 'develop' of https://github.com/Fooxboy/MusicX-WPF into …
Fooxboy Apr 26, 2024
0cf30d7
#365 Audio dislike
Fooxboy Apr 27, 2024
9126248
add lastfm scrobbling
zznty Apr 27, 2024
9e1c77f
feature: next version [skip ci]
Fooxboy Apr 27, 2024
07bc276
Merge pull request #374 from Fooxboy/68-last-fm
Fooxboy Apr 27, 2024
d55a1af
fix: build and lastfm scrobbling
zznty Apr 28, 2024
2bf2dab
fix: catch json exceptions for config
zznty Apr 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions IF.Lastfm.Core/Api/AlbumApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Commands.Album;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Helpers;
using IF.Lastfm.Core.Objects;

namespace IF.Lastfm.Core.Api
{
public class AlbumApi : ApiBase, IAlbumApi
{
public AlbumApi(ILastAuth auth, HttpClient httpClient = null)
: base(httpClient)
{
Auth = auth;
}

public async Task<LastResponse<LastAlbum>> GetInfoAsync(string artistname, string albumname, bool autocorrect = false, string username = null)
{
var command = new GetInfoCommand(Auth, albumname, artistname)
{
Autocorrect = autocorrect,
HttpClient = HttpClient,
UserName = username
};

return await command.ExecuteAsync();
}

public async Task<LastResponse<LastAlbum>> GetInfoByMbidAsync(string albumMbid, bool autocorrect = false, string username = null)
{
var command = new GetInfoCommand(Auth)
{
AlbumMbid = albumMbid,
Autocorrect = autocorrect,
HttpClient = HttpClient
};

return await command.ExecuteAsync();
}

//public Task<PageResponse<BuyLink>> GetBuyLinksForAlbumAsync(string artist, string album, CountryCode country, bool autocorrect = false)
//{
// throw new NotImplementedException();
//}

public Task<PageResponse<LastTag>> GetTagsByUserAsync(string artist, string album, string username, bool autocorrect = false)
{
var command = new GetTagsByUserCommand(Auth, artist, album, username)
{
Autocorrect = autocorrect,
HttpClient = HttpClient
};

return command.ExecuteAsync();
}

public async Task<PageResponse<LastTag>> GetTopTagsAsync(string artist, string album, bool autocorrect = false)
{
var command = new GetTopTagsCommand(Auth)
{
ArtistName = artist,
AlbumName = album,
HttpClient = HttpClient
};

return await command.ExecuteAsync();
}

public async Task<PageResponse<LastAlbum>> SearchAsync(string albumname, int page = 1, int itemsPerPage = LastFm.DefaultPageLength)
{
var command = new SearchCommand(Auth, albumname)
{
Page = page,
Count = itemsPerPage,
HttpClient = HttpClient
};

return await command.ExecuteAsync();
}

public async Task<PageResponse<LastShout>> GetShoutsAsync(string albumname, string artistname, bool autocorrect = false, int page = 1, int count = LastFm.DefaultPageLength)
{
var command = new GetShoutsCommand(Auth, albumname, artistname)
{
Page = page,
Autocorrect = autocorrect,
Count = count,
HttpClient = HttpClient
};

return await command.ExecuteAsync();
}

//public async Task<LastResponse> AddShoutAsync(string albumname, string artistname, string message)
//{
// var command = new AddShoutCommand(Auth, albumname, artistname, message);

// return await command.ExecuteAsync();
//}
}
}
177 changes: 177 additions & 0 deletions IF.Lastfm.Core/Api/ArtistApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
using System.Net.Http;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Objects;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Commands.Artist;
using IF.Lastfm.Core.Helpers;

namespace IF.Lastfm.Core.Api
{
public class ArtistApi : ApiBase, IArtistApi
{
public ArtistApi(ILastAuth auth, HttpClient httpClient = null)
: base(httpClient)
{
Auth = auth;
}



public async Task<LastResponse<LastArtist>> GetInfoAsync(string artist, string bioLang = LastFm.DefaultLanguageCode, bool autocorrect = false)
{
var command = new GetInfoCommand(Auth)
{
ArtistName = artist,
BioLanguage = bioLang,
Autocorrect = autocorrect,
HttpClient = HttpClient
};

return await command.ExecuteAsync();
}

public async Task<LastResponse<LastArtist>> GetInfoByMbidAsync(string mbid, string bioLang = LastFm.DefaultLanguageCode, bool autocorrect = false)
{
var command = new GetInfoCommand(Auth)
{
ArtistMbid = mbid,
BioLanguage = bioLang,
Autocorrect = autocorrect,
HttpClient = HttpClient
};

return await command.ExecuteAsync();
}

public async Task<PageResponse<LastAlbum>> GetTopAlbumsAsync(string artist, bool autocorrect = false, int page = 1, int itemsPerPage = LastFm.DefaultPageLength)
{
var command = new GetTopAlbumsCommand(Auth)
{
ArtistName = artist,
Page = page,
Count = itemsPerPage,
HttpClient = HttpClient
};
return await command.ExecuteAsync();
}

public async Task<PageResponse<LastAlbum>> GetTopAlbumsByMbidAsync(string mbid, bool autocorrect = false, int page = 1, int itemsPerPage = LastFm.DefaultPageLength)
{
var command = new GetTopAlbumsCommand(Auth)
{
ArtistMbid = mbid,
Page = page,
Count = itemsPerPage,
HttpClient = HttpClient
};
return await command.ExecuteAsync();
}

public async Task<PageResponse<LastTrack>> GetTopTracksAsync(string artist, bool autocorrect = false, int page = 1, int itemsPerPage = LastFm.DefaultPageLength)
{
var command = new GetTopTracksCommand(Auth, artist)
{
Page = page,
Count = itemsPerPage,
HttpClient = HttpClient
};
return await command.ExecuteAsync();
}

public async Task<PageResponse<LastArtist>> GetSimilarAsync(string artistname, bool autocorrect = false, int limit = LastFm.DefaultPageLength)
{
var command = new GetSimilarCommand(Auth)
{
ArtistName = artistname,
Autocorrect = autocorrect,
Limit = limit,
HttpClient = HttpClient
};
return await command.ExecuteAsync();
}

public async Task<PageResponse<LastArtist>> GetSimilarByMbidAsync(string mbid, bool autocorrect = false, int limit = LastFm.DefaultPageLength)
{
var command = new GetSimilarCommand(Auth)
{
ArtistMbid = mbid,
Autocorrect = autocorrect,
Limit = limit,
HttpClient = HttpClient
};
return await command.ExecuteAsync();
}

public Task<PageResponse<LastTag>> GetTagsByUserAsync(string artist, string username, bool autocorrect = false, int page = 1, int itemsPerPage = LastFm.DefaultPageLength)
{
var command = new GetTagsByUserCommand(Auth, artist, username)
{
Autocorrect = autocorrect,
Page = page,
Count = itemsPerPage,
HttpClient = HttpClient
};

return command.ExecuteAsync();
}

public Task<PageResponse<LastTag>> GetTopTagsAsync(string artist, bool autocorrect = false)
{
var command = new GetTopTagsCommand(Auth)
{
ArtistName = artist,
Autocorrect = autocorrect,
HttpClient = HttpClient
};

return command.ExecuteAsync();
}

public Task<PageResponse<LastTag>> GetTopTagsByMbidAsync(string mbid, bool autocorrect = false)
{
var command = new GetTopTagsCommand(Auth)
{
ArtistMbid = mbid,
Autocorrect = autocorrect,
HttpClient = HttpClient
};

return command.ExecuteAsync();
}


public async Task<PageResponse<LastShout>> GetShoutsAsync(string artist, int page = 0, int count = LastFm.DefaultPageLength, bool autocorrect = false)
{
var command = new GetShoutsCommand(Auth, artist)
{
Autocorrect = autocorrect,
Page = page,
Count = count,
HttpClient = HttpClient
};
return await command.ExecuteAsync();
}

public async Task<LastResponse> AddShoutAsync(string artistname, string message)
{
var command = new AddShoutCommand(Auth, artistname, message)
{
HttpClient = HttpClient
};

return await command.ExecuteAsync();
}

public async Task<PageResponse<LastArtist>> SearchAsync(string artistname, int page = 1, int itemsPerPage = LastFm.DefaultPageLength)
{
var command = new SearchCommand(Auth, artistname)
{
Page = page,
Count = itemsPerPage,
HttpClient = HttpClient
};

return await command.ExecuteAsync();
}
}
}
70 changes: 70 additions & 0 deletions IF.Lastfm.Core/Api/ChartApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Commands.Chart;
using IF.Lastfm.Core.Api.Helpers;
using IF.Lastfm.Core.Helpers;
using IF.Lastfm.Core.Objects;

namespace IF.Lastfm.Core.Api
{
public class ChartApi : ApiBase, IChartApi
{

public ChartApi(ILastAuth auth, HttpClient httpClient = null)
: base(httpClient)
{
Auth = auth;
}

/// <summary>
/// Get a list of the most-scrobbled artists on Last.fm.
/// </summary>
/// <remarks>
/// Bug 28/05/16 - itemsPerPage parameter doesn't seem to work all the time; certain values cause more or fewer items to be returned
/// </remarks>
public Task<PageResponse<LastArtist>> GetTopArtistsAsync(int page = 1, int itemsPerPage = LastFm.DefaultPageLength)
{
var command = new GetTopArtistsCommand(Auth)
{
Page = page,
Count = itemsPerPage,
HttpClient = HttpClient
};
return command.ExecuteAsync();
}

/// <summary>
/// Get a list of the most-scrobbled tracks on Last.fm.
/// </summary>
/// <remarks>
/// Bug 28/05/16 - itemsPerPage parameter doesn't seem to work all the time; certain values cause more or fewer items to be returned
/// </remarks>
public Task<PageResponse<LastTrack>> GetTopTracksAsync(int page = 1, int itemsPerPage = LastFm.DefaultPageLength)
{
var command = new GetTopTracksCommand(Auth)
{
Page = page,
Count = itemsPerPage,
HttpClient = HttpClient
};
return command.ExecuteAsync();
}

/// <summary>
/// Get a list of the most frequently used tags by Last.fm users
/// </summary>
/// <remarks>
/// Bug 28/05/16 - page and itemsPerPage parameters do not actually affect the number of or selection of tags returned
/// </remarks>
public Task<PageResponse<LastTag>> GetTopTagsAsync(int page = 1, int itemsPerPage = LastFm.DefaultPageLength)
{
var command = new GetTopTagsCommand(Auth)
{
Page = page,
Count = itemsPerPage,
HttpClient = HttpClient
};
return command.ExecuteAsync();
}
}
}
36 changes: 36 additions & 0 deletions IF.Lastfm.Core/Api/Commands/Album/AddShoutCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Net.Http;
using System.Threading.Tasks;
using IF.Lastfm.Core.Api.Helpers;

namespace IF.Lastfm.Core.Api.Commands.Album
{
[ApiMethodName("album.shout")]
internal class AddShoutCommand : PostAsyncCommandBase<LastResponse>
{
public string Album { get; set; }

public string Artist { get; set; }

public string Message { get; set; }

public AddShoutCommand(ILastAuth auth, string album, string artist, string message)
: base(auth)
{
Album = album;
Artist = artist;
Message = message;
}

public override void SetParameters()
{
Parameters.Add("album", Album);
Parameters.Add("artist", Artist);
Parameters.Add("message", Message);
}

public override async Task<LastResponse> HandleResponse(HttpResponseMessage response)
{
return await LastResponse.HandleResponse(response);
}
}
}
Loading
Loading