Пример #1
0
        /// <summary>
        /// Generate Thumbnail
        /// </summary>
        /// <param name="mv"></param>
        /// <returns></returns>
        bool generateVideoThumbnail(DBTrackInfo mv)
        {
            lock (this)
            {
                string outputFilename = Path.Combine(Path.GetTempPath(), mv.Track + DateTime.Now.ToFileTimeUtc().ToString() + ".jpg");

                if (mvCentral.Utils.VideoThumbCreator.CreateVideoThumb(mv.LocalMedia[0].File.FullName, outputFilename))
                {
                    if (File.Exists(outputFilename))
                    {
                        mv.AddArtFromFile(outputFilename);
                        File.Delete(outputFilename);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
        }
Пример #2
0
        private void btnGrabFrame_Click(object sender, EventArgs e)
        {
            string artFolder = mvCentralCore.Settings.TrackArtFolder;
            string safeName  = mvs.Track.Replace(' ', '.').ToValidFilename();
            string filename1 = Path.GetTempPath() + "\\{" + safeName + "} [" + new Random().Next(0xFFFFFFF).ToString() + "].jpg";

            snapImage(filename1);
            bool i1;

            i1 = mvs.AddArtFromFile(filename1);
            File.Delete(filename1);
            if (i1 == true)
            {
                mvs.Commit();
            }
        }
Пример #3
0
        /// <summary>
        /// Get the Track Artwork using the old Method
        /// </summary>
        /// <param name="mv"></param>
        /// <returns></returns>
        private bool getOldTrackArt(DBTrackInfo mv)
        {
            logger.Debug("In Method getOldTrackArt(DBTrackInfo mv)");
            bool found = false;

            string        trackartFolderPath = mvCentralCore.Settings.TrackArtFolder;
            DirectoryInfo trackartFolder     = new DirectoryInfo(trackartFolderPath);

            string safeName      = mv.Track.Replace(' ', '.').ToValidFilename();
            Regex  oldtrackRegex = new Regex("^{?" + Regex.Escape(safeName) + "}? \\[-?\\d+\\]\\.(jpg|png)");

            foreach (FileInfo currFile in trackartFolder.GetFiles())
            {
                if (oldtrackRegex.IsMatch(currFile.Name))
                {
                    found &= mv.AddArtFromFile(currFile.FullName);
                }
            }

            return(found);
        }
Пример #4
0
        /// <summary>
        /// Generate Thumbnail
        /// </summary>
        /// <param name="mv"></param>
        /// <returns></returns>
        bool generateVideoThumbnail(DBTrackInfo mv)
        {
            lock (this)
              {
            string outputFilename = Path.Combine(Path.GetTempPath(), mv.Track + DateTime.Now.ToFileTimeUtc().ToString() + ".jpg");

            if (mvCentral.Utils.VideoThumbCreator.CreateVideoThumb(mv.LocalMedia[0].File.FullName, outputFilename))
            {
              if (File.Exists(outputFilename))
              {
            mv.AddArtFromFile(outputFilename);
            File.Delete(outputFilename);
            return true;
              }
              else
            return false;
            }
            else
              return false;
              }
        }
Пример #5
0
        /// <summary>
        /// Get the Track Artwork using the old Method
        /// </summary>
        /// <param name="mv"></param>
        /// <returns></returns>
        private bool getOldTrackArt(DBTrackInfo mv)
        {
            logger.Debug("In Method getOldTrackArt(DBTrackInfo mv)");
              bool found = false;

              string trackartFolderPath = mvCentralCore.Settings.TrackArtFolder;
              DirectoryInfo trackartFolder = new DirectoryInfo(trackartFolderPath);

              string safeName = mv.Track.Replace(' ', '.').ToValidFilename();
              Regex oldtrackRegex = new Regex("^{?" + Regex.Escape(safeName) + "}? \\[-?\\d+\\]\\.(jpg|png)");

              foreach (FileInfo currFile in trackartFolder.GetFiles())
              {
            if (oldtrackRegex.IsMatch(currFile.Name))
            {
              found &= mv.AddArtFromFile(currFile.FullName);
            }
              }

              return found;
        }