private static string NameFor(ProcessedSeason?s, string styleString, bool urlEncode) { string name = styleString; if (s is null) { return(string.Empty); } string showname = s.Show.ShowName; if (urlEncode) { showname = Uri.EscapeDataString(showname); } string seasonName = s.Show.CachedShow?.Season(s.SeasonNumber)?.SeasonName; name = name.ReplaceInsensitive("{ShowName}", showname); name = name.ReplaceInsensitive("{ShowNameInitial}", showname.Initial().ToLower()); name = name.ReplaceInsensitive("{ShowNameLower}", s.Show.ShowName.ToLower().Replace(' ', '-').RemoveCharactersFrom("()[]{}&$:")); name = name.ReplaceInsensitive("{Season}", s.SeasonNumber.ToString()); name = name.ReplaceInsensitive("{Season:2}", s.SeasonNumber.ToString("00")); name = name.ReplaceInsensitive("{SeasonNumber}", s.SeasonIndex.ToString()); name = name.ReplaceInsensitive("{SeasonNumber:2}", s.SeasonIndex.ToString("00")); name = name.ReplaceInsensitive("{SeasonName}", seasonName ?? string.Empty); name = name.ReplaceInsensitive("{StartYear}", s.MinYear().ToString()); name = name.ReplaceInsensitive("{EndYear}", s.MaxYear().ToString()); name = name.ReplaceInsensitive("{ShowImdb}", s.Show.CachedShow?.Imdb ?? string.Empty); return(TVSettings.DirectoryFriendly(name.Trim())); }
public static string NameFor(MovieConfiguration?m, string styleString, bool urlEncode, bool isfilename) { string name = styleString; if (m?.ShowName is null) { return(string.Empty); } string showname = m.ShowName; if (urlEncode) { showname = Uri.EscapeDataString(showname); } name = name.ReplaceInsensitive("{ShowName}", showname); name = name.ReplaceInsensitive("{ShowNameInitial}", showname.Initial().ToLower()); name = name.ReplaceInsensitive("{ShowNameLower}", showname.ToLower().Replace(' ', '-').RemoveCharactersFrom("()[]{}&$:")); name = name.ReplaceInsensitive("{ContentRating}", m.CachedMovie?.ContentRating); name = name.ReplaceInsensitive("{Year}", m.CachedMovie?.Year.ToString()); name = name.ReplaceInsensitive("{Imdb}", m.CachedMovie?.Imdb); return(isfilename ? TVSettings.DirectoryFriendly(name.Trim()) : name.Trim()); }