internal string FullUpload(Book.Book book, LogBox progressBox, PublishView publishView, string[] languages, out string parseId, Form invokeTarget = null)
{
var bookFolder = book.FolderPath;
parseId = ""; // in case of early return
// Set this in the metadata so it gets uploaded. Do this in the background task as it can take some time.
// These bits of data can't easily be set while saving the book because we save one page at a time
// and they apply to the book as a whole.
book.BookInfo.LanguageTableReferences = _parseClient.GetLanguagePointers(book.CollectionSettings.MakeLanguageUploadData(languages));
book.BookInfo.PageCount = book.GetPages().Count();
book.BookInfo.Save();
progressBox.WriteStatus(LocalizationManager.GetString("PublishTab.Upload.MakingThumbnail", "Making thumbnail image..."));
//the largest thumbnail I found on Amazon was 300px high. Prathambooks.org about the same.
_thumbnailer.MakeThumbnailOfCover(book, 70, invokeTarget); // this is a sacrificial one to prime the pump, to fix BL-2673
_thumbnailer.MakeThumbnailOfCover(book, 70, invokeTarget);
if (progressBox.CancelRequested)
return "";
_thumbnailer.MakeThumbnailOfCover(book, 256, invokeTarget);
if (progressBox.CancelRequested)
return "";
// It is possible the user never went back to the Collection tab after creating/updating the book, in which case
// the 'normal' thumbnail never got created/updating. See http://issues.bloomlibrary.org/youtrack/issue/BL-3469.
_thumbnailer.MakeThumbnailOfCover(book, invokeTarget);
if (progressBox.CancelRequested)
return "";
var uploadPdfPath = UploadPdfPath(bookFolder);
// If there is not already a locked preview in the book folder
// (which we take to mean the user has created a customized one that he prefers),
// make sure we have a current correct preview and then copy it to the book folder so it gets uploaded.
if (!FileUtils.IsFileLocked(uploadPdfPath))
{
progressBox.WriteStatus(LocalizationManager.GetString("PublishTab.Upload.MakingPdf", "Making PDF Preview..."));
publishView.MakePublishPreview();
if (RobustFile.Exists(publishView.PdfPreviewPath))
{
RobustFile.Copy(publishView.PdfPreviewPath, uploadPdfPath, true);
}
}
if (progressBox.CancelRequested)
return "";
return UploadBook(bookFolder, progressBox, out parseId, Path.GetFileName(uploadPdfPath));
}