Пример #1
0
 internal string UploadOneBook(BookInstance book, LogBox progressBox, PublishView publishView, string[] languages, bool excludeNarrationAudio, bool excludeMusic, out string parseId)
 {
     using (var tempFolder = new TemporaryFolder(Path.Combine("BloomUpload", Path.GetFileName(book.FolderPath))))
     {
         BookTransfer.PrepareBookForUpload(ref book, _publishModel.BookServer, tempFolder.FolderPath, progressBox);
         return(_transferrer.FullUpload(book, progressBox, publishView, languages, excludeNarrationAudio, excludeMusic, false, out parseId));
     }
 }
Пример #2
0
        public BloomLibraryPublishModel(BookTransfer transferer, BookInstance book, PublishModel model)
        {
            Book          = book;
            _transferrer  = transferer;
            _publishModel = model;

            _licenseMetadata = Book.GetLicenseMetadata();
            // This is usually redundant, but might not be on old books where the license was set before the new
            // editing code was written.
            Book.SetMetadata(_licenseMetadata);
            _license = _licenseMetadata.License;

            EnsureBookAndUploaderId();
        }
        public BloomLibraryPublishModel(BookTransfer transferer, BookInstance book)
        {
            Book         = book;
            _transferrer = transferer;

            _licenseMetadata = Book.GetLicenseMetadata();
            // This is usually redundant, but might not be on old books where the license was set before the new
            // editing code was written.
            Book.SetMetadata(_licenseMetadata);
            _license = _licenseMetadata.License;

            EnsureBookAndUploaderId();
            WebUserId          = Settings.Default.WebUserId;
            _storedWebPassword = Settings.Default.WebPassword;
        }
 internal string UploadOneBook(BookInstance book, LogBox progressBox, PublishView publishView, string[] languages, bool excludeNarrationAudio, bool excludeMusic, out string parseId)
 {
     using (var tempFolder = new TemporaryFolder(Path.Combine("BloomUpload", Path.GetFileName(book.FolderPath))))
     {
         BookUpload.PrepareBookForUpload(ref book, _publishModel.BookServer, tempFolder.FolderPath, progressBox);
         var bookParams = new BookUploadParameters
         {
             ExcludeNarrationAudio = excludeNarrationAudio,
             ExcludeMusic          = excludeMusic,
             PreserveThumbnails    = false,
             LanguagesToUpload     = languages,
         };
         return(_uploader.FullUpload(book, progressBox, publishView, bookParams, out parseId));
     }
 }
Пример #5
0
        /// <summary>
        /// Check for either "Device16x9Portrait" or "Device16x9Landscape" layout.
        /// Complain to the user if another layout is currently chosen.
        /// </summary>
        /// <remarks>
        /// See https://issues.bloomlibrary.org/youtrack/issue/BL-5274.
        /// </remarks>
        static internal void CheckBookLayout(Bloom.Book.Book book, Bloom.web.WebSocketProgress progress)
        {
            var layout            = book.GetLayout();
            var desiredLayoutSize = "Device16x9";

            if (layout.SizeAndOrientation.PageSizeName != desiredLayoutSize)
            {
                // The progress object has been initialized to use an id prefix.  So we'll access L10NSharp explicitly here.  We also want to make the string blue,
                // which requires a special argument.
                var msgFormat = L10NSharp.LocalizationManager.GetString("PublishTab.Android.WrongLayout.Message",
                                                                        "The layout of this book is currently \"{0}\". Bloom Reader will display it using \"{1}\", so text might not fit. To see if anything needs adjusting, go back to the Edit Tab and change the layout to \"{1}\".",
                                                                        "{0} and {1} are book layout tags.");
                var desiredLayout = desiredLayoutSize + layout.SizeAndOrientation.OrientationName;
                var msg           = String.Format(msgFormat, layout.SizeAndOrientation.ToString(), desiredLayout, Environment.NewLine);
                progress.MessageWithStyleWithoutLocalizing(msg, "color:blue");
            }
        }
 internal string UploadOneBook(BookInstance book, LogBox progressBox, PublishView publishView, string[] languages, out string parseId)
 {
     return(_transferrer.FullUpload(book, progressBox, publishView, languages, out parseId));
 }