[Release] DeezerSDK - Deezer.com SDK for .NET

zjusuf.kadriu

Active Member
41
8
8
2019
DeezerSDK
Download:https://github.com/jackkoolage/DeezerSDK/releases
Help:https://github.com/jackkoolage/DeezerSDK/wiki
NuGet: https://www.nuget.org/packages/DeQmaTech.DeezerSDK

Features:
  • Assemblies for .NET 4.5.2 and .NET Standard 2.0 and .NET Core 2.1
  • Just one external reference (Newtonsoft.Json)
  • Easy installation using NuGet
  • Upload/Download tracking support
  • Proxy Support
  • Upload/Download cancellation support
List of functions:
Token
  1. GetAccessToken
  2. GetVerificationCode
  3. ExchangingVerificationCodeForAToken
  4. Register
AccountClient
  1. UserInfo
  2. UserOptions
  3. ApplicationGrantedPermissions
  4. GetCFtoken
Albums
  1. List
  2. ListRecursively
  3. Metadata
  4. Rate
  5. Comments
  6. CommentsRecursively
Artists
  1. ListRecursively
  2. List
  3. Metadata
  4. Albums
  5. AlbumsRecursively
  6. Comments
  7. CommentsRecursively
  8. Playlists
  9. PlaylistsRecursively
  10. Fans
  11. FansRecursively
  12. Top5Tracks
  13. RelatedArtists
  14. RelatedArtistsRecursively
  15. MixesTracks
Comments
  1. PlaylistComments
  2. PlaylistCommentsRecursively
  3. AlbumCommentsRecursively
  4. AlbumComments
  5. ArtistComments
  6. ArtistCommentsRecursively
  7. WritePlaylistComment
  8. WriteArtistComment
  9. WriteAlbumComment
  10. Delete
  11. Metadata
Favorites
  1. RemovePlaylist
  2. AddPlaylist
  3. AddPodcast
  4. RemovePodcast
  5. AddRadio
  6. RemoveRadio
  7. AddAlbum
  8. RemoveAlbum
  9. AddArtist
  10. RemoveArtist
  11. AddTrack
  12. RemoveTrack
Folders
  1. Metadata
  2. List
  3. ListRecursively
  4. Create
  5. AddPlaylist
  6. RemovePlaylist
  7. AddAlbum
  8. RemoveAlbum
  9. Items
Genres
  1. AllGenres
  2. Artists
  3. Radios
  4. Metadata
History
  1. RecentlyPlayedTracks
  2. RecentlyPlayedTracksRecursively
Mine
  1. RecommendedAlbums
  2. RecommendedPlaylists
  3. RecommendedArtists
  4. RecommendedTracks
  5. UploadMP3
  6. SetAvatarPicture
  7. UnFollow
  8. Follow
  9. Followers
  10. FollowersRecursively
  11. Followings
  12. FollowingsRecursively
  13. IsFollowingMe
  14. MyMP3s
  15. MyMP3sRecursively
  16. ListFlowTracks
Playlists
  1. List
  2. ListRecursively
  3. Add
  4. AddMultiple
  5. Remove
  6. RemoveMultiple
  7. Metadata
  8. Exists
  9. Create
  10. Edit
  11. Delete
  12. Clear
  13. Rate
  14. OrderInPlaylist
  15. SetArtwork
  16. MarkAsSeen
  17. Tracks
  18. RecommendationTracks
  19. Fans
  20. TrackExists
  21. Search
Radios
  1. Tracks
  2. List2
  3. List3
  4. Genres
  5. Metadata
  6. Top25Radios
  7. List
  8. ListRecursively
Search
  1. Playlists
  2. Tracks
  3. Artists
  4. Albums
  5. Historys
  6. Radios
  7. Users
  8. AdvancedTracksSearch
  9. AutocompleteSearch
StaffPicks
  1. AlbumsOfTheWeek
  2. TopTrackAlbumArtistPlaylist
  3. NewAlbumsInCountry
  4. NewAlbumsInCountryRecursively
Tracks
  1. List
  2. ListRecursively
  3. Delete
  4. Metadata
  5. Exists
  6. GenerateDirectLink
