123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- using System.IO.Enumeration;
- using FNZCM2.Abstractions.Utility;
- namespace FNZCM2.ProofOfConcept;
- using FSE = (bool isDir, string path, long size, DateTimeOffset lastWrited);
- internal static class PocFfMpegReader
- {
- public static void RunPoc()
- {
- //FlacPoc();
- //Mp4Poc();
- //JpgPoc();
- //WebPPoc();
- //LogPoc();
- //IsoPoc();
- //SUCCESS
- }
- private static void IsoPoc()
- {
- //choose a file to open
- var fse = new FileSystemEnumerable<FSE>(
- "library-fs",
- (ref FileSystemEntry p) => new(
- p.IsDirectory,
- p.ToFullPath(),
- p.Length,
- p.LastWriteTimeUtc
- ),
- new()
- {
- RecurseSubdirectories = true,
- })
- {
- ShouldIncludePredicate = (ref FileSystemEntry p) => p.ToFullPath().EndsWith(".iso", true, null)
- };
- var file = fse.First();
- var filePath = file.path;
- var meta = FfMpegReader.Read(filePath, out var err);
- if (meta == null && err != null)
- {
- int bp1 = 0;
- }
- int bp = 0;
- }
- private static void LogPoc()
- {
- //choose a file to open
- var fse = new FileSystemEnumerable<FSE>(
- "library-ajc",
- (ref FileSystemEntry p) => new(
- p.IsDirectory,
- p.ToFullPath(),
- p.Length,
- p.LastWriteTimeUtc
- ),
- new()
- {
- RecurseSubdirectories = true,
- })
- {
- ShouldIncludePredicate = (ref FileSystemEntry p) => p.ToFullPath().EndsWith(".log", true, null)
- };
- var file = fse.First();
- var filePath = file.path;
- var meta = FfMpegReader.Read(filePath, out var err);
- if (meta == null && err != null)
- {
- int bp1 = 0;
- }
- int bp = 0;
- }
- private static void WebPPoc()
- {
- //choose a file to open
- var fse = new FileSystemEnumerable<FSE>(
- "library-tlmc-tv",
- (ref FileSystemEntry p) => new(
- p.IsDirectory,
- p.ToFullPath(),
- p.Length,
- p.LastWriteTimeUtc
- ),
- new()
- {
- RecurseSubdirectories = true,
- })
- {
- ShouldIncludePredicate = (ref FileSystemEntry p) => p.ToFullPath().EndsWith(".webp", true, null)
- };
- var file = fse.First();
- var filePath = file.path;
- var meta = FfMpegReader.Read(filePath, out var err);
- int bp = 0;
- }
- private static void JpgPoc()
- {
- //choose a file to open
- var fse = new FileSystemEnumerable<FSE>(
- "library-ajc",
- (ref FileSystemEntry p) => new(
- p.IsDirectory,
- p.ToFullPath(),
- p.Length,
- p.LastWriteTimeUtc
- ),
- new()
- {
- RecurseSubdirectories = true,
- })
- {
- ShouldIncludePredicate = (ref FileSystemEntry p) => p.ToFullPath().EndsWith(".jpg", true, null)
- };
- var file = fse.First();
- var filePath = file.path;
- var meta = FfMpegReader.Read(filePath, out var err);
- int bp = 0;
- }
- private static void Mp4Poc()
- {
- //choose a file to open
- var fse = new FileSystemEnumerable<FSE>(
- "library-ajc",
- (ref FileSystemEntry p) => new(
- p.IsDirectory,
- p.ToFullPath(),
- p.Length,
- p.LastWriteTimeUtc
- ),
- new()
- {
- RecurseSubdirectories = true,
- })
- {
- ShouldIncludePredicate = (ref FileSystemEntry p) => p.ToFullPath().EndsWith(".mp4", true, null)
- };
- var file = fse.First();
- var filePath = file.path;
- var meta = FfMpegReader.Read(filePath, out var err);
- int bp = 0;
- }
- private static void FlacPoc()
- {
- //choose a file to open
- var fse = new FileSystemEnumerable<FSE>(
- "library-ajc",
- (ref FileSystemEntry p) => new(
- p.IsDirectory,
- p.ToFullPath(),
- p.Length,
- p.LastWriteTimeUtc
- ),
- new()
- {
- RecurseSubdirectories = true,
- })
- {
- ShouldIncludePredicate = (ref FileSystemEntry p) => p.ToFullPath().EndsWith(".flac", true, null)
- };
- var file = fse.First();
- var filePath = file.path;
- var meta = FfMpegReader.Read(filePath, out var err);
- int bp = 0;
- }
- }
|