Пример #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 series.
        /// </summary>
        /// <param name="series">The series.</param>
        /// <param name="type">The SeriesIOType type.</param>
        public void SaveSeries(Series series, SeriesIOType type)
        {
            string path = series.GetSeriesPath();

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            string nfoTemplate;
            string posterTemplate;
            string fanartTemplate;
            string bannerTemplate;

            string firstEpisodePath = series.GetFirstEpisode();

            TvRenamerFactory.RenameSeries(series);

            if (MovieNaming.IsBluRay(firstEpisodePath))
            {
                nfoTemplate    = Get.InOutCollection.CurrentTvSaveSettings.BluraySeriesNfoTemplate;
                posterTemplate = Get.InOutCollection.CurrentTvSaveSettings.BluraySeriesPosterTemplate;
                fanartTemplate = Get.InOutCollection.CurrentTvSaveSettings.BluraySeriesFanartTemplate;
                bannerTemplate = Get.InOutCollection.CurrentTvSaveSettings.BluraySeriesBannerTemplate;
            }
            else if (MovieNaming.IsDVD(firstEpisodePath))
            {
                nfoTemplate    = Get.InOutCollection.CurrentTvSaveSettings.DVDSeriesNfoTemplate;
                posterTemplate = Get.InOutCollection.CurrentTvSaveSettings.DVDSeriesPosterTemplate;
                fanartTemplate = Get.InOutCollection.CurrentTvSaveSettings.DVDSeriesFanartTemplate;
                bannerTemplate = Get.InOutCollection.CurrentTvSaveSettings.DVDSeriesBannerTemplate;
            }
            else
            {
                nfoTemplate    = Get.InOutCollection.CurrentTvSaveSettings.SeriesNfoTemplate;
                posterTemplate = Get.InOutCollection.CurrentTvSaveSettings.SeriesPosterTemplate;
                fanartTemplate = Get.InOutCollection.CurrentTvSaveSettings.SeriesFanartTemplate;
                bannerTemplate = Get.InOutCollection.CurrentTvSaveSettings.SeriesBannerTemplate;
            }

            if (type == SeriesIOType.All || type == SeriesIOType.Nfo)
            {
                // Nfo
                string nfoPathTo = GeneratePath.TvSeries(series, nfoTemplate);

                this.WriteNFO(this.GenerateSeriesOutput(series), nfoPathTo);
                series.ChangedText = false;
            }

            // Poster
            if (type == SeriesIOType.All || type == SeriesIOType.Images || type == SeriesIOType.Poster)
            {
                if (!string.IsNullOrEmpty(series.PosterUrl))
                {
                    string posterPathFrom;

                    if (!string.IsNullOrEmpty(series.PosterPath) && File.Exists(series.PosterPath))
                    {
                        posterPathFrom = series.PosterPath;
                    }
                    else
                    {
                        posterPathFrom = this.TvPathImageGet(series.PosterUrl);
                    }

                    string posterPathTo = GeneratePath.TvSeries(series, posterTemplate);

                    this.CopyFile(posterPathFrom, posterPathTo + ".jpg");
                    series.ChangedPoster = false;
                }
            }

            // Fanart
            if (type == SeriesIOType.All || type == SeriesIOType.Images || type == SeriesIOType.Fanart)
            {
                if (!string.IsNullOrEmpty(series.FanartUrl))
                {
                    string fanartPathFrom;

                    if (!string.IsNullOrEmpty(series.FanartPath) && File.Exists(series.FanartPath))
                    {
                        fanartPathFrom = series.FanartPath;
                    }
                    else
                    {
                        fanartPathFrom = this.TvPathImageGet(series.FanartUrl);
                    }

                    string fanartPathTo = GeneratePath.TvSeries(series, fanartTemplate);

                    this.CopyFile(fanartPathFrom, fanartPathTo + ".jpg");
                    series.ChangedFanart = false;
                }
            }

            // Banner
            if (type == SeriesIOType.All || type == SeriesIOType.Images || type == SeriesIOType.Banner)
            {
                if (!string.IsNullOrEmpty(series.SeriesBannerUrl))
                {
                    string bannerPathFrom;

                    if (!string.IsNullOrEmpty(series.SeriesBannerPath) && File.Exists(series.SeriesBannerPath))
                    {
                        bannerPathFrom = series.SeriesBannerPath;
                    }
                    else
                    {
                        bannerPathFrom = this.TvPathImageGet(series.SeriesBannerUrl);
                    }

                    string bannerPathTo = GeneratePath.TvSeries(series, bannerTemplate);

                    this.CopyFile(bannerPathFrom, bannerPathTo + ".jpg");
                    series.ChangedBanner = false;
                }
            }
        }