Ejemplo n.º 1
0
        static void MigrateLocalMylistToPlaylistRepository(PlaylistRepository playlistRepository)
        {
            var groups = LocalMylistDb.GetLocalMylistGroups();

            if (groups.Count > 0)
            {
                System.Diagnostics.Debug.WriteLine("start migrating LocalMylist.");
                foreach (var legacyLocalPlaylist in groups)
                {
                    var newPlaylist = new PlaylistEntity()
                    {
                        Id             = LiteDB.ObjectId.NewObjectId().ToString(),
                        Label          = legacyLocalPlaylist.Label,
                        Count          = legacyLocalPlaylist.Items.Count,
                        PlaylistOrigin = Interfaces.PlaylistOrigin.Local
                    };

                    playlistRepository.Upsert(newPlaylist);
                    playlistRepository.AddItems(newPlaylist.Id, legacyLocalPlaylist.Items);

                    LocalMylistDb.Remove(legacyLocalPlaylist);

                    System.Diagnostics.Debug.WriteLine($"migrated: {newPlaylist.Label} ({newPlaylist.Count})");
                }
                System.Diagnostics.Debug.WriteLine("migrating LocalMylist done.");
            }
        }
Ejemplo n.º 2
0
        public void AddPlaylistItem(IEnumerable <IVideoContent> items)
        {
            var ids = items.Select(x => x.Id).ToList();

            _playlistRepository.AddItems(Id, ids);
            ItemAdded?.Invoke(this, new LocalPlaylistItemAddedEventArgs()
            {
                PlaylistId = Id,
                AddedItems = ids
            });
        }