public FileResult GetVideo(string urlPart) { if (WebSettingsConfig.Instance.IsSectionForbidden(SectionId.TVSeries)) { return(null); } TVSeriesWatch seriesWatch = GetSeriesWatch(urlPart); if (seriesWatch == null) { return(null); } string fullFileName = WebSettingsConfig.Instance.GetDataFileName(SERIES_FOLDER, seriesWatch.GetPathToFiles(), seriesWatch.VideoFileName); byte[] fileContents = ReadFile(fullFileName); if (EnumerableValidator.IsNullOrEmpty(fileContents)) { return(null); } TVSeriesInfo seriesInfo = seriesWatch.GetSeriesInfo(); return(File(fileContents, "video/mp4", seriesInfo.OrigTitle + "_" + seriesWatch.VideoFileName)); }
public ActionResult GetImageByName(string baseUrlPart, int season, int episode) { if (IsInvalid(baseUrlPart, season, episode)) { //TODO: на другой урл return(RedirectToAction("Index", RouteConfig.MAIN_CONTROLLER_NAME)); } string urlPart = TVSeriesQuery.GetUrlPart(baseUrlPart, season, episode); TVSeriesWatch seriesWatch = GetSeriesWatch(urlPart); if (seriesWatch == null) { return(null); } string fullFileName = WebSettingsConfig.Instance.GetDataFileName(SERIES_FOLDER, seriesWatch.GetPathToFiles(), seriesWatch.ImageFileName); TVSeriesInfo seriesInfo = seriesWatch.GetSeriesInfo(); return(GetImage(seriesInfo.OrigTitle + "_" + seriesWatch.ImageFileName, e => ReadFile(fullFileName))); }