public void Convert(ItemTitleInfo itemTitleInfo, IBookInformationData titleInformation)
        {
            titleInformation.Languages.Clear();
            titleInformation.Creators.Clear();
            titleInformation.Contributors.Clear();
            titleInformation.Subjects.Clear();
            titleInformation.Identifiers.Clear();

            // in case main body title is not defined (empty)
            if ((itemTitleInfo != null) && (itemTitleInfo.BookTitle != null))
            {
                titleInformation.BookMainTitle = itemTitleInfo.BookTitle.Text;
            }

            titleInformation.AllSequences.Clear();

            if (itemTitleInfo != null)
            {
                SequencesInfoConverterV2.Convert(itemTitleInfo, titleInformation);

                // Getting information from FB2 Title section
                ConvertMainTitle(itemTitleInfo, titleInformation);

                // add authors
                AuthorsInfoConverterV2.Convert(itemTitleInfo, _conversionSettings, titleInformation);

                // add translators
                TranslatorsInfoConverterV2.Convert(itemTitleInfo, titleInformation, _conversionSettings);

                // genres
                GenresInfoConverterV2.Convert(itemTitleInfo, titleInformation, _conversionSettings);
            }
            titleInformation.DateFileCreation = DateTime.Now;
        }
        public void Convert(ItemTitleInfo itemTitleInfo, IBookInformationData titleInformation)
        {
            titleInformation.Languages.Clear();
            titleInformation.Creators.Clear();
            titleInformation.Contributors.Clear();
            titleInformation.Subjects.Clear();
            titleInformation.Identifiers.Clear();

            // in case main body title is not defined (empty)
            if ((itemTitleInfo != null) && (itemTitleInfo.BookTitle != null))
            {
                titleInformation.BookMainTitle = itemTitleInfo.BookTitle.Text;
            }

            titleInformation.AllSequences.Clear();

            if (itemTitleInfo != null)
            {
                // Pass all sequences
                SequencesInfoConverterV3.Convert(itemTitleInfo, titleInformation);

                // Getting information from FB2 Title section
                ConvertMainTitle(itemTitleInfo, titleInformation);

                // add authors
                AuthorsInfoConverterV3.Convert(itemTitleInfo, _conversionSettings, titleInformation);

                // add translators
                TranslatorsInfoConverterV3.Convert(itemTitleInfo, titleInformation, _conversionSettings);

                // genres
                GenresInfoConverterV3.Convert(itemTitleInfo, titleInformation,_conversionSettings);
            }
            titleInformation.DateFileCreation = DateTime.Now;
        }
