コード例 #1
0
 private void miAddNewBackdrop_Click(object sender, EventArgs e)
 {
     if (openCoverFile.ShowDialog() == DialogResult.OK)
     {
         _dvdTitle.AddFanArtImage(openCoverFile.FileName);
         titleSource.ResetCurrentItem();
         LoadBackdrops();
     }
 }
コード例 #2
0
        private void DownloadingBackDropsFormFileDownloadedEvent(object sender, AsyncCompletedEventArgs c)
        {
            string img = (string)c.UserState;

            if (File.Exists(img))
            {
                title.AddFanArtImage(img);

                processed++;

                SetProgress(processed);
            }
            LoadImage();
        }
コード例 #3
0
 public void DownloadBackDropsForTitle(Title t, IList <string> urls)
 {
     foreach (string url in urls)
     {
         WebClient web      = new WebClient();
         string    filename = Path.Combine(FileSystemWalker.ImageDownloadDirectory, Guid.NewGuid().ToString());
         try
         {
             web.DownloadFile(url, filename);
             t.AddFanArtImage(filename);
         }
         catch (Exception e)
         {
             OMLApplication.DebugLine("[TheMovieDbBackDropDownloader] Error downloading backdrop file {0}: {1}",
                                      url, e.Message);
         }
     }
 }
コード例 #4
0
 public void DownloadBackDropsForTitle(Title t, IList<string> urls)
 {
     foreach (string url in urls)
     {
         WebClient web = new WebClient();
         string filename = Path.Combine(FileSystemWalker.ImageDownloadDirectory, Guid.NewGuid().ToString());
         try
         {
             web.DownloadFile(url, filename);
             t.AddFanArtImage(filename);
         }
         catch (Exception e)
         {
             OMLApplication.DebugLine("[TheMovieDbBackDropDownloader] Error downloading backdrop file {0}: {1}",
                 url, e.Message);
         }
     }
 }
