IsExported 是否已经导出过,如果没有导出或者导出不完整为 false
(exportType ExportType)
| 42 | |
| 43 | // IsExported 是否已经导出过,如果没有导出或者导出不完整为 false |
| 44 | func (f *FFMPEGInfo) IsExported(exportType ExportType) bool { |
| 45 | |
| 46 | bProcessDone := false |
| 47 | nowCacheFolder, err := f.GetCacheFolderFPath() |
| 48 | if err != nil { |
| 49 | f.log.Errorln("FFMPEGInfo.IsExported.GetCacheFolderFPath", f.VideoFullPath, err.Error()) |
| 50 | return false |
| 51 | } |
| 52 | tmpNowExportedMaskFile := filepath.Join(nowCacheFolder, exportedMakeFileName) |
| 53 | |
| 54 | defer func() { |
| 55 | // 函数执行完毕,再进行 check,是否需要删除 exportedMakeFileName 这个文件 |
| 56 | if bProcessDone == false { |
| 57 | // 失败就需要删除这个 exportedMakeFileName 文件 |
| 58 | if pkg.IsFile(tmpNowExportedMaskFile) == true { |
| 59 | _ = os.Remove(tmpNowExportedMaskFile) |
| 60 | } |
| 61 | } |
| 62 | }() |
| 63 | |
| 64 | // 首先存储的缓存目录要存在 |
| 65 | if pkg.IsDir(nowCacheFolder) == false { |
| 66 | return bProcessDone |
| 67 | } |
| 68 | |
| 69 | if pkg.IsFile(tmpNowExportedMaskFile) == false { |
| 70 | return bProcessDone |
| 71 | } |
| 72 | |
| 73 | switch exportType { |
| 74 | case Audio: |
| 75 | // 音频是否导出了 |
| 76 | done := f.isAudioExported(nowCacheFolder) |
| 77 | if done == false { |
| 78 | return bProcessDone |
| 79 | } |
| 80 | break |
| 81 | case Subtitle: |
| 82 | // 字幕都要导出了 |
| 83 | done := f.isSubExported(nowCacheFolder) |
| 84 | if done == false { |
| 85 | return bProcessDone |
| 86 | } |
| 87 | case SubtitleAndAudio: |
| 88 | // 音频是否导出了 |
| 89 | done := f.isAudioExported(nowCacheFolder) |
| 90 | if done == false { |
| 91 | return bProcessDone |
| 92 | } |
| 93 | // 字幕都要导出了 |
| 94 | done = f.isSubExported(nowCacheFolder) |
| 95 | if done == false { |
| 96 | return bProcessDone |
| 97 | } |
| 98 | default: |
| 99 | return bProcessDone |
| 100 | } |
| 101 |
no test coverage detected