Users
  1. Metadata
  2. Albums
  3. AlbumsRecursively
  4. Artists
  5. ArtistsRecursively
  6. Playlists
  7. PlaylistsRecursively
  8. Followings
  9. FollowingsRecursively
  10. Followers
  11. FollowersRecursively
  12. Tracks
  13. TracksRecursively
  14. Radios
  15. RadiosRecursively
  16. TopAlbums
  17. TopPlaylists
  18. TopArtists
  19. TopTracks
  20. ListFlowTracks
  21. PushNotification
CodeMap:


Code simple:

'first login (one time only)

Async Sub GetToken()
Dim scop As New List(Of DeezerSDK.GetToken.ScopesEnum) From {ScopesEnum.delete_library, ScopesEnum.basic_access, ScopesEnum.email, ScopesEnum.listening_history, ScopesEnum.manage_community, ScopesEnum.manage_library, ScopesEnum.offline_access}
Dim intgrationUrl = DeezerSDK.GetToken.GetAccessToken("app_id", scop)
End Sub

'Set your client
Dim Clnt As DeezerSDK.IClient = New DeezerSDK.SClient("xxxxtokenxxxxx", New ConnectionSettings With {.CloseConnection = True, .TimeOut = TimeSpan.FromMinutes(80), .Proxy = New ProxyConfig With {.SetProxy = True, .ProxyIP = "127.0.0.1", .ProxyPort = 80, .ProxyUsername = "user", .ProxyPassword = "123456"}})

'Functions:

''Albums
Await CLNT.Albums("album_id").Comments(50, 0)
Await CLNT.Albums("album_id").CommentsRecursively()
Await CLNT.Albums(Nothing).List(50, 0)
Await CLNT.Albums(Nothing).ListRecursively()
Await CLNT.Albums("album_id").Metadata()
Await CLNT.Albums("album_id").Rate(3)

''Artists
Await CLNT.Artists("artist_id").Albums(50, 0)
Await CLNT.Artists("artist_id").AlbumsRecursively()
Await CLNT.Artists("artist_id").Comments(50, 0)
Await CLNT.Artists("artist_id").CommentsRecursively()
Await CLNT.Artists("artist_id").Fans(50, 0)
Await CLNT.Artists("artist_id").FansRecursively()
Await CLNT.Artists(Nothing).List(50, 0)
Await CLNT.Artists(Nothing).ListRecursively()
Await CLNT.Artists("artist_id").Metadata()
Await CLNT.Artists("artist_id").MixesTracks(50)
Await CLNT.Artists("artist_id").Playlists(50, 0)
Await CLNT.Artists("artist_id").PlaylistsRecursively()
Await CLNT.Artists("artist_id").RelatedArtists(50, 0)
Await CLNT.Artists("artist_id").RelatedArtistsRecursively()
Await CLNT.Artists("artist_id").Top5Tracks()

''Comments
Await CLNT.Comments(Nothing).AlbumComments("album_id", 50, 0)
Await CLNT.Comments(Nothing).AlbumCommentsRecursively("album_id")
Await CLNT.Comments(Nothing).ArtistComments("artist_id", 50, 0)
Await CLNT.Comments(Nothing).ArtistCommentsRecursively("album_id")
Await CLNT.Comments("comment_id").Delete
Await CLNT.Comments("comment_id").Metadata
Await CLNT.Comments(Nothing).PlaylistComments("playlist_id", 50, 0)
Await CLNT.Comments(Nothing).PlaylistCommentsRecursively("playlist_id")
Await CLNT.Comments(Nothing).WriteAlbumComment("album_id", "nice album")
Await CLNT.Comments(Nothing).WriteArtistComment("artist_id", "nice artist")
Await CLNT.Comments(Nothing).WritePlaylistComment("playlist_id", "nice playlist")

''Genres
Await CLNT.Genres(Nothing).AllGenres()
Await CLNT.Genres("genre_id").Artists()
Await CLNT.Genres("genre_id").Metadata()
Await CLNT.Genres("genre_id").Radios()

''Historys
Await CLNT.Historys.RecentlyPlayedTracks(OrderByEnum.ARTIST_ASC, 50, 0)
Await CLNT.Historys.RecentlyPlayedTracksRecursively(OrderByEnum.ARTIST_ASC)

''Mine.Account
Await CLNT.Mine.Account.UserInfo
Await CLNT.Mine.Account.ApplicationGrantedPermissions
Await CLNT.Mine.Account.UserOptions