コード例 #5
0
        public static Title ConvertOMLSDKTitleToTitle(OMLSDKTitle omlsdktitle)
        {
            Title _title = new Title();

            if (omlsdktitle != null)
            {
                _title.NameTrimmed = CopyString(omlsdktitle.Name);
                _title.OriginalNameTrimmed = CopyString(omlsdktitle.OriginalName);
                _title.SortNameTrimmed = CopyString(omlsdktitle.SortName);
                _title.Synopsis = CopyString(omlsdktitle.Synopsis);
                _title.ProductionYear = omlsdktitle.ProductionYear;
                _title.ReleaseDate = omlsdktitle.ReleaseDate;
                _title.DateAdded = omlsdktitle.DateAdded;
                _title.Runtime = omlsdktitle.Runtime;
                _title.StudioTrimmed = CopyString(omlsdktitle.Studio);
                _title.UPCTrimmed = CopyString(omlsdktitle.UPC);
                _title.WatchedCount = omlsdktitle.WatchedCount;
                _title.UserStarRating = omlsdktitle.UserStarRating;

                _title.EpisodeNumber = omlsdktitle.EpisodeNumber;
                _title.SeasonNumber = omlsdktitle.SeasonNumber;

                _title.AspectRatioTrimmed = CopyString(omlsdktitle.AspectRatio);
                _title.VideoDetails = CopyString(omlsdktitle.VideoDetails);
                _title.VideoResolutionTrimmed = CopyString(omlsdktitle.VideoResolution);
                _title.VideoStandardTrimmed = CopyString(omlsdktitle.VideoStandard);
                //_title.VideoFormat = (VideoFormat)Enum.Parse(typeof(VideoFormat), omlsdktitle.VideoFormat.ToString());

                _title.FrontCoverPath = CopyString(omlsdktitle.FrontCoverPath);
                _title.BackCoverPath = CopyString(omlsdktitle.BackCoverPath);

                _title.CountryOfOriginTrimmed = CopyString(omlsdktitle.CountryOfOrigin);

                _title.MetadataSourceIDTrimmed = CopyString(omlsdktitle.MetadataSourceID);
                _title.MetadataSourceNameTrimmed = CopyString(omlsdktitle.MetadataSourceName);
                _title.ImporterSourceTrimmed = CopyString(omlsdktitle.ImporterSource);

                _title.OfficialWebsiteURLTrimmed = CopyString(omlsdktitle.OfficialWebsiteURL);
                _title.ParentalRatingTrimmed = CopyString(omlsdktitle.ParentalRating);
                _title.ParentalRatingReasonTrimmed = CopyString(omlsdktitle.ParentalRatingReason);

                #region Disks
                foreach (OMLSDKDisk omlsdkdisk in omlsdktitle.Disks)
                {
                    Disk disk = new Disk();
                    disk.Name = omlsdkdisk.Name;
                    disk.Path = omlsdkdisk.Path;
                    disk.Format = (VideoFormat)Enum.Parse(typeof(VideoFormat), omlsdkdisk.Format.ToString());
                    disk.ExtraOptions = omlsdkdisk.ExtraOptions;
                    _title.AddDisk(disk);
                }
                #endregion

                #region Extra Features
                _title.ExtraFeatures = omlsdktitle.ExtraFeatures;
                #endregion

                #region Trailers
                foreach (string Trailer in omlsdktitle.Trailers)
                {
                    _title.AddTrailer(Trailer);
                }
                #endregion

                #region Genres
                if (omlsdktitle.Genres != null)
                {
                    foreach (string genre in omlsdktitle.Genres)
                    {
                        _title.AddGenre(genre);
                    }
                }
                #endregion

                #region Actring Roles
                if (omlsdktitle.ActingRoles != null)
                {
                    foreach (OMLSDKRole role in omlsdktitle.ActingRoles)
                    {
                        _title.AddActingRole(role.PersonName, role.RoleName);
                    }
                }
                #endregion

                #region Non Acting Roles
                if (omlsdktitle.NonActingRoles != null)
                {
                    foreach (OMLSDKRole role in omlsdktitle.NonActingRoles)
                    {
                        _title.AddNonActingRole(role.PersonName, role.RoleName);
                    }
                }
                #endregion

                #region Directors
                if (omlsdktitle.Directors != null)
                {
                    foreach (OMLSDKPerson person in omlsdktitle.Directors)
                    {
                        _title.AddDirector(ConvertOMLSDKPersonToPerson(person));
                    }
                }
                #endregion

                #region Writers
                if (omlsdktitle.Writers != null)
                {
                    foreach (OMLSDKPerson person in omlsdktitle.Writers)
                    {
                        _title.AddWriter(ConvertOMLSDKPersonToPerson(person));
                    }
                }
                #endregion

                #region Producers
                if (omlsdktitle.Producers != null)
                {
                    foreach (OMLSDKPerson person in omlsdktitle.Producers)
                    {
                        _title.AddProducer(ConvertOMLSDKPersonToPerson(person));
                    }
                }
                #endregion

                #region Tags
                if (omlsdktitle.Tags != null)
                {
                    foreach (string tag in omlsdktitle.Tags)
                    {
                        _title.AddTag(tag);
                    }
                }
                #endregion

                #region Audio Tracks
                if (omlsdktitle.AudioTracks != null)
                {
                    foreach (string track in omlsdktitle.AudioTracks)
                    {
                        _title.AddAudioTrack(track);
                    }
                }
                #endregion

                #region Subtitles
                if (omlsdktitle.Subtitles != null)
                {
                    foreach (string subtitles in omlsdktitle.Subtitles)
                    {
                        _title.AddSubtitle(subtitles);
                    }
                }
                #endregion

                #region Fanart Paths
                if (omlsdktitle.FanArtPaths != null)
                {
                    foreach (string path in omlsdktitle.FanArtPaths)
                    {
                        _title.AddFanArtImage(path);
                    }
                }
                #endregion
            }

            return _title;
        }
