Example #1
0
        public async void UpdateTrack(SpotifyAPI.Local.Models.Track track, string urlTrack)
        {
            _currentTrack    = track;
            _currentUrlTrack = urlTrack;

            adLabel.Visible         = track.IsAd() ? true : false;
            progressBarSong.Maximum = track.Length;

            if (track.IsAd())
            {
                return; //Don't process further, maybe null values
            }
            lblJudul.Text = track.TrackResource.Name;

            lblArtis.Text = track.ArtistResource.Name;

            lblAlbum.Text = track.AlbumResource.Name;

            SpotifyAPI.Local.Models.SpotifyUri uri = track.TrackResource.ParseUri();
            pbTrack.Image = await track.GetAlbumArtAsync(SpotifyAPI.Local.Enums.AlbumArtSize.Size160);
        }
Example #2
0
        public Song(Track track)
        {
            Album  = track?.AlbumResource?.Name;
            Artist = track?.ArtistResource?.Name;
            Title  = track?.TrackResource?.Name;

            Type     = track?.TrackType;
            Length   = track?.Length;
            IsAd     = (track?.IsAd() ?? false) && !(track?.TrackResource?.Uri != null && Type == "normal");
            IsOther  = track?.IsOtherTrackType() ?? false;
            IsNormal = Title != null && Artist != null;

            if (IsAd || IsOther)
            {
                return;
            }

            Task.Run(() => GetPictures(track));
        }
Example #3
0
        public Song(Track track)
        {
            Album  = track?.AlbumResource?.Name;
            Artist = track?.ArtistResource?.Name;
            Title  = track?.TrackResource?.Name;

            Type     = track?.TrackType;
            Length   = track?.Length;
            IsAd     = track?.IsAd() ?? false;
            IsOther  = track?.IsOtherTrackType() ?? false;
            IsNormal = Artist != null && Title != null;

            if (IsAd || IsOther)
            {
                return;
            }

            try
            {
                ArtLarge = track?.GetAlbumArtAsByteArray(AlbumArtSize.Size160);
            }
            catch (Exception ex)
            {
                ArtLarge = null;
                Console.WriteLine(ex.Message);
            }

            try
            {
                ArtExtraLarge = track?.GetAlbumArtAsByteArray(AlbumArtSize.Size320);
            }
            catch (Exception ex)
            {
                ArtExtraLarge = null;
                Console.WriteLine(ex.Message);
            }
        }