public bool Step1_GetMetadata() { //Get metadata from the file over http if (File.Exists(jsonDownloadState)) { try { nfsPersister = new NetworkFileStreamPersister(jsonDownloadState); //If More thaan ~1 hour has elapsed since getting the download url, it will expire. //The new url will be to the same file. nfsPersister.NetworkFileStream.SetUriForSameFile(new Uri(downloadLicense.DownloadUrl)); } catch { FileExt.SafeDelete(jsonDownloadState); FileExt.SafeDelete(tempFile); nfsPersister = NewNetworkFilePersister(); } } else { nfsPersister = NewNetworkFilePersister(); } nfsPersister.NetworkFileStream.BeginDownloading(); aaxFile = new AaxFile(nfsPersister.NetworkFileStream); coverArt = aaxFile.AppleTags.Cover; RetrievedTags?.Invoke(this, aaxFile.AppleTags); RetrievedCoverArt?.Invoke(this, coverArt); return(!isCanceled); }
private bool Step_DownloadAudiobookAsSingleFile() { var zeroProgress = Step_DownloadAudiobook_Start(); FileUtility.SaferDelete(OutputFileName); var outputFile = File.Open(OutputFileName, FileMode.OpenOrCreate, FileAccess.ReadWrite); AaxFile.ConversionProgressUpdate += AaxFile_ConversionProgressUpdate; var decryptionResult = OutputFormat == OutputFormat.M4b ? AaxFile.ConvertToMp4a(outputFile, DownloadLicense.ChapterInfo) : AaxFile.ConvertToMp3(outputFile); AaxFile.ConversionProgressUpdate -= AaxFile_ConversionProgressUpdate; DownloadLicense.ChapterInfo = AaxFile.Chapters; Step_DownloadAudiobook_End(zeroProgress); var success = decryptionResult == ConversionResult.NoErrorsDetected && !IsCanceled; if (success) { base.OnFileCreated(OutputFileName); } return(success); }
private void ConvertToMultiMp4a(ChapterInfo splitChapters) { var chapterCount = 0; AaxFile.ConvertToMultiMp4a(splitChapters, newSplitCallback => createOutputFileStream(++chapterCount, splitChapters, newSplitCallback) ); }
private void ConvertToMultiMp3(ChapterInfo splitChapters) { var chapterCount = 0; AaxFile.ConvertToMultiMp3(splitChapters, newSplitCallback => { createOutputFileStream(++chapterCount, splitChapters, newSplitCallback); newSplitCallback.LameConfig.ID3.Track = chapterCount.ToString(); }); }
protected bool Step_GetMetadata() { AaxFile = new AaxFile(InputFileStream); OnRetrievedTitle(AaxFile.AppleTags.TitleSansUnabridged); OnRetrievedAuthors(AaxFile.AppleTags.FirstAuthor ?? "[unknown]"); OnRetrievedNarrators(AaxFile.AppleTags.Narrator ?? "[unknown]"); OnRetrievedCoverArt(AaxFile.AppleTags.Cover); return(!IsCanceled); }