''Mine.Favorites
Await CLNT.Mine.Favorites.AddAlbum("album_id")
Await CLNT.Mine.Favorites.AddArtist("artist_id")
Await CLNT.Mine.Favorites.AddPlaylist("playlist_id")
Await CLNT.Mine.Favorites.AddPodcast("prodcast_id")
Await CLNT.Mine.Favorites.AddRadio("radio_id")
Await CLNT.Mine.Favorites.AddTrack("track_id")
Await CLNT.Mine.Favorites.RemoveAlbum("album_id")
Await CLNT.Mine.Favorites.RemoveArtist("artist_id")
Await CLNT.Mine.Favorites.RemovePlaylist("playlist_id")
Await CLNT.Mine.Favorites.RemovePodcast("prodcast_id")
Await CLNT.Mine.Favorites.RemoveRadio("radio_id")
Await CLNT.Mine.Favorites.RemoveTrack("track_id")

''Mine.Folders
Await CLNT.Mine.Folders("folder_id").AddAlbum("album_id")
Await CLNT.Mine.Folders("folder_id").AddPlaylist("playlist_id")
Await CLNT.Mine.Folders(Nothing).Create("folderName", True, False, "all my")
Await CLNT.Mine.Folders("folder_id").Items(50, 0)
Await CLNT.Mine.Folders(Nothing).List(50, 0)
Await CLNT.Mine.Folders(Nothing).ListRecursively()
Await CLNT.Mine.Folders("folder_id").Metadata
Await CLNT.Mine.Folders("folder_id").RemoveAlbum("album_id")
Await CLNT.Mine.Folders("folder_id").RemovePlaylist("playlist_id")

''Mine
Await CLNT.Mine.Follow("user_id")
Await CLNT.Mine.UnFollow("user_id")
Await CLNT.Mine.Followers(50, 0)
Await CLNT.Mine.FollowersRecursively()
Await CLNT.Mine.Followings(50, 0)
Await CLNT.Mine.FollowingsRecursively()
Await CLNT.Mine.IsFollowingMe("user_id")
Await CLNT.Mine.MyMP3s(50, 0)
Await CLNT.Mine.MyMP3sRecursively()
Await CLNT.Mine.RecommendedAlbums()
Await CLNT.Mine.RecommendedArtists()
Await CLNT.Mine.RecommendedPlaylists()
Await CLNT.Mine.RecommendedTracks()
Await CLNT.Mine.ListFlowTracks
Dim UploadCancellationToken As New Threading.CancellationTokenSource()
Dim _ReportCls As New Progress(Of DeezerSDK.ReportStatus)(Sub(r)
Button41.Text = String.Format("{0}/{1}", (r.BytesTransferred), (r.TotalBytes))
Button41.Text = CInt(r.ProgressPercentage)
Button41.Text = If(CStr(r.TextStatus) Is Nothing, "Uploading...", CStr(r.TextStatus))
End Sub)
Await CLNT.Mine.SetAvatarPicture("C:\\myimg.jpg", UploadTypes.FilePath, "myimg.jpg", _ReportCls, UploadCancellationToken.Token)
Await CLNT.Mine.UploadMP3("C:\\myaudio.mp3", UploadTypes.FilePath, "myaudio.mp3", "testing audio", _ReportCls, UploadCancellationToken.Token)

''Playlists
Await CLNT.Playlists("playlist_id").Add("track_id")
Await CLNT.Playlists("playlist_id").AddMultiple(New List(Of Long) From {{"track_id"}, {"track_id"}})
Await CLNT.Playlists("playlist_id").Clear
Await CLNT.Playlists("playlist_id").Create("my tracks list", True, False, Nothing)
Await CLNT.Playlists("playlist_id").Delete
Await CLNT.Playlists("playlist_id").Edit("my tracks list", True, False, Nothing)
Await CLNT.Playlists("playlist_id").Exists
Await CLNT.Playlists("playlist_id").Fans(50)
Await CLNT.Playlists(Nothing).List(OrderByEnum.ARTIST_ASC, 50, 0)
Await CLNT.Playlists(Nothing).ListRecursively(OrderByEnum.TRACK_ASC)
Await CLNT.Playlists("playlist_id").MarkAsSeen
Await CLNT.Playlists("playlist_id").Metadata
Await CLNT.Playlists("playlist_id").OrderInPlaylist("track_id")
Await CLNT.Playlists("playlist_id").Rate(3)
Await CLNT.Playlists("playlist_id").RecommendationTracks(OrderByEnum.TRACK_ASC, 50, 0)
Await CLNT.Playlists("playlist_id").Remove("track_id")
Await CLNT.Playlists("playlist_id").RemoveMultiple(New List(Of Long) From {{"track_id"}, {"track_id"}})
Await CLNT.Playlists(Nothing).Search("tracks list", OrderByEnum.ARTIST_ASC)
Await CLNT.Playlists("playlist_id").SetArtwork("C:\\myimg.jpg", UploadTypes.FilePath, "myimg.jpg", _ReportCls, UploadCancellationToken.Token)
Await CLNT.Playlists("playlist_id").TrackExists("track_id")
Await CLNT.Playlists("playlist_id").Tracks(OrderByEnum.ARTIST_ASC, 50, 0)

