projectgoav / E.Deezer

Unoffical asynchronous Deezer .NET API
17 stars 11 forks source link

Stuck at getPlaylistById #70

Closed marcguillemdev closed 5 years ago

marcguillemdev commented 5 years ago

I am trying to get the Top 100 songs from each country by indicating the playlist ID like this:

public async void retrieve_playlist(uint id_playlist) { var dez = DeezerSession.CreateNew(); var po = await dez.Browse.GetPlaylistById(id_playlist); var tracks_po = po.GetTracks();

        for(int i = 0; i < tracks_po.Result.Count(); i++)
        {
            listBox2.Items.Add(tracks_po.Result.ElementAt(i).Title + " de " + tracks_po.Result.ElementAt(i).Artist.Name);
        }
    }

The invocation is this:

retrieve_playlist(716146082);

But the result is this:

System.NullReferenceException: 'Referencia a objeto no establecida como instancia de un objeto.'

erro2 error1

Thanks in advance

projectgoav commented 5 years ago

Can you send me a copy of the full stack trace from the exception please

marcguillemdev commented 5 years ago

Can you send me a copy of the full stack trace from the exception please

Of course, here is it.

  | StackTrace | " en DeezerApi.Form1.d__41.MoveNext() en C:\Users\marc9\source\repos\DeezerApi\DeezerApi\Form1.cs:línea 728" | string

projectgoav commented 5 years ago

According to the API explorer the playlist doesn't exist.

This library should be throwing an exception telling you this so I'll look into that! Your code should be handling exceptions or null returns which should mitigate this issue until I can get the exception throwing fixed.

marcguillemdev commented 5 years ago

Oops, you are right, that playlist doesn't exist. I tried with this and still don't work.

1362510315

https://www.deezer.com/en/playlist/1362510315

projectgoav commented 5 years ago

The json parsing code was missing a custom converter meaning that objects fetched by their ID wasn't working.

71 fixes this and will be released to Nuget shortly after I post this :)