public VideoListModel Search(string token, int lang, int ini, int max, [FromBody] SearchVideoModel search) { string userId = null; if (lang < 3 || lang > 4) { lang = 2; } RacMsg msgs = RacMsg.cache.GetMessage((RacMsg.Language)lang); if (token != "" && token != null) { string machine = HttpContext.Features.Get <IHttpConnectionFeature>()?.RemoteIpAddress.ToString(); userId = SessionCode.ValidateSessionCode(token, machine); } VideoListModel m = new VideoListModel(); if (!LibVisLib.Verify.AcceptFreeText(search.SearchString)) { m.Result = (int)RacLib.RacMsg.Id.Error; m.ResultComplement += msgs.Get(RacMsg.Id.InvalidCharactersInSearchString); RacLib.BaseLog.log.Log(RacLib.BaseLog.LogType.Error, "errSearchString: Invalid chars"); } string srch = LibVisLib.Verify.VerifyFreeText(search.SearchString); m.Ini = ini; m.Total = LibVisLib.Video.GetTotalLastVideos(lang, "", srch); m.Videos = ControllerBase.LatestVideosByCategory(lang, "", ini, max, srch); return(m); }
private async void btn_Input_Click(object sender, RoutedEventArgs e) { await new MessageDialog("此功能能修复一些已经下载完成,但应用里不显示的问题\r\n只需要选择 下载路径\\BiliVideoDownload\\视频ID\\视频MID\\视频MID.josn,然后稍等片刻即可").ShowAsync(); FileOpenPicker filePicker = new FileOpenPicker(); filePicker.ViewMode = PickerViewMode.Thumbnail; filePicker.SuggestedStartLocation = PickerLocationId.VideosLibrary; filePicker.FileTypeFilter.Add(".json"); StorageFile file = await filePicker.PickSingleFileAsync(); if (file == null) { return; } if (file.FileType != ".json") { await new MessageDialog("错误的文件格式!").ShowAsync(); } string json = await FileIO.ReadTextAsync(file); VideoListModel info = JsonConvert.DeserializeObject <VideoListModel>(json); info.downstatus = true; string jsonInfo = JsonConvert.SerializeObject(info); //StorageFile fileWrite = await folder.CreateFileAsync(info.Guid + ".json", CreationCollisionOption.ReplaceExisting); await FileIO.WriteTextAsync(file, jsonInfo); GetDownOk(); Utils.ShowMessageToast("导入完成", 3000); }
public ActionResult GetVideoAccess(int cplId, int courseType) { //这个地方要判断是否是公开课还是自约课 if (courseType == 1)//公开课 { var res = new Response <string>(); res.Result = new GenSeeService().GetUrl(cplId); return(Json(res)); } else//自约课 { var res = new Response <List <VideoListModel> >(); var ret = Common.GetRequestConent(SsoKey.GetKey(memberService.GetMember(member.Id).Result), Common.VideoAccessoryUrl, "{\"CplId\":\"" + cplId + "\",\"CourseType\":\"" + courseType + "\"}"); var tempmodel = new JavaScriptSerializer().Deserialize <VideoInfoObject>(ret); if (tempmodel.Data != null && tempmodel.Data.Count > 0) { res.Result = new List <VideoListModel>(); try { tempmodel.Data.ForEach(c => { var model = new VideoListModel(); model.RecordStartTime = c.RecordStartTime; // url = string.Format("{0}?nickName={1}&token={2}", jr["Data"]["Url"].ToString(), jr["Data"]["Id"].ToString(), jr["Data"]["PASSWORD"].ToString()); model.DataUrl = string.Format("{0}?nickName={1}&token={2}", c.Url, c.Id, c.PASSWORD); res.Result.Add(model); }); } catch (Exception ex) { } } return(Json(res)); } }
public virtual IActionResult GaleriPictureList(int id) { VideoGallery galeri = _videoGalleryRepository.GetById(id); if (galeri == null) { throw new ArgumentException("No product picture found with the specified id"); } List <Video> gridData = _videoRepository.Table.Where(x => x.VideoGalleryId == id).ToList(); VideoListModel model = new VideoListModel { Data = gridData.Select(x => { VideoModel galeriPicturemodel = new VideoModel { Id = x.Id, DisplayOrder = x.DisplayOrder, Published = x.Published, IsApproved = x.IsApproved, EmbedCode = x.EmbedCode, Descriptions = x.Descriptions, VideoGalleryId = x.VideoGalleryId }; return(galeriPicturemodel); }), Total = gridData.Count() }; return(Json(model)); }
public static async Task <VideoListModel> GetNowPlayingMovieAsync(int page = 1) { VideoListModel model = null; string param = $"/movie/now_playing?api_key={_apikey}&page={page}&language={_language}"; string r = await _http.Request(param); if (r != null) { model = JsonConvert.DeserializeObject <VideoListModel>(r); } return(model); }
public VideoListModel List(string token, int lang, int ini, int max) { string userId = ""; if (token != "" && token != null) { string machine = HttpContext.Features.Get <IHttpConnectionFeature>()?.RemoteIpAddress.ToString(); userId = SessionCode.ValidateSessionCode(token, machine); } lang = LibVisLib.Verify.ValidLanguage(lang); RacMsg msgs = RacMsg.cache.GetMessage((RacMsg.Language)lang); VideoListModel m = new VideoListModel(); m.Ini = ini; m.Total = LibVisLib.Video.GetTotalLastVideos(lang, ""); m.Videos = ControllerBase.LatestVideosByCategory(lang, "", ini, max); return(m); }
/// <summary> /// return a list of videos to the view, depending on the selected format and sorting characteristics, typically coming from an action link /// in the navbar. /// Videos should be selected in two lists: special videos and recommendations. /// For now, these lists are: all videos matching the format, and star wars videos (obviously). /// /// TODO push filtering, sorting functionality out of method? /// </summary> /// <param name="format">The format of the videolist items, i.e. all, DVD, etc.</param> /// <param name="sortBy">The attribute to order the list by</param> /// <returns></returns> public ActionResult VideoList(string format, string sortBy, string filterText = "") { VideoListModel model = new VideoListModel(); List <VideoWrapperModel> specials = new List <VideoWrapperModel>(); List <VideoWrapperModel> recommendations = new List <VideoWrapperModel>(); VideoWrapperModel item; var formatResult = _db.FormatToVideo.AsQueryable(); if (format != "All") { formatResult = formatResult.Where(x => x.Format.FormatName == format); } try { switch (sortBy) { case "Title": formatResult = formatResult.OrderBy(m => m.Video.Title); break; case "Length": formatResult = formatResult.OrderBy(m => m.Video.Length); break; case "Actor": formatResult = formatResult.OrderBy(m => m.Video.ActorToVideo.First().Actor.ActorName); break; case "Producer": formatResult = formatResult.OrderBy(m => m.Video.ProducerToVideo.First().Producer.ProducerName); break; case "Description": formatResult = formatResult.OrderBy(m => m.Video.Description); break; default: break; } } catch (NullReferenceException) { //TODO do something } if (!string.IsNullOrWhiteSpace(filterText)) { formatResult = formatResult.Where(m => m.Video.Title.Contains(filterText)); } // from each video, pull out the video, price, inventory id, and image address foreach (var i in formatResult .Include(x => x.Inventory) .Include(x => x.Video) .Take(16)) { item = new VideoWrapperModel(); item.image = i.Inventory.Image; item.price = i.Inventory.Price; item.video = i.Video; item.inventoryId = i.InventoryId; specials.Add(item); } model.specials = specials; // re-query result choosing only recommendations // currently, recommendations are always movies containing "Star" in name. // TODO allow for new types of recommendations model.recommendations = model.specials.Where(m => m.video.Title.Contains("Star")).ToList(); model.selectedFormat = format; return(View(model)); }
// #region 视频添加-编辑 public ActionResult VideoAdd(VideoListModel model, string ReturnUrl, Nullable <long> myid = 0, int AlbumId = 0) { #region 获取来路路径 if (System.Web.HttpContext.Current.Request.UrlReferrer != null) { ViewBag.ReturnUrl = System.Web.HttpContext.Current.Request.UrlReferrer.PathAndQuery; } #endregion ViewBag.Headline = "视频添加"; //栏目主题 ViewBag.ButtonValue = "添加"; //按钮名称 // int AllTimeSecond = 0; int myMinute = 0; int mySecond = 0; // using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities())//数据库操作 { if ((myid > 0) && (model.Operate == null)) { long mySelfId = 0; long.TryParse(myid.ToString(), out mySelfId); ViewBag.Headline = "看一看视频编辑"; ViewBag.ButtonValue = "修改"; model.Operate = "edit"; // #region 取出数据 Child_Video_List editRecord = myOperating.Child_Video_List.FirstOrDefault(p => p.VideoId == mySelfId); if (editRecord != null) { model.VideoId = editRecord.VideoId; model.AlbumId = editRecord.AlbumId; model.VideoTitle = editRecord.VideoTitle; model.VideoImage = editRecord.VideoImage; model.VideoUrl = editRecord.VideoUrl; model.VideoDes = editRecord.VideoDes; // #region 时间拆分成分秒 if (editRecord.TimeSeconds != null) { int.TryParse(editRecord.TimeSeconds.ToString(), out AllTimeSecond); } myMinute = AllTimeSecond / 60; mySecond = AllTimeSecond % 60; model.TimeMinute = myMinute; model.TimeSeconds = mySecond; #endregion model.OrderBy = editRecord.OrderBy; } #endregion } else if (model.Operate == "add") { #region 时间组合分秒 if (model.TimeMinute != null) { int.TryParse(model.TimeMinute.ToString(), out myMinute); } if (model.TimeSeconds != null) { int.TryParse(model.TimeSeconds.ToString(), out mySecond); } AllTimeSecond = myMinute * 60 + mySecond; #endregion // #region 保存添加 if (ModelState.IsValid) { Child_Video_List addRecord = new Child_Video_List(); addRecord.AlbumId = model.AlbumId; addRecord.VideoTitle = model.VideoTitle; addRecord.VideoImage = model.VideoImage; addRecord.VideoUrl = model.VideoUrl; addRecord.VideoDes = model.VideoDes; addRecord.AddDate = DateTime.Now; addRecord.TimeSeconds = AllTimeSecond; addRecord.PlayTimes = 0; addRecord.OrderBy = model.OrderBy; addRecord.Status = 200; // myOperating.Child_Video_List.Add(addRecord); myOperating.SaveChanges(); // return(RedirectToLocal(ReturnUrl)); } else { ModelState.AddModelError("", "输入错误"); } #endregion } else if (model.Operate == "edit") { #region 时间组合分秒 if (model.TimeMinute != null) { int.TryParse(model.TimeMinute.ToString(), out myMinute); } if (model.TimeSeconds != null) { int.TryParse(model.TimeSeconds.ToString(), out mySecond); } AllTimeSecond = myMinute * 60 + mySecond; #endregion // #region 保存编辑 if (ModelState.IsValid) { Child_Video_List editSaveRecord = myOperating.Child_Video_List.FirstOrDefault(p => p.VideoId == model.VideoId); if (editSaveRecord != null) { editSaveRecord.AlbumId = model.AlbumId; editSaveRecord.VideoTitle = model.VideoTitle; editSaveRecord.VideoImage = model.VideoImage; editSaveRecord.VideoUrl = model.VideoUrl; editSaveRecord.VideoDes = model.VideoDes; editSaveRecord.TimeSeconds = AllTimeSecond; editSaveRecord.OrderBy = model.OrderBy; // myOperating.SaveChanges(); // return(RedirectToLocal(ReturnUrl)); } } else { ModelState.AddModelError("", "输入错误"); } #endregion } else { //初次加载-添加 model.AlbumId = AlbumId; //类别编号 model.Operate = "add"; #region 默认值 try { model.OrderBy = myOperating.Child_Video_List.Where(p => p.AlbumId == AlbumId).Max(p => p.OrderBy) + 1; } catch { model.OrderBy = 0; } if (model.OrderBy == null) { model.OrderBy = 1; } #endregion } } // return(View(model)); }