Ejemplo n.º 1
0
        private void AddToQueue(DownloadAudioFile track)
        {
            if (QueueTracks == null)
            {
                QueueTracks = new List <DownloadAudioFile>();
            }

            if (QueueTracks.Any(t => t == track))
            {
                return;
            }
            QueueTracks.Add(track);
        }
        private HttpResponse QueueContentsResponse()
        {
            var queue = new QueueTracks();
            var track = Player.CurrentTrack;

            if (track != null)
            {
                var container = Player.ActivePlaylist ?? Player.MediaLibrary;

                var canp = new CanpData
                {
                    DatabaseId      = id,
                    ContainerId     = container.Id,
                    ContainerItemId = track.Id,
                    TrackId         = track.Id
                };

                queue.Add(new QueueTrack()
                {
                    TrackSpecs  = canp.Data,
                    AlbumId     = (track.Album != null) ? track.Album.PersistentId : 0,
                    Album       = track.AlbumName,
                    AlbumArtist = (track.AlbumArtist != null) ? track.AlbumArtist.Id : 0,
                    Artist      = track.ArtistName,
                    Title       = track.Title,
                    Genre       = track.GenreName,
                    MediaKind   = 1,
                    QueueIndex  = 1,
                    Upcoming    = false
                });
            }

            return(new DmapResponse(new
            {
                ceQR = new
                {
                    mstt = 200,
                    muty = (byte)0,
                    ceQu = true, // update???
                    mlcl = queue,
                    apsm = false,
                    aprm = (byte)0
                }
            }));
        }