コード例 #6
0
        private void CheckDiskPathForImages(Title title, Disk disk)
        {
            if ((disk == null) || (string.IsNullOrEmpty(disk.Path)))
            {
                return;
            }

            string diskFolder               = disk.GetDiskFolder;
            string diskPathWithExtension    = null;
            string diskPathWithoutExtension = null;

            if (!string.IsNullOrEmpty(disk.GetDiskFile))
            {
                diskPathWithExtension    = disk.Path;
                diskPathWithoutExtension = disk.GetDiskFolder + "\\" + Path.GetFileNameWithoutExtension(disk.GetDiskFile);
            }

            string image = null;

            // If the Disk is a media file, look for an image in the disk
            // folder with the same name as the media file.
            if (!string.IsNullOrEmpty(diskPathWithExtension))
            {
                if (File.Exists(diskPathWithExtension + ".jpg"))
                {
                    image = diskPathWithExtension + ".jpg";
                }
                else if (File.Exists(diskPathWithExtension + ".png"))
                {
                    image = diskPathWithExtension + ".png";
                }
                else if (File.Exists(diskPathWithoutExtension + ".jpg"))
                {
                    image = diskPathWithoutExtension + ".jpg";
                }
                else if (File.Exists(diskPathWithoutExtension + ".png"))
                {
                    image = diskPathWithoutExtension + ".png";
                }
            }

            // Look for a generic folder.xxx image
            if (string.IsNullOrEmpty(image))
            {
                if (File.Exists(Path.Combine(diskFolder, "folder.jpg")))
                {
                    image = Path.Combine(diskFolder, "folder.jpg");
                }
                else if (File.Exists(Path.Combine(diskFolder, "folder.png")))
                {
                    image = Path.Combine(diskFolder, "folder.png");
                }
            }

            // Look for any jpg image
            if (string.IsNullOrEmpty(image))
            {
                string[] imagefiles = Directory.GetFiles(diskFolder, "*.jpg");
                if (imagefiles.Count() > 0)
                {
                    image = imagefiles[0];
                }
            }

            // Look for any jpg image
            if (string.IsNullOrEmpty(image))
            {
                string[] imagefiles = Directory.GetFiles(diskFolder, "*.png");
                if (imagefiles.Count() > 0)
                {
                    image = imagefiles[0];
                }
            }


            if (!string.IsNullOrEmpty(image))
            {
                title.FrontCoverPath = image;
            }

            // Check for fanart
            string fanartfolder = Path.Combine(diskFolder, "Fanart");

            if (Directory.Exists(fanartfolder))
            {
                foreach (string imagefile in Directory.GetFiles(fanartfolder))
                {
                    string extension = Path.GetExtension(imagefile);
                    if (!string.IsNullOrEmpty(extension))
                    {
                        if ((string.Compare(extension, ".jpg", true) == 0) ||
                            (string.Compare(extension, ".png", true) == 0) ||
                            (string.Compare(extension, ".bmp", true) == 0))
                        {
                            title.AddFanArtImage(imagefile);
                        }
                    }
                }
            }
        }
