private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (pivot.SelectedItem == torrentspivot) { TorrentsGrid.Visibility = Windows.UI.Xaml.Visibility.Collapsed; NoTorrentResults.Visibility = Windows.UI.Xaml.Visibility.Collapsed; TorrentsLoadRing.IsActive = true; ViewModel.Torrents.Clear(); var torrents = new List <Torrent>(); foreach (var indexer in JackettService.Indexers) { torrents.AddRange(await Task.Run(() => JackettService.SearchTorrents(ViewModel.Movie.title, indexer, JackettService.MovieCategories))); torrents.AddRange(await Task.Run(() => JackettService.SearchTorrents(ViewModel.Movie.original_title, indexer, JackettService.MovieCategories))); } TorrentsLoadRing.IsActive = false; if (torrents.Count == 0) { NoTorrentResults.Visibility = Windows.UI.Xaml.Visibility.Visible; } else { TorrentsGrid.Visibility = Windows.UI.Xaml.Visibility.Visible; } torrents = torrents.OrderByDescending(x => int.Parse(x.Attributes.Where(y => y.Name.Equals("seeders")).ToList()[0].Value)).GroupBy(z => z.Title).Select(w => w.First()).ToList(); var betterresults = torrents.Where(x => x.Title.Contains($"{ViewModel.Movie.release_date.Split('-')[0]}")).ToList(); betterresults.ForEach(x => torrents.Remove(x)); torrents.InsertRange(0, betterresults); torrents.ForEach(x => ViewModel.Torrents.Add(x)); } }
private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (pivot.SelectedItem == torrentspivot) { TorrentsGrid.Visibility = Windows.UI.Xaml.Visibility.Collapsed; NoTorrentResults.Visibility = Windows.UI.Xaml.Visibility.Collapsed; TorrentsLoadRing.IsActive = true; ViewModel.Torrents.Clear(); var torrents = new List <Torrent>(); foreach (var indexer in JackettService.Indexers) { torrents.AddRange(await Task.Run(() => JackettService.SearchTorrents(ViewModel.Show.name + " S" + ViewModel.Season.season_number.ToString("00"), indexer, JackettService.TVCategories))); torrents.AddRange(await Task.Run(() => JackettService.SearchTorrents(ViewModel.Show.original_name + " S" + ViewModel.Season.season_number.ToString("00"), indexer, JackettService.TVCategories))); torrents.AddRange(await Task.Run(() => JackettService.SearchTorrents(ViewModel.Show.name + " season " + ViewModel.Season.season_number.ToString(), indexer, JackettService.TVCategories))); torrents.AddRange(await Task.Run(() => JackettService.SearchTorrents(ViewModel.Show.original_name + " season " + ViewModel.Season.season_number.ToString(), indexer, JackettService.TVCategories))); } TorrentsLoadRing.IsActive = false; if (torrents.Count == 0) { NoTorrentResults.Visibility = Windows.UI.Xaml.Visibility.Visible; } else { TorrentsGrid.Visibility = Windows.UI.Xaml.Visibility.Visible; } torrents = torrents.OrderByDescending(x => int.Parse(x.Attributes.Where(y => y.Name.Equals("seeders")).ToList()[0].Value)).GroupBy(z => z.Title).Select(w => w.First()).ToList(); torrents.ForEach(x => ViewModel.Torrents.Add(x)); } }
public App() { InitializeComponent(); TMDBService.Init(); JackettService.Init(); // Deferred execution until used. Check https://msdn.microsoft.com/library/dd642331(v=vs.110).aspx for further info on Lazy<T> class. _activationService = new Lazy <ActivationService>(CreateActivationService); }
async Task LoadIndexers() { var indexers = await Task.Run(() => JackettService.GetConfiguredIndexers()); indexers.ForEach(x => Indexers.Add(x)); }