Exemple #1
0
        private void ImportBooks()
        {
            var selected_shelves = Shelves.Where(s => s.Selected)
                                   .Select(s => s.Name)
                                   .ToList();
            var books_on_selected_shelves = Books.Where(b => !b.IsDuplicate && selected_shelves.Contains(b.ExclusiveShelf));
            var books_to_import           = GoodreadsMapper.Map(books_on_selected_shelves).ToList();

            import_controller.Import(books_to_import);

            MessageBus.Current.SendMessage(NavigationMessage.Books);
            MessageBus.Current.SendMessage(new InformationMessage($"{books_to_import.Count} books were imported"));
        }
Exemple #2
0
        public void Execute(CancellationToken token)
        {
            // Check if this has already been processed
            if (collection.Series.Any(s => s.Metadata["GoodreadsSeriesId"] == id))
            {
                return;
            }

            var goodreads_series = client.GetSeriesById(id, token);
            var series           = GoodreadsMapper.Map(goodreads_series);

            series.LastChecked = DateTime.Now;

            log.Report($"Processing {series.Title}");

            Task.Factory.StartNew(() => collection.Add(series), token, TaskCreationOptions.DenyChildAttach, scheduler)
            .Wait(token);
        }
        public void Execute(CancellationToken token)
        {
            Thread.Sleep(1000);

            var book = collection.Books.FirstOrDefault(b => b.Metadata["GoodreadsWorkId"] == entry.Metadata["GoodreadsWorkId"]);
            var found_in_collection = true;

            if (book == null)
            {
                var goodreads_book = client.GetBookById(entry.Metadata["GoodreadsBestBookId"], token);
                book = GoodreadsMapper.Map(goodreads_book);
                found_in_collection = false;
            }

            log.Report($"Processing {book.Title}");

            Task.Factory.StartNew(() => Update(book, found_in_collection), token, TaskCreationOptions.DenyChildAttach, scheduler)
            .Wait(token);
        }