コード例 #7
0
        private void CheckDiskPathForImages(Title title, Disk disk)
        {
            if ((disk == null) || (string.IsNullOrEmpty(disk.Path))) return;

            string diskFolder = disk.GetDiskFolder;
            string diskPathWithExtension = null;
            string diskPathWithoutExtension = null;

            if (!string.IsNullOrEmpty(disk.GetDiskFile))
            {
                diskPathWithExtension = disk.Path;
                diskPathWithoutExtension = disk.GetDiskFolder + "\\" + Path.GetFileNameWithoutExtension(disk.GetDiskFile);
            }

            string image = null;

            // If the Disk is a media file, look for an image in the disk
            // folder with the same name as the media file.
            if (!string.IsNullOrEmpty(diskPathWithExtension))
            {
                if (File.Exists(diskPathWithExtension + ".jpg"))
                {
                    image = diskPathWithExtension + ".jpg";
                }
                else if (File.Exists(diskPathWithExtension + ".png"))
                {
                    image = diskPathWithExtension + ".png";
                }
                else if (File.Exists(diskPathWithoutExtension + ".jpg"))
                {
                    image = diskPathWithoutExtension + ".jpg";
                }
                else if (File.Exists(diskPathWithoutExtension + ".png"))
                {
                    image = diskPathWithoutExtension + ".png";
                }
            }

            // Look for a generic folder.xxx image
            if (string.IsNullOrEmpty(image))
            {
                if (File.Exists(Path.Combine(diskFolder, "folder.jpg")))
                {
                    image = Path.Combine(diskFolder, "folder.jpg");
                }
                else if (File.Exists(Path.Combine(diskFolder, "folder.png")))
                {
                    image = Path.Combine(diskFolder, "folder.png");
                }
            }

            // Look for any jpg image
            if (string.IsNullOrEmpty(image))
            {
                string[] imagefiles = Directory.GetFiles(diskFolder, "*.jpg");
                if (imagefiles.Count() > 0)
                {
                    image = imagefiles[0];
                }
            }

            // Look for any jpg image
            if (string.IsNullOrEmpty(image))
            {
                string[] imagefiles = Directory.GetFiles(diskFolder, "*.png");
                if (imagefiles.Count() > 0)
                {
                    image = imagefiles[0];
                }
            }

            if (!string.IsNullOrEmpty(image))
            {
                title.FrontCoverPath = image;
            }

            // Check for fanart
            string fanartfolder = Path.Combine(diskFolder, "Fanart");
            if (Directory.Exists(fanartfolder))
            {
                foreach (string imagefile in Directory.GetFiles(fanartfolder))
                {
                    string extension = Path.GetExtension(imagefile);
                    if (!string.IsNullOrEmpty(extension))
                    {
                        if ((string.Compare(extension, ".jpg", true) == 0) ||
                            (string.Compare(extension, ".png", true) == 0) ||
                            (string.Compare(extension, ".bmp", true) == 0))
                        {
                            title.AddFanArtImage(imagefile);
                        }
                    }
                }
            }
        }