Beispiel #3
0
 public void Convert(FB2File fb2File, IBookInformationData titleInformation)
 {
     _titleInfoConverter.Convert(fb2File.TitleInfo, titleInformation);
     _bookIDConverter.Convert(fb2File, titleInformation);
     _sourceInfoConverter.Convert(fb2File, titleInformation);
     _publisherInfoConverter.Convert(fb2File, titleInformation);
     _seriesDataConverter.Convert(fb2File, titleInformation);
 }
 public void Convert(FB2File fb2File, IBookInformationData titleInformation)
 {
     _titleInfoConverter.Convert(fb2File.TitleInfo,titleInformation);
     _bookIDConverter.Convert(fb2File, titleInformation);
     _sourceInfoConverter.Convert(fb2File, titleInformation);
     _publisherInfoConverter.Convert(fb2File, titleInformation);
     _seriesDataConverter.Convert(fb2File, titleInformation);
 }
 public void Convert(FB2File fb2File,IBookInformationData titleInformation, ICalibreMetadata metadata)
 {
     _titleInfoConverter.Convert(fb2File.TitleInfo, titleInformation);
     _bookIDConverter.Convert(fb2File, titleInformation);
     _sourceInfoConverter.Convert(fb2File, titleInformation);
     _publisherInfoConverter.Convert(fb2File, titleInformation);
     _calibreMetadataConverter.Convert(fb2File, metadata);
     _seriesDataConverter.Convert(fb2File, titleInformation);
 }
 public void Convert(FB2File fb2File, IBookInformationData titleInformation, ICalibreMetadata metadata)
 {
     _titleInfoConverter.Convert(fb2File.TitleInfo, titleInformation);
     _bookIDConverter.Convert(fb2File, titleInformation);
     _sourceInfoConverter.Convert(fb2File, titleInformation);
     _publisherInfoConverter.Convert(fb2File, titleInformation);
     _calibreMetadataConverter.Convert(fb2File, metadata);
     _seriesDataConverter.Convert(fb2File, titleInformation);
 }
        private void PassPublisherInfoFromFB2(FB2File fb2File, IBookInformationData titleInformation, IEPubConversionSettings settings)
        {
            if (fb2File.PublishInfo.BookTitle != null)
            {
                var bookTitle = new Title
                {
                    TitleName =
                        Rus2Lat.Instance.Translate(fb2File.PublishInfo.BookTitle.Text, settings.TransliterationSettings),
                    Language =
                        !string.IsNullOrEmpty(fb2File.PublishInfo.BookTitle.Language)
                            ? fb2File.PublishInfo.BookTitle.Language
                            : fb2File.TitleInfo.Language
                };
                if ((Settings.ConversionSettings.IgnoreTitle != IgnoreInfoSourceOptions.IgnorePublishTitle) && (Settings.ConversionSettings.IgnoreTitle != IgnoreInfoSourceOptions.IgnoreMainAndPublish) &&
                    Settings.ConversionSettings.IgnoreTitle != IgnoreInfoSourceOptions.IgnoreSourceAndPublish)
                {
                    bookTitle.TitleType = TitleType.PublishInfo;
                    titleInformation.BookTitles.Add(bookTitle);
                }
            }


            if (fb2File.PublishInfo.ISBN != null)
            {
                var bookId = new Identifier
                {
                    IdentifierName = "BookISBN",
                    ID             = fb2File.PublishInfo.ISBN.Text,
                    Scheme         = "ISBN"
                };
                titleInformation.Identifiers.Add(bookId);
            }


            if (fb2File.PublishInfo.Publisher != null)
            {
                titleInformation.Publisher.PublisherName = Rus2Lat.Instance.Translate(fb2File.PublishInfo.Publisher.Text, settings.TransliterationSettings);
            }


            try
            {
                if (fb2File.PublishInfo.Year.HasValue)
                {
                    var date = new DateTime(fb2File.PublishInfo.Year.Value, 1, 1);
                    titleInformation.DatePublished = date;
                }
            }
            catch (FormatException ex)
            {
                Logger.Log.DebugFormat("Date reading format exception: {0}", ex);
            }
            catch (Exception exAll)
            {
                Logger.Log.ErrorFormat("Date reading exception: {0}", exAll);
            }
        }
        public void Convert(FB2File fb2File, IBookInformationData titleInformation)
        {
            if (fb2File.PublishInfo.BookTitle != null)
            {
                var bookTitle = new Title
                {
                    TitleName =
                        Rus2Lat.Instance.Translate(fb2File.PublishInfo.BookTitle.Text, _conversionSettings.TransliterationSettings),
                    Language =
                        !string.IsNullOrEmpty(fb2File.PublishInfo.BookTitle.Language)
                            ? fb2File.PublishInfo.BookTitle.Language
                            : fb2File.TitleInfo.Language
                };
                if (!SourceDataInclusionControl.Instance.IsIgnoreInfoSource(SourceDataInclusionControl.DataTypes.Publish, _conversionSettings.IgnoreTitle))
                {
                    bookTitle.TitleType = TitleType.PublishInfo;
                    titleInformation.BookTitles.Add(bookTitle);
                }
            }


            if (fb2File.PublishInfo.ISBN != null)
            {
                var bookId = new Identifier
                {
                    IdentifierName = "BookISBN",
                    ID = fb2File.PublishInfo.ISBN.Text,
                    Scheme = "ISBN"
                };
               titleInformation.Identifiers.Add(bookId);
            }

            titleInformation.Publisher = new Publisher();
            if (fb2File.PublishInfo.Publisher != null)
            {
               titleInformation.Publisher.PublisherName = Rus2Lat.Instance.Translate(fb2File.PublishInfo.Publisher.Text, _conversionSettings.TransliterationSettings);
            }


            try
            {
                if (fb2File.PublishInfo.Year.HasValue)
                {
                    var date = new DateTime(fb2File.PublishInfo.Year.Value, 1, 1);
                    titleInformation.DatePublished = date;
                }
            }
            catch (FormatException ex)
            {
                Logger.Log.DebugFormat("Date reading format exception: {0}", ex);
            }
            catch (Exception exAll)
            {
                Logger.Log.ErrorFormat("Date reading exception: {0}", exAll);
            }
        }   
        public void Convert(FB2File fb2File, IBookInformationData titleInformation)
        {
            if (fb2File.PublishInfo.BookTitle != null)
            {
                var bookTitle = new Title
                {
                    TitleName =
                        Rus2Lat.Instance.Translate(fb2File.PublishInfo.BookTitle.Text, _conversionSettings.TransliterationSettings),
                    Language =
                        !string.IsNullOrEmpty(fb2File.PublishInfo.BookTitle.Language)
                            ? fb2File.PublishInfo.BookTitle.Language
                            : fb2File.TitleInfo.Language
                };
                if (!SourceDataInclusionControl.Instance.IsIgnoreInfoSource(SourceDataInclusionControl.DataTypes.Publish, _conversionSettings.IgnoreTitle))
                {
                    bookTitle.TitleType = TitleType.PublishInfo;
                    titleInformation.BookTitles.Add(bookTitle);
                }
            }


            if (fb2File.PublishInfo.ISBN != null)
            {
                var bookId = new Identifier
                {
                    IdentifierName = "BookISBN",
                    ID             = fb2File.PublishInfo.ISBN.Text,
                    Scheme         = "ISBN"
                };
                titleInformation.Identifiers.Add(bookId);
            }

            titleInformation.Publisher = new Publisher();
            if (fb2File.PublishInfo.Publisher != null)
            {
                titleInformation.Publisher.PublisherName = Rus2Lat.Instance.Translate(fb2File.PublishInfo.Publisher.Text, _conversionSettings.TransliterationSettings);
            }


            try
            {
                if (fb2File.PublishInfo.Year.HasValue)
                {
                    var date = new DateTime(fb2File.PublishInfo.Year.Value, 1, 1);
                    titleInformation.DatePublished = date;
                }
            }
            catch (FormatException ex)
            {
                Logger.Log.DebugFormat("Date reading format exception: {0}", ex);
            }
            catch (Exception exAll)
            {
                Logger.Log.ErrorFormat("Date reading exception: {0}", exAll);
            }
        }
