Esempio n. 1
0
        private void AddToQueue(MusicService service, IMediaCollection item, string destination, string pathFormat)
        {
            var enqueuedItem = mediaDownloadQueue.Enqueue(service, item, destination, pathFormat);
            var header       = MakeGroupHeader(enqueuedItem);
            var group        = new ListViewGroup(header, HorizontalAlignment.Center);
            var groupIndex   = queueListView.Groups.Add(group);
            var finalTracks  = new List <string>();

            for (var i = 0; i < item.Tracks.Count; i++)
            {
                var t      = item.Tracks[i];
                var lvItem = new ListViewItem
                {
                    Group = group,
                    Tag   = new MediaItemTag
                    {
                        Track             = t,
                        Collection        = enqueuedItem,
                        GroupIndex        = groupIndex,
                        IndexInCollection = i
                    }
                };
                if (!t.IsDownloadable)
                {
                    Log.Warning(Tag, $"Adding non-downloadable track {service.Info.Name}/{t.Id}");
                    lvItem.BackColor = SystemColors.Control;
                    lvItem.ForeColor = SystemColors.GrayText;
                    lvItem.ImageKey  = "not_downloadable";
                    lvItem.Text      = "Unavailable";
                }
                else
                {
                    lvItem.ImageKey = "ready";
                    lvItem.Text     = "Ready to download";
                }
                lvItem.SubItems.Add(t.DiscNumber + " / " + t.TrackNumber);
                lvItem.SubItems.Add(t.Title);
                lvItem.SubItems.Add(t.Artist.Name);
                lvItem.SubItems.Add(t.Album.Title);
                lvItem.SubItems.Add(BuildFlags(t.CustomMetadata));
                lvItem.SubItems.Add(Path.Combine(destination, t.GetBasicPath(enqueuedItem.PathFormat, item)));

                finalTracks.Add(t.Artist.Name + " - " + t.Title);
                group.Items.Add(lvItem);
                queueListView.Items.Add(lvItem);
            }
            group.Header = MakeGroupHeader(enqueuedItem);
        }
Esempio n. 2
0
        private void AddToQueue(MusicService service, IMediaCollection item, string pathFormat)
        {
            var enqueuedItem = mediaDownloadQueue.Enqueue(service, item, pathFormat);
            var mediaType    = MediaCollectionAsType(item);
            var header       = String.Format(GroupHeaderFormat, mediaType, item.Title, service.Info.Name);
            var group        = new ListViewGroup(header);
            var groupIndex   = queueListView.Groups.Add(group);

            for (var i = 0; i < item.Tracks.Count; i++)
            {
                var t      = item.Tracks[i];
                var lvItem = new ListViewItem
                {
                    Group = group,
                    Tag   = new MediaItemTag
                    {
                        Track             = t,
                        Collection        = enqueuedItem,
                        GroupIndex        = groupIndex,
                        IndexInCollection = i
                    }
                };
                if (!t.IsDownloadable)
                {
                    Log.Warning(Tag, $"Adding non-downloadable track {service.Info.Name}/{t.Id}");
                    lvItem.BackColor = SystemColors.Control;
                    lvItem.ForeColor = SystemColors.GrayText;
                    lvItem.ImageKey  = "not_downloadable";
                    lvItem.Text      = "Unavailable";
                }
                else
                {
                    lvItem.ImageKey = "ready";
                    lvItem.Text     = "Ready to download";
                }
                lvItem.SubItems.Add(t.DiscNumber + " / " + t.TrackNumber);
                lvItem.SubItems.Add(t.Title);
                lvItem.SubItems.Add(t.Artist.Name);
                lvItem.SubItems.Add(t.Album.Title);
                lvItem.SubItems.Add(t.GetBasicPath(enqueuedItem.PathFormat));
                group.Items.Add(lvItem);
                queueListView.Items.Add(lvItem);
            }
        }