public PVContract(VideoUrlParseResult parseResult, PVType type) { ParamIs.NotNull(() => parseResult); Author = parseResult.Author; Name = parseResult.Title; PVId = parseResult.Id; Service = parseResult.Service; ThumbUrl = parseResult.ThumbUrl; PVType = type; Url = PV.GetUrl(Service, PVId); }
public PVContract GetPVByUrl(string pvUrl, PVType type = PVType.Original) { if (string.IsNullOrEmpty(pvUrl)) throw new HttpResponseException(HttpStatusCode.BadRequest); var result = pvParser.ParseByUrl(pvUrl, true, permissionContext); if (!result.IsOk) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest) { ReasonPhrase = result.Exception.Message }); } var contract = new PVContract(result, type); return contract; }
public PVContract(VideoUrlParseResult parseResult, PVType type) { ParamIs.NotNull(() => parseResult); Author = parseResult.Author; Length = parseResult.LengthSeconds ?? 0; Name = parseResult.Title; PVId = parseResult.Id; PublishDate = parseResult.UploadDate; Service = parseResult.Service; ThumbUrl = parseResult.ThumbUrl; PVType = type; Url = PV.GetUrl(Service, PVId); }
public ActionResult CreatePVForSongByUrl(int songId, string pvUrl, PVType type) { var result = VideoServiceHelper.ParseByUrl(pvUrl, true); if (!result.IsOk) { return(Json(new GenericResponse <string>(false, result.Exception.Message))); } var contract = new PVContract(result, type); var view = RenderPartialViewToString("PVForSongEditRow", contract); return(Json(new GenericResponse <string>(view))); }
public async Task <ActionResult <PVContract> > GetPVByUrl(string pvUrl, PVType type = PVType.Original, bool getTitle = true) { if (string.IsNullOrEmpty(pvUrl)) { return(BadRequest()); } var result = await _pvParser.ParseByUrlAsync(pvUrl, getTitle, _permissionContext); if (!result.IsOk) { var msg = result.Exception.Message; return(BadRequest(msg)); } var contract = new PVContract(result, type); return(contract); }
public PVContract GetPVByUrl(string pvUrl, PVType type = PVType.Original) { if (string.IsNullOrEmpty(pvUrl)) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var result = pvParser.ParseByUrl(pvUrl, true, permissionContext); if (!result.IsOk) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest) { ReasonPhrase = result.Exception.Message }); } var contract = new PVContract(result, type); return(contract); }
public async Task <PVContract> GetPVByUrl(string pvUrl, PVType type = PVType.Original, bool getTitle = true) { if (string.IsNullOrEmpty(pvUrl)) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var result = await pvParser.ParseByUrlAsync(pvUrl, getTitle, permissionContext); if (!result.IsOk) { var msg = result.Exception.Message; throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest) { ReasonPhrase = msg, Content = new StringContent(msg) }); } var contract = new PVContract(result, type); return(contract); }
private PVForSong CreatePV(PVService service = PVService.Youtube, PVType pvType = PVType.Original, DateTime?publishDate = null) { return(song.CreatePV(new PVContract { Service = service, PVId = "test", Name = "test", PublishDate = publishDate, PVType = pvType })); }
public virtual IEnumerable <T> OfType(PVType pvType) { return(PVs.Where(p => p.PVType == pvType)); }
public ActionResult CreatePVForSongByUrl(int songId, string pvUrl, PVType type) { var result = VideoServiceHelper.ParseByUrl(pvUrl, true); if (!result.IsOk) { return Json(new GenericResponse<string>(false, result.Exception.Message)); } var contract = new PVContract(result, type); var view = RenderPartialViewToString("PVForSongEditRow", contract); return Json(new GenericResponse<string>(view)); }
public static PVContract PVContract(int id = 0, string pvId = "mikumikumiku", PVType pvType = PVType.Original, DateTime?publishDate = null) { return(new PVContract { Id = id, Service = PVService.Youtube, PVId = pvId, Name = "Nebula", PVType = pvType, PublishDate = publishDate }); }