Beispiel #10
0
        public TitlePageFileV2(IBookInformationData titleInformation)
        {
            Authors.AddRange(titleInformation.Authors);
            Series.AddRange(titleInformation.Series);
            BookTitle = titleInformation.BookMainTitle;

            InternalPageTitle    = "Title";
            GuideRole            = GuideTypeEnum.TitlePage;
            FileName             = "title.xhtml";
            FileEPubInternalPath = EPubInternalPath.GetDefaultLocation(DefaultLocations.DefaultTextFolder);
            Id = "title";
        }
Beispiel #11
0
        public TitlePageFileV3(IBookInformationData titleInformation)
        {
            Authors.AddRange(titleInformation.Authors);
            Series.AddRange(titleInformation.Series);
            BookTitle = titleInformation.BookMainTitle;

            InternalPageTitle = "Title";
            GuideRole = GuideTypeEnum.TitlePage;
            FileName = "title.xhtml";
            FileEPubInternalPath = EPubInternalPath.GetDefaultLocation(DefaultLocations.DefaultTextFolder);
            Id = "title";
        }
 public void Convert(FB2File fb2File, IBookInformationData titleInformation)
 {
     // Getting information from FB2 document section
     var bookId = new Identifier
     {
         ID =
             !string.IsNullOrEmpty(fb2File.DocumentInfo.ID) ? fb2File.DocumentInfo.ID : Guid.NewGuid().ToString(),
         IdentifierName = "FB2BookID",
         Scheme = "URI"
     };
     titleInformation.Identifiers.Add(bookId);
 }
        private void PassHeaderDataFromFb2ToEpub(FB2File fb2File, IBookInformationData titleInformation)
        {
            Logger.Log.Debug("Passing header data from FB2 to EPUB");

            if (fb2File.MainBody == null)
            {
                throw new NullReferenceException("MainBody section of the file passed is null");
            }
            var headerDataConverter = new HeaderDataConverterV3(Settings.ConversionSettings, Settings.V3Settings);

            headerDataConverter.Convert(fb2File, titleInformation);
        }
 public static void Convert(ItemTitleInfo titleInfo, IBookInformationData titleInformation, IEPubConversionSettings settings)
 {
     foreach (var genre in titleInfo.Genres)
     {
         var item = new Subject
         {
             SubjectInfo = Rus2Lat.Instance.Translate(DescriptionConverters.Fb2GenreToDescription(genre.Genre),
                                                      settings.TransliterationSettings)
         };
         titleInformation.Subjects.Add(item);
     }
 }
 public static void Convert(ItemTitleInfo titleInfo, IBookInformationData titleInformation,IEPubConversionSettings settings)
 {
     foreach (var genre in titleInfo.Genres)
     {
         var item = new Subject
         {
             SubjectInfo = Rus2Lat.Instance.Translate(DescriptionConverters.Fb2GenreToDescription(genre.Genre),
                 settings.TransliterationSettings)
         };
         titleInformation.Subjects.Add(item);
     }
 }
