示例#1
0
 protected void SetIsoType(Video video)
 {
     if (video.VideoType == VideoType.Iso)
     {
         if (video.Path.Contains("dvd", StringComparison.OrdinalIgnoreCase))
         {
             video.IsoType = IsoType.Dvd;
         }
         else if (video.Path.Contains("bluray", StringComparison.OrdinalIgnoreCase))
         {
             video.IsoType = IsoType.BluRay;
         }
         else
         {
             // use disc-utils, both DVDs and BDs use UDF filesystem
             using (var videoFileStream = File.Open(video.Path, FileMode.Open, FileAccess.Read))
                 using (UdfReader udfReader = new UdfReader(videoFileStream))
                 {
                     if (udfReader.DirectoryExists("VIDEO_TS"))
                     {
                         video.IsoType = IsoType.Dvd;
                     }
                     else if (udfReader.DirectoryExists("BDMV"))
                     {
                         video.IsoType = IsoType.BluRay;
                     }
                 }
         }
     }
 }
示例#2
0
 protected void SetIsoType(Video video)
 {
     if (video.VideoType == VideoType.Iso)
     {
         if (video.Path.Contains("dvd", StringComparison.OrdinalIgnoreCase))
         {
             video.IsoType = IsoType.Dvd;
         }
         else if (video.Path.Contains("bluray", StringComparison.OrdinalIgnoreCase))
         {
             video.IsoType = IsoType.BluRay;
         }
         else
         {
             try
             {
                 // use disc-utils, both DVDs and BDs use UDF filesystem
                 using (var videoFileStream = File.Open(video.Path, FileMode.Open, FileAccess.Read))
                     using (UdfReader udfReader = new UdfReader(videoFileStream))
                     {
                         if (udfReader.DirectoryExists("VIDEO_TS"))
                         {
                             video.IsoType = IsoType.Dvd;
                         }
                         else if (udfReader.DirectoryExists("BDMV"))
                         {
                             video.IsoType = IsoType.BluRay;
                         }
                     }
             }
             catch (Exception ex)
             {
                 _logger.LogError(ex, "Error opening UDF/ISO image: {Value}", video.Path ?? video.Name);
             }
         }
     }
 }