예제 #1
0
        public string GetTargetEpisodeName(Episode ep, string showname, TimeZone tz, bool dvdOrder, bool urlEncode)
        {
            //note this is for an Episode and not a ProcessedEpisode
            string name = this.StyleString;

            string epname = ep.Name;

            name = name.ReplaceInsensitive("{ShowName}", showname);
            if (dvdOrder)
            {
                name = name.ReplaceInsensitive("{Season}", ep.DVDSeasonNumber.ToString());
                name = name.ReplaceInsensitive("{Season:2}", ep.DVDSeasonNumber.ToString("00"));
                name = name.ReplaceInsensitive("{Episode}", ep.DVDEpNum.ToString("00"));
                name = name.ReplaceInsensitive("{Episode2}", ep.DVDEpNum.ToString("00"));
                name = Regex.Replace(name, "{AllEpisodes}", ep.DVDEpNum.ToString("00"));
            }
            else
            {
                name = name.ReplaceInsensitive("{Season}", ep.AiredSeasonNumber.ToString());
                name = name.ReplaceInsensitive("{Season:2}", ep.AiredSeasonNumber.ToString("00"));
                name = name.ReplaceInsensitive("{Episode}", ep.AiredEpNum.ToString("00"));
                name = name.ReplaceInsensitive("{Episode2}", ep.AiredEpNum.ToString("00"));
                name = Regex.Replace(name, "{AllEpisodes}", ep.AiredEpNum.ToString("00"));
            }
            name = name.ReplaceInsensitive("{EpisodeName}", epname);
            name = name.ReplaceInsensitive("{Number}", "");
            name = name.ReplaceInsensitive("{Number:2}", "");
            name = name.ReplaceInsensitive("{Number:3}", "");

            name = ReplaceDates(urlEncode, name, ep.GetAirDateDT(tz));

            name = Regex.Replace(name, "([^\\\\])\\[.*?[^\\\\]\\]", "$1"); // remove optional parts

            name = name.Replace("\\[", "[");
            name = name.Replace("\\]", "]");

            return(name.Trim());
        }
예제 #2
0
        public string GetTargetEpisodeName(Episode ep, string showname, TimeZone tz, bool dvdOrder, bool urlEncode = false)
        {
            //note this is for an Episode and not a ProcessedEpisode
            String name = this.StyleString;

            string epname = ep.Name;

            name = name.ReplaceInsensitive("{ShowName}", showname);
            if (dvdOrder)
            {
                name = name.ReplaceInsensitive("{Season}", ep.DVDSeasonNumber.ToString());
                name = name.ReplaceInsensitive("{Season:2}", ep.DVDSeasonNumber.ToString("00"));
                name = name.ReplaceInsensitive("{Episode}", ep.DVDEpNum.ToString("00"));
                name = name.ReplaceInsensitive("{Episode2}", ep.DVDEpNum.ToString("00"));
                name = Regex.Replace(name, "{AllEpisodes}", ep.DVDEpNum.ToString("00"));
            }
            else
            {
                name = name.ReplaceInsensitive("{Season}", ep.AiredSeasonNumber.ToString());
                name = name.ReplaceInsensitive("{Season:2}", ep.AiredSeasonNumber.ToString("00"));
                name = name.ReplaceInsensitive("{Episode}", ep.AiredEpNum.ToString("00"));
                name = name.ReplaceInsensitive("{Episode2}", ep.AiredEpNum.ToString("00"));
                name = Regex.Replace(name, "{AllEpisodes}", ep.AiredEpNum.ToString("00"));
            }
            name = name.ReplaceInsensitive("{EpisodeName}", epname);
            name = name.ReplaceInsensitive("{Number}", "");
            name = name.ReplaceInsensitive("{Number:2}", "");
            name = name.ReplaceInsensitive("{Number:3}", "");
            DateTime?airdt = ep.GetAirDateDT(tz);

            if (airdt != null)
            {
                DateTime dt = (DateTime)airdt;
                name = name.ReplaceInsensitive("{ShortDate}", dt.ToString("d"));
                name = name.ReplaceInsensitive("{LongDate}", dt.ToString("D"));
                string ymd = dt.ToString("yyyy/MM/dd");
                if (urlEncode)
                {
                    ymd = System.Web.HttpUtility.UrlEncode(ymd);
                }
                name = name.ReplaceInsensitive("{YMDDate}", ymd);
            }
            else
            {
                name = name.ReplaceInsensitive("{ShortDate}", "---");
                name = name.ReplaceInsensitive("{LongDate}", "------");
                string ymd = "----/--/--";
                if (urlEncode)
                {
                    ymd = System.Web.HttpUtility.UrlEncode(ymd);
                }
                name = name.ReplaceInsensitive("{YMDDate}", ymd);
            }



            name = Regex.Replace(name, "([^\\\\])\\[.*?[^\\\\]\\]", "$1"); // remove optional parts

            name = name.Replace("\\[", "[");
            name = name.Replace("\\]", "]");

            return(name.Trim());
        }