Beispiel #16
0
        public void Convert(FB2File fb2File, IBookInformationData titleInformation)
        {
            // Getting information from FB2 document section
            var bookId = new Identifier
            {
                ID =
                    !string.IsNullOrEmpty(fb2File.DocumentInfo.ID) ? fb2File.DocumentInfo.ID : Guid.NewGuid().ToString(),
                IdentifierName = "FB2BookID",
                Scheme         = "URI"
            };

            titleInformation.Identifiers.Add(bookId);
        }
 public static void Convert(ItemTitleInfo itemInfo, IBookInformationData titleInformation)
 {
     foreach (var seq in itemInfo.Sequences)
     {
         List <string> allSequences = DescriptionConverters.GetSequencesAsStrings(seq);
         if (allSequences.Count != 0)
         {
             foreach (var sequence in allSequences)
             {
                 titleInformation.Series.Add(sequence);
                 titleInformation.AllSequences.Add(sequence);
             }
         }
     }
 }
 public static void Convert(ItemTitleInfo titleInfo, IBookInformationData titleInformation, IEPubConversionSettings settings)
 {
     foreach (var translator in titleInfo.Translators)
     {
         var person = new PersoneWithRole
         {
             PersonName = Rus2Lat.Instance.Translate(DescriptionConverters.GenerateAuthorString(translator, settings),
                                                     settings.TransliterationSettings),
             FileAs   = DescriptionConverters.GenerateFileAsString(translator, settings),
             Role     = RolesEnum.Translator,
             Language = titleInfo.Language
         };
         titleInformation.Contributors.Add(person);
     }
 }
 public static void Convert(ItemTitleInfo titleInfo, IBookInformationData titleInformation, IEPubConversionSettings settings)
 {
     foreach (var translator in titleInfo.Translators)
     {
         var person = new PersoneWithRole
         {
             PersonName = Rus2Lat.Instance.Translate(DescriptionConverters.GenerateAuthorString(translator, settings),
                 settings.TransliterationSettings),
             FileAs = DescriptionConverters.GenerateFileAsString(translator, settings),
             Role = RolesEnum.Translator,
             Language = titleInfo.Language
         };
         titleInformation.Contributors.Add(person);
     }
 }
 private void ConvertMainTitle(ItemTitleInfo titleInfo, IBookInformationData titleInformation)
 {
     var bookTitle = new Title
     {
         TitleName = Rus2Lat.Instance.Translate(DescriptionConverters.FormatBookTitle(titleInfo, _conversionSettings),
             _conversionSettings.TransliterationSettings),
         Language = string.IsNullOrEmpty(titleInfo.BookTitle.Language)
             ? titleInfo.Language
             : titleInfo.BookTitle.Language,
         TitleType = TitleType.Main
     };
     titleInformation.BookTitles.Add(bookTitle);
     // add main title language
     titleInformation.Languages.Add(titleInfo.Language);
 }
 public static void Convert(ItemTitleInfo itemInfo, IBookInformationData titleInformation)
 {
     foreach (var seq in itemInfo.Sequences)
     {
         List<string> allSequences = DescriptionConverters.GetSequencesAsStrings(seq);
         if (allSequences.Count != 0)
         {
             foreach (var sequence in allSequences)
             {
                 titleInformation.Series.Add(sequence);
                 titleInformation.AllSequences.Add(sequence);
             }
         }
     }
 }
        private void ConvertMainTitle(ItemTitleInfo titleInfo, IBookInformationData titleInformation)
        {
            var bookTitle = new Title
            {
                TitleName = Rus2Lat.Instance.Translate(DescriptionConverters.FormatBookTitle(titleInfo, _conversionSettings),
                                                       _conversionSettings.TransliterationSettings),
                Language = string.IsNullOrEmpty(titleInfo.BookTitle.Language)
                    ? titleInfo.Language
                    : titleInfo.BookTitle.Language,
                TitleType = TitleType.Main
            };

            titleInformation.BookTitles.Add(bookTitle);
            // add main title language
            titleInformation.Languages.Add(titleInfo.Language);
        }
        public static void Convert(ItemTitleInfo titleInfo, IEPubConversionSettings settings, IBookInformationData titleInformation)
        {
            foreach (var author in titleInfo.BookAuthors)
            {
                var person = new PersoneWithRole();
                string authorString = DescriptionConverters.GenerateAuthorString(author, settings);
                person.PersonName = Rus2Lat.Instance.Translate(authorString, settings.TransliterationSettings);
                person.FileAs = DescriptionConverters.GenerateFileAsString(author, settings);
                person.Role = RolesEnum.Author;
                person.Language = titleInfo.Language;
                titleInformation.Creators.Add(person);

                // add authors to Title page
                titleInformation.Authors.Add(authorString);
            }
        }
        private void PassHeaderDataFromFb2ToEpub(FB2File fb2File,IBookInformationData titleInformation)
        {
            Logger.Log.Debug("Passing header data from FB2 to EPUB");

            if (fb2File.MainBody == null)
            {
                throw new NullReferenceException("MainBody section of the file passed is null");
            }
            var headerDataConverter = new HeaderDataConverterV3(Settings.ConversionSettings,Settings.V3Settings);
            headerDataConverter.Convert(fb2File, titleInformation);
        }
        private void PassPublisherInfoFromFB2(FB2File fb2File, IBookInformationData titleInformation, IEPubConversionSettings settings)
        {
            if (fb2File.PublishInfo.BookTitle != null)
            {
                var bookTitle = new Title
                {
                    TitleName =
                        Rus2Lat.Instance.Translate(fb2File.PublishInfo.BookTitle.Text, settings.TransliterationSettings),
                    Language =
                        !string.IsNullOrEmpty(fb2File.PublishInfo.BookTitle.Language)
                            ? fb2File.PublishInfo.BookTitle.Language
                            : fb2File.TitleInfo.Language
                };
                if ((Settings.ConversionSettings.IgnoreTitle != IgnoreInfoSourceOptions.IgnorePublishTitle) && (Settings.ConversionSettings.IgnoreTitle != IgnoreInfoSourceOptions.IgnoreMainAndPublish) &&
                    Settings.ConversionSettings.IgnoreTitle != IgnoreInfoSourceOptions.IgnoreSourceAndPublish)
                {
                    bookTitle.TitleType = TitleType.PublishInfo;
                    titleInformation.BookTitles.Add(bookTitle);
                }
            }


            if (fb2File.PublishInfo.ISBN != null)
            {
                var bookId = new Identifier
                {
                    IdentifierName = "BookISBN",
                    ID = fb2File.PublishInfo.ISBN.Text,
                    Scheme = "ISBN"
                };
                titleInformation.Identifiers.Add(bookId);
            }


            if (fb2File.PublishInfo.Publisher != null)
            {
                titleInformation.Publisher.PublisherName = Rus2Lat.Instance.Translate(fb2File.PublishInfo.Publisher.Text, settings.TransliterationSettings);
            }


            try
            {
                if (fb2File.PublishInfo.Year.HasValue)
                {
                    var date = new DateTime(fb2File.PublishInfo.Year.Value, 1, 1);
                    titleInformation.DatePublished = date;
                }
            }
            catch (FormatException ex)
            {
                Logger.Log.DebugFormat("Date reading format exception: {0}", ex);
            }
            catch (Exception exAll)
            {
                Logger.Log.ErrorFormat("Date reading exception: {0}", exAll);
            }
        }
 public void Convert(FB2File fb2File, IBookInformationData titleInformation)
 {
     foreach (var seq in fb2File.TitleInfo.Sequences)
     {
         if (!string.IsNullOrEmpty(seq.Name))
         {
             var collectionMember = new SeriesCollectionMember
             {
                 CollectionName = seq.Name,
                 Type = CollectionType.Series,
                 CollectionPosition = seq.Number
             };
             titleInformation.SeriesCollection.AddCollectionMember(collectionMember);
             foreach (var subseq in seq.SubSections.Where(subseq => !string.IsNullOrEmpty(subseq.Name)))
             {
                 collectionMember = new SeriesCollectionMember
                 {
                     CollectionName = subseq.Name,
                     Type = CollectionType.Set,
                     CollectionPosition = subseq.Number
                 };
                 titleInformation.SeriesCollection.AddCollectionMember(collectionMember);
             }
         }
     }
     foreach (var seq in fb2File.SourceTitleInfo.Sequences)
     {
         if (!string.IsNullOrEmpty(seq.Name))
         {
             var collectionMember = new SeriesCollectionMember
             {
                 CollectionName = seq.Name,
                 Type = CollectionType.Series,
                 CollectionPosition = seq.Number
             };
             titleInformation.SeriesCollection.AddCollectionMember(collectionMember);
             foreach (var subseq in seq.SubSections.Where(subseq => !string.IsNullOrEmpty(subseq.Name)))
             {
                 collectionMember = new SeriesCollectionMember
                 {
                     CollectionName = subseq.Name,
                     Type = CollectionType.Set,
                     CollectionPosition = subseq.Number
                 };
                 titleInformation.SeriesCollection.AddCollectionMember(collectionMember);
             }
         }
     }
     foreach (var seq in fb2File.PublishInfo.Sequences)
     {
         if (!string.IsNullOrEmpty(seq.Name))
         {
             var collectionMember = new SeriesCollectionMember
             {
                 CollectionName = seq.Name,
                 Type = CollectionType.Series,
                 CollectionPosition = seq.Number
             };
             titleInformation.SeriesCollection.AddCollectionMember(collectionMember);
             foreach (var subseq in seq.SubSections.Where(subseq => !string.IsNullOrEmpty(subseq.Name)))
             {
                 collectionMember = new SeriesCollectionMember
                 {
                     CollectionName = subseq.Name,
                     Type = CollectionType.Set,
                     CollectionPosition = subseq.Number
                 };
                 titleInformation.SeriesCollection.AddCollectionMember(collectionMember);
             }
         }
     }
 }
        public static void Convert(ItemTitleInfo titleInfo, IEPubConversionSettings settings, IBookInformationData titleInformation)
        {
            foreach (var author in titleInfo.BookAuthors)
            {
                var    person       = new PersoneWithRole();
                string authorString = DescriptionConverters.GenerateAuthorString(author, settings);
                person.PersonName = Rus2Lat.Instance.Translate(authorString, settings.TransliterationSettings);
                person.FileAs     = DescriptionConverters.GenerateFileAsString(author, settings);
                person.Role       = RolesEnum.Author;
                person.Language   = titleInfo.Language;
                titleInformation.Creators.Add(person);

                // add authors to Title page
                titleInformation.Authors.Add(authorString);
            }
        }
        public void Convert(FB2File fb2File, IBookInformationData titleInformation)
        {
            if ((fb2File.DocumentInfo.SourceOCR != null) && !string.IsNullOrEmpty(fb2File.DocumentInfo.SourceOCR.Text))
            {
                titleInformation.Source = new Source {
                    SourceData = fb2File.DocumentInfo.SourceOCR.Text
                };
            }

            foreach (var docAuthor in fb2File.DocumentInfo.DocumentAuthors)
            {
                var person = new PersoneWithRole
                {
                    PersonName =
                        Rus2Lat.Instance.Translate(DescriptionConverters.GenerateAuthorString(docAuthor, _conversionSettings), _conversionSettings.TransliterationSettings),
                    FileAs = DescriptionConverters.GenerateFileAsString(docAuthor, _conversionSettings),
                    Role   = RolesEnum.Adapter
                };
                if (fb2File.TitleInfo != null)
                {
                    person.Language = fb2File.TitleInfo.Language;
                }
                titleInformation.Contributors.Add(person);
            }

            // Getting information from FB2 Source Title Info section
            if (!SourceDataInclusionControl.Instance.IsIgnoreInfoSource(SourceDataInclusionControl.DataTypes.Source, _conversionSettings.IgnoreTitle) &&
                (fb2File.SourceTitleInfo.BookTitle != null) &&
                !string.IsNullOrEmpty(fb2File.SourceTitleInfo.BookTitle.Text))
            {
                var bookTitle = new Title
                {
                    TitleName =
                        Rus2Lat.Instance.Translate(fb2File.SourceTitleInfo.BookTitle.Text,
                                                   _conversionSettings.TransliterationSettings),
                    Language =
                        string.IsNullOrEmpty(fb2File.SourceTitleInfo.BookTitle.Language) &&
                        (fb2File.TitleInfo != null)
                                ? fb2File.TitleInfo.Language
                                : fb2File.SourceTitleInfo.BookTitle.Language,
                    TitleType = TitleType.SourceInfo
                };
                titleInformation.BookTitles.Add(bookTitle);
                titleInformation.Languages.Add(fb2File.SourceTitleInfo.Language);
            }

            // add authors
            foreach (var author in fb2File.SourceTitleInfo.BookAuthors)
            {
                var person = new PersoneWithRole
                {
                    PersonName =
                        Rus2Lat.Instance.Translate(DescriptionConverters.GenerateAuthorString(author, _conversionSettings),
                                                   _conversionSettings.TransliterationSettings),
                    FileAs   = DescriptionConverters.GenerateFileAsString(author, _conversionSettings),
                    Role     = RolesEnum.Author,
                    Language = fb2File.SourceTitleInfo.Language
                };
                titleInformation.Creators.Add(person);
            }

            TranslatorsInfoConverterV2.Convert(fb2File.SourceTitleInfo, titleInformation, _conversionSettings);
            GenresInfoConverterV2.Convert(fb2File.SourceTitleInfo, titleInformation, _conversionSettings);
        }
 public void Convert(FB2File fb2File, IBookInformationData titleInformation)
 {
 }
 public void Convert(FB2File fb2File, IBookInformationData titleInformation)
 {
     foreach (var seq in fb2File.TitleInfo.Sequences)
     {
         if (!string.IsNullOrEmpty(seq.Name))
         {
             var collectionMember = new SeriesCollectionMember
             {
                 CollectionName     = seq.Name,
                 Type               = CollectionType.Series,
                 CollectionPosition = seq.Number
             };
             titleInformation.SeriesCollection.AddCollectionMember(collectionMember);
             foreach (var subseq in seq.SubSections.Where(subseq => !string.IsNullOrEmpty(subseq.Name)))
             {
                 collectionMember = new SeriesCollectionMember
                 {
                     CollectionName     = subseq.Name,
                     Type               = CollectionType.Set,
                     CollectionPosition = subseq.Number
                 };
                 titleInformation.SeriesCollection.AddCollectionMember(collectionMember);
             }
         }
     }
     foreach (var seq in fb2File.SourceTitleInfo.Sequences)
     {
         if (!string.IsNullOrEmpty(seq.Name))
         {
             var collectionMember = new SeriesCollectionMember
             {
                 CollectionName     = seq.Name,
                 Type               = CollectionType.Series,
                 CollectionPosition = seq.Number
             };
             titleInformation.SeriesCollection.AddCollectionMember(collectionMember);
             foreach (var subseq in seq.SubSections.Where(subseq => !string.IsNullOrEmpty(subseq.Name)))
             {
                 collectionMember = new SeriesCollectionMember
                 {
                     CollectionName     = subseq.Name,
                     Type               = CollectionType.Set,
                     CollectionPosition = subseq.Number
                 };
                 titleInformation.SeriesCollection.AddCollectionMember(collectionMember);
             }
         }
     }
     foreach (var seq in fb2File.PublishInfo.Sequences)
     {
         if (!string.IsNullOrEmpty(seq.Name))
         {
             var collectionMember = new SeriesCollectionMember
             {
                 CollectionName     = seq.Name,
                 Type               = CollectionType.Series,
                 CollectionPosition = seq.Number
             };
             titleInformation.SeriesCollection.AddCollectionMember(collectionMember);
             foreach (var subseq in seq.SubSections.Where(subseq => !string.IsNullOrEmpty(subseq.Name)))
             {
                 collectionMember = new SeriesCollectionMember
                 {
                     CollectionName     = subseq.Name,
                     Type               = CollectionType.Set,
                     CollectionPosition = subseq.Number
                 };
                 titleInformation.SeriesCollection.AddCollectionMember(collectionMember);
             }
         }
     }
 }
