Example #1
0
        public static string CreateNfoContents(string ripper, Tags tags, EncodingInfo encodingInfo, Chapters chapters)
        {
            int    _hours = (int)tags.duration.TotalHours;
            string myDuration
                = (_hours > 0 ? _hours + " hours, " : "")
                  + tags.duration.Minutes + " minutes, "
                  + tags.duration.Seconds + " seconds";

            string str4
                = "General Information\r\n"
                  + "===================\r\n"
                  + " Title:                  " + tags.title + "\r\n"
                  + " Author:                 " + tags.author + "\r\n"
                  + " Read By:                " + tags.narrator + "\r\n"
                  + " Copyright:              " + tags.year + "\r\n"
                  + " Audiobook Copyright:    " + tags.year + "\r\n";

            if (tags.genre != "")
            {
                str4 = str4 + " Genre:                  " + tags.genre + "\r\n";
            }

            string s
                = str4
                  + " Publisher:              " + tags.publisher + "\r\n"
                  + " Duration:               " + myDuration + "\r\n"
                  + " Chapters:               " + chapters.Count() + "\r\n"
                  + "\r\n"
                  + "\r\n"
                  + "Media Information\r\n"
                  + "=================\r\n"
                  + " Source Format:          Audible AAX\r\n"
                  + " Source Sample Rate:     " + encodingInfo.sampleRate + " Hz\r\n"
                  + " Source Channels:        " + encodingInfo.channels + "\r\n"
                  + " Source Bitrate:         " + encodingInfo.originalBitrate + " kbits\r\n"
                  + "\r\n"
                  + " Lossless Encode:        Yes\r\n"
                  + " Encoded Codec:          AAC / M4B\r\n"
                  + " Encoded Sample Rate:    " + encodingInfo.sampleRate + " Hz\r\n"
                  + " Encoded Channels:       " + encodingInfo.channels + "\r\n"
                  + " Encoded Bitrate:        " + encodingInfo.originalBitrate + " kbits\r\n"
                  + "\r\n"
                  + " Ripper:                 " + ripper + "\r\n"
                  + "\r\n"
                  + "\r\n"
                  + "Book Description\r\n"
                  + "================\r\n"
                  + tags.comments;

            return(s);
        }
 public bool Write(string filename)
 {
     if (Chapters is null || Chapters.Count == 0)
     {
         return(false);
     }
     Log(3, this, $"\"{filename.SubstitUser ()}\": #chapters={Chapters.Count ()}");
     using (var osm = new StreamWriter(filename)) {
         osm.WriteLine(FFMETADATA);
         foreach (var ch in Chapters)
         {
             Log(3, this, ch.ToString());
             osm.WriteLine(CHAPTER);
             osm.WriteLine($"{Tags[0]}=1/1000");
             osm.WriteLine($"{Tags[1]}={(int)ch.Time.Begin.TotalMilliseconds}");
             osm.WriteLine($"{Tags[2]}={(int)ch.Time.End.TotalMilliseconds}");
             osm.WriteLine($"{Tags[3]}={escape (ch.Name)}");
         }
     }
     return(true);
 }
Example #3
0
        private async Task PagesLoad()
        {
            if (isBusy)
            {
                return;
            }
            isBusy = true;

            // загружаем главы
            if (Chapters.Count() == 0)
            {
                _chapters = await Manga.ChaptersLoad();
            }

            // текущая глава
            Models.Chapter chapter = Chapters[Manga.CurrentChapter];

            // загружаем страницы
            _pages = await Chapters[Manga.CurrentChapter].PagesLoad();

            // сохраняем количество страниц
            Manga.PagesCount = _pages.Count;
            Helpers.Save.Mangas.SaveFirst(Manga);

            // добавляем страницу заглушку
            _pages.Add(new Models.Page()
            {
                number = Models.Page.NEXT_CHAPTER
            });

            isBusy = false;
            RaiseProperty("Pages");
            RaiseProperty("Manga");
            RaiseProperty("CurrentPage");
            System.Diagnostics.Debug.WriteLine("PagesLoad");
            CanISaveCurrentPage = true;
        }
        private void grdmain_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Left)
            {
                //check # of chapters in book
                //if last chapter get next book
                //back one chapter

                var prevChapter = (CurrentVerseSelection.curr.chapter - 1);
                if (prevChapter >= 1)
                {
                    GoTo(CurrentVerseSelection.curr.book, prevChapter, 1);
                }
                else
                {
                    var bookIndex = Books.FindIndex(x => x.abbrev == CurrentVerseSelection.curr.book) - 1;
                    if (bookIndex >= 0)
                    {
                        var prevBook = Books[bookIndex];
                        GoTo(prevBook.abbrev, 1, 1);
                    }
                }
            }
            if (e.Key == Key.Right)
            {
                var nextChapter = (CurrentVerseSelection.curr.chapter + 1);
                if (nextChapter <= Chapters.Count())
                {
                    GoTo(CurrentVerseSelection.curr.book, nextChapter, 1);
                }
                else
                {
                    var bookIndex = Books.FindIndex(x => x.abbrev == CurrentVerseSelection.curr.book) + 1;
                    if (bookIndex <= Books.Count())
                    {
                        var nextBook = Books[bookIndex];
                        GoTo(nextBook.abbrev, 1, 1);
                    }
                }
            }
            if (e.Key == Key.Up)
            {
                // back one verse
                if (CurrentVerseSelection.prev == null)
                {
                    return;
                }
                GoTo(CurrentVerseSelection.curr.book, CurrentVerseSelection.curr.chapter, CurrentVerseSelection.prev.verse);
                SelectedChapter = CurrentVerseSelection.curr.chapter;
                SelectedVerse   = CurrentVerseSelection.curr.verse;
            }
            if (e.Key == Key.Down)
            {
                if (CurrentVerseSelection.next == null)
                {
                    return;
                }
                GoTo(CurrentVerseSelection.curr.book, CurrentVerseSelection.curr.chapter, CurrentVerseSelection.next.verse);

                SelectedChapter = CurrentVerseSelection.curr.chapter;
                SelectedVerse   = CurrentVerseSelection.curr.verse;
            }
        }