@@ -18,22 +18,22 @@ public enum FfprobeMode { ShowFormat, ShowStreams, ShowBoth };
1818
1919 static Dictionary < QueryInfo , string > cmdCache = new Dictionary < QueryInfo , string > ( ) ;
2020
21- public static async Task < string > GetFfmpegInfoAsync ( string path , string lineFilter = "" )
21+ public static async Task < string > GetFfmpegInfoAsync ( string path , string lineFilter = "" , bool noCache = false )
2222 {
23- return await GetFfmpegOutputAsync ( path , "" , lineFilter ) ;
23+ return await GetFfmpegOutputAsync ( path , "" , lineFilter , noCache ) ;
2424 }
2525
26- public static async Task < string > GetFfmpegOutputAsync ( string path , string args , string lineFilter = "" )
26+ public static async Task < string > GetFfmpegOutputAsync ( string path , string args , string lineFilter = "" , bool noCache = false )
2727 {
28- return await GetFfmpegOutputAsync ( path , "" , args , lineFilter ) ;
28+ return await GetFfmpegOutputAsync ( path , "" , args , lineFilter , noCache ) ;
2929 }
3030
31- public static async Task < string > GetFfmpegOutputAsync ( string path , string argsIn , string argsOut , string lineFilter = "" )
31+ public static async Task < string > GetFfmpegOutputAsync ( string path , string argsIn , string argsOut , string lineFilter = "" , bool noCache = false )
3232 {
3333 Process process = OsUtils . NewProcess ( true ) ;
3434 process . StartInfo . Arguments = $ "/C cd /D { Paths . GetBinPath ( ) . Wrap ( ) } & " +
3535 $ "ffmpeg.exe -hide_banner -y { argsIn } { path . GetConcStr ( ) } -i { path . Wrap ( ) } { argsOut } ";
36- return await GetInfoAsync ( path , process , lineFilter ) ;
36+ return await GetInfoAsync ( path , process , lineFilter , noCache ) ;
3737 }
3838
3939 public static async Task < string > GetFfprobeInfoAsync ( string path , FfprobeMode mode , string lineFilter = "" , int streamIndex = - 1 , bool stripKeyName = true )
@@ -50,19 +50,19 @@ public static async Task<string> GetFfprobeInfoAsync(string path, FfprobeMode mo
5050 return output ;
5151 }
5252
53- static async Task < string > GetInfoAsync ( string path , Process process , string lineFilter ) // for ffmpeg
53+ static async Task < string > GetInfoAsync ( string path , Process process , string lineFilter , bool noCache = false ) // for ffmpeg
5454 {
55- string output = await GetOutputCached ( path , process ) ;
55+ string output = await GetOutputCached ( path , process , noCache ) ;
5656
5757 if ( ! string . IsNullOrWhiteSpace ( lineFilter . Trim ( ) ) )
5858 output = string . Join ( "\n " , output . SplitIntoLines ( ) . Where ( x => x . Contains ( lineFilter ) ) . ToArray ( ) ) ;
5959
6060 return output ;
6161 }
6262
63- static async Task < string > GetInfoAsync ( string path , Process process , string lineFilter , int streamIndex = - 1 , bool stripKeyName = true ) // for ffprobe
63+ static async Task < string > GetInfoAsync ( string path , Process process , string lineFilter , int streamIndex = - 1 , bool stripKeyName = true , bool noCache = false ) // for ffprobe
6464 {
65- string output = await GetOutputCached ( path , process ) ;
65+ string output = await GetOutputCached ( path , process , noCache ) ;
6666
6767 try
6868 {
@@ -92,12 +92,12 @@ public static async Task<string> GetFfprobeInfoAsync(string path, FfprobeMode mo
9292 return output ;
9393 }
9494
95- static async Task < string > GetOutputCached ( string path , Process process )
95+ static async Task < string > GetOutputCached ( string path , Process process , bool noCache = false )
9696 {
9797 long filesize = IoUtils . GetFilesize ( path ) ;
9898 QueryInfo hash = new QueryInfo ( path , filesize , process . StartInfo . Arguments ) ;
9999
100- if ( filesize > 0 && CacheContains ( hash , ref cmdCache ) )
100+ if ( ! noCache && filesize > 0 && CacheContains ( hash , ref cmdCache ) )
101101 {
102102 Logger . Log ( $ "GetVideoInfo: '{ process . StartInfo . FileName } { process . StartInfo . Arguments } ' cached, won't re-run.", true , false , "ffmpeg" ) ;
103103 return GetFromCache ( hash , ref cmdCache ) ;
0 commit comments