Beispiel #31
0
        public void Convert(FB2File fb2File, IBookInformationData titleInformation)
        {
            if ((fb2File.DocumentInfo.SourceOCR != null) && !string.IsNullOrEmpty(fb2File.DocumentInfo.SourceOCR.Text))
            {
                titleInformation.Source = new Source { SourceData = fb2File.DocumentInfo.SourceOCR.Text };
            }

            foreach (var docAuthor in fb2File.DocumentInfo.DocumentAuthors)
            {
                var person = new PersoneWithRole
                {
                    PersonName =
                        Rus2Lat.Instance.Translate(DescriptionConverters.GenerateAuthorString(docAuthor, _conversionSettings), _conversionSettings.TransliterationSettings),
                    FileAs = DescriptionConverters.GenerateFileAsString(docAuthor, _conversionSettings),
                    Role = RolesEnum.Adapter
                };
                if (fb2File.TitleInfo != null)
                {
                    person.Language = fb2File.TitleInfo.Language;
                }
                titleInformation.Contributors.Add(person);
            }

            // Getting information from FB2 Source Title Info section
            if (!SourceDataInclusionControl.Instance.IsIgnoreInfoSource(SourceDataInclusionControl.DataTypes.Source, _conversionSettings.IgnoreTitle) &&
                (fb2File.SourceTitleInfo.BookTitle != null) && 
                !string.IsNullOrEmpty(fb2File.SourceTitleInfo.BookTitle.Text))
            {
                var bookTitle = new Title
                {
                    TitleName =
                        Rus2Lat.Instance.Translate(fb2File.SourceTitleInfo.BookTitle.Text,
                            _conversionSettings.TransliterationSettings),
                    Language =
                        string.IsNullOrEmpty(fb2File.SourceTitleInfo.BookTitle.Language) &&
                        (fb2File.TitleInfo != null)
                            ? fb2File.TitleInfo.Language
                            : fb2File.SourceTitleInfo.BookTitle.Language,
                    TitleType = TitleType.SourceInfo
                };
                titleInformation.BookTitles.Add(bookTitle);
                titleInformation.Languages.Add(fb2File.SourceTitleInfo.Language);
            }

            // add authors
            foreach (var author in fb2File.SourceTitleInfo.BookAuthors)
            {
                var person = new PersoneWithRole
                {
                    PersonName =
                        Rus2Lat.Instance.Translate(
                            string.Format("{0} {1} {2}", author.FirstName, author.MiddleName, author.LastName),
                            _conversionSettings.TransliterationSettings),
                    FileAs = DescriptionConverters.GenerateFileAsString(author, _conversionSettings),
                    Role = RolesEnum.Author,
                    Language = fb2File.SourceTitleInfo.Language
                };
                titleInformation.Creators.Add(person);
            }

            TranslatorsInfoConverterV3.Convert(fb2File.SourceTitleInfo, titleInformation, _conversionSettings);
            GenresInfoConverterV3.Convert(fb2File.SourceTitleInfo, titleInformation,_conversionSettings);
        }
 public void Convert(FB2File fb2File, IBookInformationData titleInformation)
 {
 }