Пример #1
0
        /// <summary>
        /// Handles the EditValueChanged event of the TxtBluray control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void TxtBluray_EditValueChanged(object sender, EventArgs e)
        {
            this.txtBluraySeriesNFOPreview.Text = GeneratePath.TvSeries(
                null, Get.InOutCollection.CurrentTvSaveSettings.BluraySeriesNfoTemplate, this.txtBlurayTestPath.Text);

            this.txtBluraySeriesPosterPreview.Text =
                GeneratePath.TvSeries(
                    null,
                    Get.InOutCollection.CurrentTvSaveSettings.BluraySeriesPosterTemplate,
                    this.txtBlurayTestPath.Text) + ".jpg";

            this.txtBluraySeriesBannerPreview.Text =
                GeneratePath.TvSeries(
                    null,
                    Get.InOutCollection.CurrentTvSaveSettings.BluraySeriesBannerTemplate,
                    this.txtBlurayTestPath.Text) + ".jpg";

            this.txtBluraySeriesFanartPreview.Text =
                GeneratePath.TvSeries(
                    null,
                    Get.InOutCollection.CurrentTvSaveSettings.BluraySeriesFanartTemplate,
                    this.txtBlurayTestPath.Text) + ".jpg";

            this.txtBluraySeasonPosterPreview.Text =
                GeneratePath.TvSeason(
                    null,
                    Get.InOutCollection.CurrentTvSaveSettings.BluraySeasonPosterTemplate,
                    this.txtBlurayTestPath.Text) + ".jpg";

            this.txtBluraySeasonFanartPreview.Text =
                GeneratePath.TvSeason(
                    null,
                    Get.InOutCollection.CurrentTvSaveSettings.BluraySeasonFanartTemplate,
                    this.txtBlurayTestPath.Text) + ".jpg";

            this.txtBluraySeasonBannerPreview.Text =
                GeneratePath.TvSeason(
                    null,
                    Get.InOutCollection.CurrentTvSaveSettings.BluraySeasonBannerTemplate,
                    this.txtBlurayTestPath.Text) + ".jpg";

            this.txtBlurayEpisodeNFOPreview.Text = GeneratePath.TvEpisode(
                null, Get.InOutCollection.CurrentTvSaveSettings.BlurayEpisodeNFOTemplate, this.txtBlurayTestPath.Text);

            this.txtBlurayEpisodeScreenshotPreview.Text =
                GeneratePath.TvEpisode(
                    null,
                    Get.InOutCollection.CurrentTvSaveSettings.BlurayEpisodeScreenshotTemplate,
                    this.txtBlurayTestPath.Text) + ".jpg";
        }
Пример #2
0
        /// <summary>
        /// Saves the episode.
        /// </summary>
        /// <param name="episode">The episode.</param>
        /// <param name="type">The EpisodeIOType type.</param>
        public void SaveEpisode(Episode episode, EpisodeIOType type)
        {
            if (episode.Secondary)
            {
                return;
            }

            if (string.IsNullOrEmpty(episode.FilePath.FileNameAndPath))
            {
                return;
            }

            string nfoTemplate;
            string screenshotTemplate;

            if (MovieNaming.IsDVD(episode.FilePath.FileNameAndPath))
            {
                nfoTemplate        = Get.InOutCollection.CurrentTvSaveSettings.DVDEpisodeNFOTemplate;
                screenshotTemplate = Get.InOutCollection.CurrentTvSaveSettings.DVDEpisodeScreenshotTemplate;
            }
            else if (MovieNaming.IsBluRay(episode.FilePath.FileNameAndPath))
            {
                nfoTemplate        = Get.InOutCollection.CurrentTvSaveSettings.BlurayEpisodeNFOTemplate;
                screenshotTemplate = Get.InOutCollection.CurrentTvSaveSettings.BlurayEpisodeScreenshotTemplate;
            }
            else
            {
                nfoTemplate        = Get.InOutCollection.CurrentTvSaveSettings.EpisodeNFOTemplate;
                screenshotTemplate = Get.InOutCollection.CurrentTvSaveSettings.EpisodeScreenshotTemplate;
            }

            // Nfo
            if (type == EpisodeIOType.All || type == EpisodeIOType.Nfo)
            {
                string nfoPathTo = GeneratePath.TvEpisode(episode, nfoTemplate);

                this.WriteNFO(this.GenerateSingleEpisodeOutput(episode, true), nfoPathTo);
                episode.ChangedText = false;
            }

            // Screenshot
            if (type == EpisodeIOType.Screenshot || type == EpisodeIOType.All)
            {
                if (!string.IsNullOrEmpty(episode.FilePath.FileNameAndPath))
                {
                    string screenshotPathFrom;

                    if (!string.IsNullOrEmpty(episode.EpisodeScreenshotPath) &&
                        File.Exists(episode.EpisodeScreenshotPath))
                    {
                        screenshotPathFrom = episode.EpisodeScreenshotPath;
                    }
                    else
                    {
                        screenshotPathFrom = this.TvPathImageGet(episode.EpisodeScreenshotUrl);
                    }

                    string screenshotPathTo = GeneratePath.TvEpisode(episode, screenshotTemplate);

                    this.CopyFile(screenshotPathFrom, screenshotPathTo + ".jpg");
                    episode.ChangedScreenshot = false;
                }
            }
        }