Esempio n. 1
0
        public static bool GetCoverartFromMovie(string fileName, string outputThumbName, Grabber.GrabUtil.ArtworkThumbMode CoverType, bool createIndividualShots, bool keepMainImage, int snapshotPosition)
        {
            if (fileName.Contains("VIDEO_TS\\VIDEO_TS.IFO") || !System.IO.File.Exists(fileName)) // Do not try to create thumbnails for DVDs or nonexisting media files
            return false;
              bool success = false;
              string ar = "";
              int columns = 2;
              int rows = 4;
              double arValue = 0;
              string Type = "Cover";

              var mediainfo = new MediaInfo();
              mediainfo.Open(fileName);
              ar = mediainfo.VideoAspectRatio ?? "";
              mediainfo.Close();

              try
              {
            arValue = Double.Parse(ar, System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
              }
              catch (Exception) { }

              switch (CoverType)
              {
            case Grabber.GrabUtil.ArtworkThumbMode.Cover:
              Type = "Cover";
              if (arValue < 1.4) // 4:3
              {
            columns = 2;
            rows = 4;
              }
              else if (arValue < 1.9) // 16:9
              {
            columns = 2;
            rows = 5;
              }
              else if (arValue >= 1.9) // cinemascope
              {
            columns = 2;
            rows = 6;
              }
              break;
            case Grabber.GrabUtil.ArtworkThumbMode.Fanart:
              Type = "Fanart";
              if (arValue < 1.4) // 4:3
              {
            columns = 4;
            rows = 3;
              }
              else if (arValue < 1.9) // 16:9
              {
            columns = 4;
            rows = 4;
              }
              else if (arValue >= 1.9) // cinemascope
              {
            columns = 3;
            rows = 4;
              }
              break;
            case Grabber.GrabUtil.ArtworkThumbMode.MovieThumbs:
              Type = "Fanart";
              columns = 4;
              rows = 4;
              break;

            default:
              break;
              }

              try
              {
            success = ThumbCreator.CreateVideoThumbForAmCupdater(fileName, outputThumbName, false, columns, rows, Type, createIndividualShots, keepMainImage, snapshotPosition);
              }
              catch (Exception)
              {
            //LogMyFilms.Error("Could not create thumbnail for {0}", MovieFile);
            //LogMyFilms.Error(ex);
              }
              return success;
        }
Esempio n. 2
0
 public static MediaInfo GetInstance()
 {
     if (_instance == null)
       {
     _instance = new MediaInfo();
     //_instance.Option("ParseSpeed", DBOption.GetOptions(DBOption.cMediaInfoParseSpeed));
     _instance.Option("ParseSpeed", "0.3"); // Default is 0.5 but we dont need that for TVSeries.
     return _instance;
       }
       else return _instance;
 }