public EnhancedImageServer(RuntimeImageProcessor cache, BookThumbNailer thumbNailer, BookSelection bookSelection, BloomFileLocator fileLocator = null) : base(cache) { _thumbNailer = thumbNailer; _bookSelection = bookSelection; _fileLocator = fileLocator; }
public LibraryModel(string pathToLibrary, CollectionSettings collectionSettings, //SendReceiver sendReceiver, BookSelection bookSelection, SourceCollectionsList sourceCollectionsList, BookCollection.Factory bookCollectionFactory, EditBookCommand editBookCommand, CreateFromSourceBookCommand createFromSourceBookCommand, BookServer bookServer, CurrentEditableCollectionSelection currentEditableCollectionSelection, BookThumbNailer thumbNailer, TeamCollectionManager tcManager) { _bookSelection = bookSelection; _pathToLibrary = pathToLibrary; _collectionSettings = collectionSettings; //_sendReceiver = sendReceiver; _sourceCollectionsList = sourceCollectionsList; _bookCollectionFactory = bookCollectionFactory; _editBookCommand = editBookCommand; _bookServer = bookServer; _currentEditableCollectionSelection = currentEditableCollectionSelection; _thumbNailer = thumbNailer; _tcManager = tcManager; createFromSourceBookCommand.Subscribe(CreateFromSourceBook); }
public BookTransfer(BloomParseClient bloomParseClient, BloomS3Client bloomS3Client, BookThumbNailer htmlThumbnailer, BookDownloadStartingEvent bookDownloadStartingEvent) { this._parseClient = bloomParseClient; this._s3Client = bloomS3Client; _thumbnailer = htmlThumbnailer; _bookDownloadStartingEvent = bookDownloadStartingEvent; }
/// <summary> /// Creates an ePub file at the location specified by parameters /// </summary> /// <param name="parameters">BookPath and epubOutputPath should be set.</param> /// <param name="control">The epub code needs a control that goes back to the main thread, in order to run some tasks that need to be on the main thread</param> public static void CreateEpubArtifact(CreateArtifactsParameters parameters, Control control) { if (String.IsNullOrEmpty(parameters.EpubOutputPath)) { return; } string directoryName = Path.GetDirectoryName(parameters.EpubOutputPath); Directory.CreateDirectory(directoryName); // Ensures that the directory exists BookServer bookServer = _projectContext.BookServer; BookThumbNailer thumbNailer = _projectContext.ThumbNailer; var maker = new EpubMaker(thumbNailer, bookServer); maker.ControlForInvoke = control; maker.Book = _book; maker.Unpaginated = true; // so far they all are maker.OneAudioPerPage = true; // default used in EpubApi // Enhance: maybe we want book to have image descriptions on page? use reader font sizes? // Make the epub maker.SaveEpub(parameters.EpubOutputPath, new NullWebSocketProgress()); }
public CollectionModel(string pathToCollection, CollectionSettings collectionSettings, BookSelection bookSelection, SourceCollectionsList sourceCollectionsList, BookCollection.Factory bookCollectionFactory, EditBookCommand editBookCommand, CreateFromSourceBookCommand createFromSourceBookCommand, BookServer bookServer, CurrentEditableCollectionSelection currentEditableCollectionSelection, BookThumbNailer thumbNailer, TeamCollectionManager tcManager, BloomWebSocketServer webSocketServer, BookCollectionHolder bookCollectionHolder, LocalizationChangedEvent localizationChangedEvent) { _bookSelection = bookSelection; _pathToCollection = pathToCollection; _collectionSettings = collectionSettings; _sourceCollectionsList = sourceCollectionsList; _bookCollectionFactory = bookCollectionFactory; _editBookCommand = editBookCommand; _bookServer = bookServer; _currentEditableCollectionSelection = currentEditableCollectionSelection; _thumbNailer = thumbNailer; _tcManager = tcManager; _webSocketServer = webSocketServer; _bookCollectionHolder = bookCollectionHolder; _localizationChangedEvent = localizationChangedEvent; createFromSourceBookCommand.Subscribe(CreateFromSourceBook); }
public BloomServer(CollectionSettings collectionSettings, BookCollection booksInProjectLibrary, SourceCollectionsList sourceCollectionsesList, BookThumbNailer thumbNailer) : base(new RuntimeImageProcessor(new BookRenamedEvent()), thumbNailer) { _collectionSettings = collectionSettings; _booksInProjectLibrary = booksInProjectLibrary; _sourceCollectionsesList = sourceCollectionsesList; }
public CollectionApi(CollectionSettings settings, CollectionModel collectionModel, BookSelection bookSelection, EditBookCommand editBookCommand, BookThumbNailer thumbNailer, BloomWebSocketServer webSocketServer) { _settings = settings; _collectionModel = collectionModel; _bookSelection = bookSelection; _editBookCommand = editBookCommand; _thumbNailer = thumbNailer; _webSocketServer = webSocketServer; }
public PublishEpubApi(BookThumbNailer thumbNailer, NavigationIsolator isolator, BookServer bookServer, BookSelection bookSelection, CollectionSettings collectionSettings, BloomWebSocketServer webSocketServer) { _thumbNailer = thumbNailer; _bookServer = bookServer; _bookSelection = bookSelection; _collectionSettings = collectionSettings; _webSocketServer = webSocketServer; _standardProgress = new WebSocketProgress(_webSocketServer, kWebsocketContext); }
public static bool ForPageLayout = false; // set when most recent relevant command is ShowChangeLayoutDialog public PageTemplatesApi(SourceCollectionsList sourceCollectionsList, BookSelection bookSelection, PageSelection pageSelection, TemplateInsertionCommand templateInsertionCommand, BookThumbNailer thumbNailer, Book.Book.Factory bookFactory, BookStorage.Factory storageFactory) { _sourceCollectionsList = sourceCollectionsList; _bookSelection = bookSelection; _pageSelection = pageSelection; _templateInsertionCommand = templateInsertionCommand; _thumbNailer = thumbNailer; _bookFactory = bookFactory; _storageFactory = storageFactory; }
public PageTemplatesApi(SourceCollectionsList sourceCollectionsList,BookSelection bookSelection, PageSelection pageSelection, TemplateInsertionCommand templateInsertionCommand, BookThumbNailer thumbNailer, Book.Book.Factory bookFactory, BookStorage.Factory storageFactory) { _sourceCollectionsList = sourceCollectionsList; _bookSelection = bookSelection; _pageSelection = pageSelection; _templateInsertionCommand = templateInsertionCommand; _thumbNailer = thumbNailer; _bookFactory = bookFactory; _storageFactory = storageFactory; }
public PublishModel(BookSelection bookSelection, PdfMaker pdfMaker, CurrentEditableCollectionSelection currentBookCollectionSelection, CollectionSettings collectionSettings, BookServer bookServer, BookThumbNailer thumbNailer) { BookSelection = bookSelection; _pdfMaker = pdfMaker; _pdfMaker.CompressPdf = true; // See http://issues.bloomlibrary.org/youtrack/issue/BL-3721. //_pdfMaker.EngineChoice = collectionSettings.PdfEngineChoice; _currentBookCollectionSelection = currentBookCollectionSelection; ShowCropMarks = false; _collectionSettings = collectionSettings; _bookServer = bookServer; _thumbNailer = thumbNailer; bookSelection.SelectionChanged += OnBookSelectionChanged; //we don't want to default anymore: BookletPortion = BookletPortions.BookletPages; }
public PublishModel(BookSelection bookSelection, PdfMaker pdfMaker, CurrentEditableCollectionSelection currentBookCollectionSelection, CollectionSettings collectionSettings, BookServer bookServer, BookThumbNailer thumbNailer, NavigationIsolator isolator) { BookSelection = bookSelection; _pdfMaker = pdfMaker; //_pdfMaker.EngineChoice = collectionSettings.PdfEngineChoice; _currentBookCollectionSelection = currentBookCollectionSelection; ShowCropMarks=false; _collectionSettings = collectionSettings; _bookServer = bookServer; _thumbNailer = thumbNailer; bookSelection.SelectionChanged += new EventHandler(OnBookSelectionChanged); _isoloator = isolator; //we don't want to default anymore: BookletPortion = BookletPortions.BookletPages; }
public PublishModel(BookSelection bookSelection, PdfMaker pdfMaker, CurrentEditableCollectionSelection currentBookCollectionSelection, CollectionSettings collectionSettings, BookServer bookServer, BookThumbNailer thumbNailer, NavigationIsolator isolator) { BookSelection = bookSelection; _pdfMaker = pdfMaker; //_pdfMaker.EngineChoice = collectionSettings.PdfEngineChoice; _currentBookCollectionSelection = currentBookCollectionSelection; ShowCropMarks = false; _collectionSettings = collectionSettings; _bookServer = bookServer; _thumbNailer = thumbNailer; bookSelection.SelectionChanged += new EventHandler(OnBookSelectionChanged); _isoloator = isolator; //we don't want to default anymore: BookletPortion = BookletPortions.BookletPages; }
public void GenerateCoverImageOfRequestedMaxSize_GivenVariousThmbnailSizes_ThumbnailIsCorrectSize(int requestedSize, int originalWidth, int originalHeight, int expectedWidth, int expectedHeight) { // Setup var book = SetupBook("coverImage.png", originalWidth, originalHeight); // System under test BookThumbNailer.GenerateCoverImageOfRequestedMaxSize(book, requestedSize); // Verification string expectedThumbnailFilename = book.FolderPath.CombineForPath($"thumbnail-{requestedSize}.png"); Assert.That(RobustFile.Exists(expectedThumbnailFilename), Is.True, "Thumbnail does not exist at expected path"); using (var image = System.Drawing.Image.FromFile(expectedThumbnailFilename)) { Assert.That(image.Width, Is.EqualTo(expectedWidth), "image width"); Assert.That(image.Height, Is.EqualTo(expectedHeight), "image height"); } }
public static void CreateThumbnailArtifact(CreateArtifactsParameters parameters) { if (String.IsNullOrWhiteSpace(parameters.ThumbnailOutputInfoPath)) { return; } var outputPaths = new List <string>(); int[] requestedHeights = new int[2] { 256, 70 }; foreach (int height in requestedHeights) { // A potential "enhancement" is that we could try to re-use the thumbnail generated when making an ePUB. // That could be helpful if creating new thumbnails was a big enough cost // The ePub Path looks like this: $"%TEMP%\\ePUB_export\\{i}\\{book.Title}\\thumbnail-{height}.png" // (where i is an integer between 0-19. Depends on whether it's been locked or not.) // // For now, we'll just create the thumbnail every time // It makes the code simpler than having fallback logic not to mention the complications of determining which folder the ePub is in, whether it's really up-to-date, etc. string thumbnailPath = BookThumbNailer.GenerateCoverImageOfRequestedMaxSize(_book, height); AppendPathIfExists(thumbnailPath, outputPaths); } string shareThumbnail = BookThumbNailer.GenerateSocialMediaSharingThumbnail(_book); AppendPathIfExists(shareThumbnail, outputPaths); using (var writer = new StreamWriter(parameters.ThumbnailOutputInfoPath, append: false)) { foreach (var path in outputPaths) { writer.WriteLine(path); } } }
internal static void MakeSizedThumbnail(Book book, Color backColor, string destinationFolder, int heightAndWidth) { // If this fails to create a 'coverImage200.jpg', either the cover image is missing or it's only a placeholder. // If this is a new book, the file may exist already, but we want to make sure it's up-to-date. // If this is an older book, we need the .bloomd to have it so that Harvester will be able to access it. BookThumbNailer.GenerateImageForWeb(book); var coverImagePath = book.GetCoverImagePath(); if (coverImagePath == null) { var blankImage = Path.Combine(FileLocationUtilities.DirectoryOfApplicationOrSolution, "DistFiles", "Blank.png"); if (RobustFile.Exists(blankImage)) { coverImagePath = blankImage; } } if (coverImagePath != null) { var thumbPath = Path.Combine(destinationFolder, "thumbnail.png"); RuntimeImageProcessor.GenerateEBookThumbnail(coverImagePath, thumbPath, heightAndWidth, heightAndWidth, backColor); } }
public LibraryModel(string pathToLibrary, CollectionSettings collectionSettings, //SendReceiver sendReceiver, BookSelection bookSelection, SourceCollectionsList sourceCollectionsList, BookCollection.Factory bookCollectionFactory, EditBookCommand editBookCommand, CreateFromSourceBookCommand createFromSourceBookCommand, BookServer bookServer, CurrentEditableCollectionSelection currentEditableCollectionSelection, BookThumbNailer thumbNailer) { _bookSelection = bookSelection; _pathToLibrary = pathToLibrary; _collectionSettings = collectionSettings; //_sendReceiver = sendReceiver; _sourceCollectionsList = sourceCollectionsList; _bookCollectionFactory = bookCollectionFactory; _editBookCommand = editBookCommand; _bookServer = bookServer; _currentEditableCollectionSelection = currentEditableCollectionSelection; _thumbNailer = thumbNailer; createFromSourceBookCommand.Subscribe(CreateFromSourceBook); }
public BulkUploader(BookUpload singleBookUploader) { _singleBookUploader = singleBookUploader; _thumbnailer = singleBookUploader._thumbnailer; }
internal HarvesterBookTransfer(BloomParseClient parseClient, BloomS3Client bloomS3Client, BookThumbNailer htmlThumbnailer) : base(parseClient, bloomS3Client, htmlThumbnailer, new Bloom.BookDownloadStartingEvent()) { }
public BookUpload(BloomParseClient bloomParseClient, BloomS3Client bloomS3Client, BookThumbNailer htmlThumbnailer) { this.ParseClient = bloomParseClient; this._s3Client = bloomS3Client; _thumbnailer = htmlThumbnailer; }
public EpubMaker(BookThumbNailer thumbNailer, NavigationIsolator _isolator) { _thumbNailer = thumbNailer; _browser.Isolator = _isolator; }