Beispiel #1
0
        public async Task Save()
        {
            if (!string.IsNullOrEmpty(SelectedDirectory))
            {
                await _engine.WatchDirectory(SelectedDirectory);
            }

            var toDelete = new List <Media>();
            var toInsert = new List <Media>();

            foreach (var newMediaViewModel in SelectedSearches.Where(s => s.Search.ResultSelections.SelectedItems.Any()))
            {
                var newMedias = newMediaViewModel.Search.ResultSelections.SelectedItems.Select(si => si.Media).Where(m => m != null).ToList();
                if (!newMedias.Any())
                {
                    continue;
                }

                if (newMediaViewModel.OriginalMedia != null)
                {
                    toDelete.Add(newMediaViewModel.OriginalMedia);
                }

                toInsert.AddRange(newMedias);
            }

            await _engine.SaveChanges(toInsert, null, toDelete);

            _engine.ExecuteDownloadJob();
        }
Beispiel #2
0
 private void ExecuteDownloads()
 {
     _engine.ExecuteDownloadJob();
     _engine.ExecuteSubtitleDownloadJob();
 }