// Extension to aid deserialization of lists :) public static void Deserialize <T>(this IEnumerable <T> aItems, DeezerClient aClient) where T : IDeserializable <DeezerClient> { foreach (T item in aItems) { item.Deserialize(aClient); } }
public void Search() { //See Setup Example DeezerSession session = new DeezerSession(string.Empty, string.Empty, string.Empty, DeezerPermissions.BasicAccess); DeezerClient client = new DeezerClient(session); //The Search Query string SearchQuery = "<Insert Search Query>"; //You can search Deezer for TRACKS / ARTISTS / ALBUMS / PLAYLISTS //Each has a method in the client with the signature - Search<ITEM>(SearchQuery) //Returns a paged result var searchTask = client.SearchArtists(SearchQuery); //Grab the result from the task //Contains the A book of results var items = searchTask.Result.Data; //We can get the total results found from the search var total = searchTask.Result.Total; //We can get the links to the next/previous pages in the search var nextPage = searchTask.Result.Next; var previousPage = searchTask.Result.Previous; //Alternatively we can get the pages directly //TODO NotYetImplemented var nextPageTask = searchTask.Result.GetNextPage(); var previousPageTask = searchTask.Result.GetPreviousPage(); }
//Simple method getting us a Deezer Client object so we can use the API public void SetupMethod() { //The username of the account you wish to browse the API with //NOTE: You don't need to specify this to BROWSE the API, //The username is only used when accessing user information, history or favourites. string Username = "******"; //Your application ID found at http://developers.deezer.com //NOTE: Since Deezer require a webwindow to authenticate users. E.Deezer currently doesn't //provide this feature and so this param is ignored. string ApplicationID = string.Empty; //Your application secret found at http://developers.deezer.com //NOTE: Since Deezer require a webwindow to authenticate users. E.Deezer currently doesn't //provide this feature and so this param is ignored. string ApplicationSecret = string.Empty; //Permissions that will be requested when authenticating users //See http://developers.deezer.com/api/permissions //NOTE: Since Deezer require a webwindow to authenticate users. E.Deezer currently doesn't //provide this feature and so this param is ignored. DeezerPermissions Permissions = DeezerPermissions.BasicAccess; //Create a DeezerSession //NOTE: This will be used to authenticate users. E.Deezer doesn't provide this feature yet. DeezerSession session = new DeezerSession(Username, ApplicationID, ApplicationSecret, Permissions); //We use this session to create a DeezerClient DeezerClient client = new DeezerClient(session); //All done :) //Use the DeezerClient object to get data from the Deezer API }
private async Task <byte[]> DownloadArtistPictureFromDeezer(string artistName) { var deezerClient = new DeezerClient(); var deezerArtist = await deezerClient.GetArtistInfo(artistName); if (deezerArtist == null) { return(null); } if (deezerArtist.Images == null) { return(null); } try { var clientPic = new HttpClient(); HttpResponseMessage responsePic = await clientPic.GetAsync(deezerArtist.Images.LastOrDefault().Url); string uri = responsePic.RequestMessage.RequestUri.AbsoluteUri; // A cheap hack to avoid using Deezers default image for bands. if (uri.Equals("http://cdn-images.deezer.com/images/artist//400x400-000000-80-0-0.jpg")) { return(null); } byte[] img = await responsePic.Content.ReadAsByteArrayAsync(); return(img); } catch (Exception) { Debug.WriteLine("Error getting or saving art from deezer."); return(null); } }
public BrowseEndpoint(DeezerClient aClient) { iClient = aClient; iGenre = new GenreEndpoint(iClient); iCharts = new ChartsEndpoint(iClient); iUserEndpoint = new UserEndpoint(aClient); }
internal Deezer(DeezerSession aSession) { iSession = aSession; iClient = new DeezerClient(iSession); iBrowse = new BrowseEndpoint(iClient); iSearch = new SearchEndpoint(iClient); iUser = new UserEndpoint(iClient); iRadio = new RadioEndpoint(iClient); }
public BrowseEndpoint(DeezerClient aClient) { iClient = aClient; iAlbums = new AlbumEndpoint(iClient); iArtists = new ArtistEndpoint(iClient); iPlaylists = new PlaylistEndpoint(iClient); iTracks = new TrackEndpoint(iClient); iGenre = new GenreEndpoint(iClient); iCharts = new ChartsEndpoint(iClient); }
public BrowseEndpoint(DeezerClient aClient) { iClient = aClient; iAlbums = new AlbumEndpoint(iClient); iArtists = new ArtistEndpoint(iClient); iPlaylists = new PlaylistEndpoint(iClient); iTracks = new TrackEndpoint(iClient); iGenre = new GenreEndpoint(iClient); iCharts = new ChartsEndpoint(iClient); }
public void Infos() { //See Setup Example DeezerSession session = new DeezerSession(string.Empty, string.Empty, string.Empty, DeezerPermissions.BasicAccess); DeezerClient client = new DeezerClient(session); //We can get some service information from Deezer using GetInfos() method var serviceinfo = client.GetInfos(); //From this we can get the current user's country //NOTE: Based on IP address var country = serviceinfo.Result.Country; var countryISO = serviceinfo.Result.Iso; //We can see if Deezer is available in this country var serviceAvailable = serviceinfo.Result.IsAvailable; }
internal void Deserialize(DeezerClient aClient) { Client = aClient; }
public AlbumEndpoint(DeezerClient aClient) { iClient = aClient; }
public SearchEndpoint(DeezerClient aClient) { iClient = aClient; }
public GenreEndpoint(DeezerClient aClient) { iClient = aClient; }
public PlaylistEndpoint(DeezerClient aClient) { iClient = aClient; }
public AlbumEndpoint(DeezerClient aClient) { iClient = aClient; }
public TrackEndpoint(DeezerClient aClient) { iClient = aClient; }
public ArtistEndpoint(DeezerClient aClient) { iClient = aClient; }
public TrackEndpoint(DeezerClient aClient) { iClient = aClient; }
public ArtistEndpoint(DeezerClient aClient) { iClient = aClient; }
public RadioEndpoint(DeezerClient aClient) { iClient = aClient; }
public UserEndpoint(DeezerClient aClient) { iClient = aClient; }
public UserEndpoint(DeezerClient aClient) { iClient = aClient; }
public RadioEndpoint(DeezerClient aClient) { iClient = aClient; }
public ChartsEndpoint(DeezerClient aClient) { iClient = aClient; }
public PlaylistEndpoint(DeezerClient aClient) { iClient = aClient; }