''Radios
Await CLNT.Radios("radio_id").Metadata
Await CLNT.Radios(Nothing).Genres()
Await CLNT.Radios(Nothing).List(50, 0)
Await CLNT.Radios(Nothing).List2()
Await CLNT.Radios(Nothing).List3(OrderByEnum.ARTIST_ASC, 50, 0)
Await CLNT.Radios(Nothing).ListRecursively
Await CLNT.Radios(Nothing).Top25Radios
Await CLNT.Radios("radio_id").Tracks(50)

''Search
Await CLNT.Search(50, 0).Albums("whats new", AlbumOrderByEnum.RANKING)
Await CLNT.Search(50, 0).Artists("emi", ArtistOrderByEnum.ARTIST_ASC)
Await CLNT.Search(50, 0).Historys("hello", OrderByEnum.DURATION_ASC)
Await CLNT.Search(50, 0).Playlists("tracks list")
Await CLNT.Search(50, 0).Radios("pop")
Await CLNT.Search(50, 0).Tracks("money", OrderByEnum.ARTIST_ASC)
Await CLNT.Search(50, 0).Users("james")
Await CLNT.Search(50, 0).AdvancedTracksSearch("hello", "adele", Nothing, 40000, 1000, OrderByEnum.RATING_ASC)
Await CLNT.Search(50, 0).AutocompleteSearch("emine", OrderByEnum.ARTIST_ASC)

''StaffPicks
Await CLNT.StaffPicks.AlbumsOfTheWeek
Await CLNT.StaffPicks.NewAlbumsInCountry(50, 0)
Await CLNT.StaffPicks.NewAlbumsInCountryRecursively()
Await CLNT.StaffPicks.TopTrackAlbumArtistPlaylist(50)

''Tracks
Await CLNT.Tracks("track_id").Delete
Await CLNT.Tracks("track_id").Exists
Await CLNT.Tracks(Nothing).List
Await CLNT.Tracks(Nothing).ListRecursively
Await CLNT.Tracks("track_id").Metadata
CLNT.Tracks(Nothing).GenerateDirectLink("7e4b6942c6c3835dd8c4c1e0988dbd79", "658765292", "3", "1")

''Users
Await CLNT.Users("user_id").Metadata
Await CLNT.Users("user_id").Albums(50, 0)
Await CLNT.Users("user_id").AlbumsRecursively
Await CLNT.Users("user_id").Artists(50, 0)
Await CLNT.Users("user_id").ArtistsRecursively
Await CLNT.Users("user_id").Followers(50, 0)
Await CLNT.Users("user_id").FollowersRecursively
Await CLNT.Users("user_id").Followings(50, 0)
Await CLNT.Users("user_id").FollowingsRecursively
Await CLNT.Users("user_id").ListFlowTracks
Await CLNT.Users("user_id").Playlists(OrderByEnum.ARTIST_ASC, 50, 0)
Await CLNT.Users("user_id").PlaylistsRecursively(OrderByEnum.RANKING)
Await CLNT.Users("user_id").PushNotification("hi there")
Await CLNT.Users("user_id").Radios(50, 0)
Await CLNT.Users("user_id").RadiosRecursively
Await CLNT.Users("user_id").TopAlbums
Await CLNT.Users("user_id").TopArtists
Await CLNT.Users("user_id").TopPlaylists
Await CLNT.Users("user_id").TopTracks
Await CLNT.Users("user_id").Tracks(OrderByEnum.ARTIST_ASC, 50, 0)
Await CLNT.Users("user_id").TracksRecursively(OrderByEnum.ALBUM_ASC)
 
Top Bottom