コード例 #8
0
        public static Title ConvertOMLSDKTitleToTitle(OMLSDKTitle omlsdktitle)
        {
            Title _title = new Title();

            if (omlsdktitle != null)
            {
                _title.NameTrimmed         = CopyString(omlsdktitle.Name);
                _title.OriginalNameTrimmed = CopyString(omlsdktitle.OriginalName);
                _title.SortNameTrimmed     = CopyString(omlsdktitle.SortName);
                _title.Synopsis            = CopyString(omlsdktitle.Synopsis);
                _title.ProductionYear      = omlsdktitle.ProductionYear;
                _title.ReleaseDate         = omlsdktitle.ReleaseDate;
                _title.DateAdded           = omlsdktitle.DateAdded;
                _title.Runtime             = omlsdktitle.Runtime;
                _title.StudioTrimmed       = CopyString(omlsdktitle.Studio);
                _title.UPCTrimmed          = CopyString(omlsdktitle.UPC);
                _title.WatchedCount        = omlsdktitle.WatchedCount;
                _title.UserStarRating      = omlsdktitle.UserStarRating;

                _title.EpisodeNumber = omlsdktitle.EpisodeNumber;
                _title.SeasonNumber  = omlsdktitle.SeasonNumber;

                _title.AspectRatioTrimmed     = CopyString(omlsdktitle.AspectRatio);
                _title.VideoDetails           = CopyString(omlsdktitle.VideoDetails);
                _title.VideoResolutionTrimmed = CopyString(omlsdktitle.VideoResolution);
                _title.VideoStandardTrimmed   = CopyString(omlsdktitle.VideoStandard);
                //_title.VideoFormat = (VideoFormat)Enum.Parse(typeof(VideoFormat), omlsdktitle.VideoFormat.ToString());

                _title.FrontCoverPath = CopyString(omlsdktitle.FrontCoverPath);
                _title.BackCoverPath  = CopyString(omlsdktitle.BackCoverPath);

                _title.CountryOfOriginTrimmed = CopyString(omlsdktitle.CountryOfOrigin);

                _title.MetadataSourceIDTrimmed   = CopyString(omlsdktitle.MetadataSourceID);
                _title.MetadataSourceNameTrimmed = CopyString(omlsdktitle.MetadataSourceName);
                _title.ImporterSourceTrimmed     = CopyString(omlsdktitle.ImporterSource);

                _title.OfficialWebsiteURLTrimmed   = CopyString(omlsdktitle.OfficialWebsiteURL);
                _title.ParentalRatingTrimmed       = CopyString(omlsdktitle.ParentalRating);
                _title.ParentalRatingReasonTrimmed = CopyString(omlsdktitle.ParentalRatingReason);


                #region Disks
                foreach (OMLSDKDisk omlsdkdisk in omlsdktitle.Disks)
                {
                    Disk disk = new Disk();
                    disk.Name         = omlsdkdisk.Name;
                    disk.Path         = omlsdkdisk.Path;
                    disk.Format       = (VideoFormat)Enum.Parse(typeof(VideoFormat), omlsdkdisk.Format.ToString());
                    disk.ExtraOptions = omlsdkdisk.ExtraOptions;
                    _title.AddDisk(disk);
                }
                #endregion


                #region Extra Features
                _title.ExtraFeatures = omlsdktitle.ExtraFeatures;
                #endregion


                #region Trailers
                foreach (string Trailer in omlsdktitle.Trailers)
                {
                    _title.AddTrailer(Trailer);
                }
                #endregion


                #region Genres
                if (omlsdktitle.Genres != null)
                {
                    foreach (string genre in omlsdktitle.Genres)
                    {
                        _title.AddGenre(genre);
                    }
                }
                #endregion


                #region Actring Roles
                if (omlsdktitle.ActingRoles != null)
                {
                    foreach (OMLSDKRole role in omlsdktitle.ActingRoles)
                    {
                        _title.AddActingRole(role.PersonName, role.RoleName);
                    }
                }
                #endregion


                #region Non Acting Roles
                if (omlsdktitle.NonActingRoles != null)
                {
                    foreach (OMLSDKRole role in omlsdktitle.NonActingRoles)
                    {
                        _title.AddNonActingRole(role.PersonName, role.RoleName);
                    }
                }
                #endregion


                #region Directors
                if (omlsdktitle.Directors != null)
                {
                    foreach (OMLSDKPerson person in omlsdktitle.Directors)
                    {
                        _title.AddDirector(ConvertOMLSDKPersonToPerson(person));
                    }
                }
                #endregion


                #region Writers
                if (omlsdktitle.Writers != null)
                {
                    foreach (OMLSDKPerson person in omlsdktitle.Writers)
                    {
                        _title.AddWriter(ConvertOMLSDKPersonToPerson(person));
                    }
                }
                #endregion


                #region Producers
                if (omlsdktitle.Producers != null)
                {
                    foreach (OMLSDKPerson person in omlsdktitle.Producers)
                    {
                        _title.AddProducer(ConvertOMLSDKPersonToPerson(person));
                    }
                }
                #endregion


                #region Tags
                if (omlsdktitle.Tags != null)
                {
                    foreach (string tag in omlsdktitle.Tags)
                    {
                        _title.AddTag(tag);
                    }
                }
                #endregion


                #region Audio Tracks
                if (omlsdktitle.AudioTracks != null)
                {
                    foreach (string track in omlsdktitle.AudioTracks)
                    {
                        _title.AddAudioTrack(track);
                    }
                }
                #endregion


                #region Subtitles
                if (omlsdktitle.Subtitles != null)
                {
                    foreach (string subtitles in omlsdktitle.Subtitles)
                    {
                        _title.AddSubtitle(subtitles);
                    }
                }
                #endregion


                #region Fanart Paths
                if (omlsdktitle.FanArtPaths != null)
                {
                    foreach (string path in omlsdktitle.FanArtPaths)
                    {
                        _title.AddFanArtImage(path);
                    }
                }
                #endregion
            }

            return(_title);
        }