private async void CaptureVideo() { ///data/user/0/com.companyname.mediapickerspike/files/ed3f5961-4554-4a3f-ba3d-dd44020745562062848124215052442.mp4 try { var video = await MediaPicker.CaptureVideoAsync(new MediaPickerOptions { Title = "Record Video" }); var stream = await video.OpenReadAsync(); var documentPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var localPath = Path.Combine(documentPath, video.FileName); File.WriteAllBytes(localPath, stream.ReadAllBytes()); Videos.Add(new UserVideo { FullPath = localPath, VideoId = video.FileName, Name = $"Test Video {Videos.Count}" }); } catch (Exception e) { Console.WriteLine(e); } }
public Video(int id, string name, DateTime date, string url, Class c, Project project, Task mode, string episode) { this.Id = id; this.Name = name; this.Date = date; this.EndDate = this.Date.AddHours(1); this.URL = url; this.Class = c; this.Project = project; this.Mode = mode; this.Episode = episode; if (this.Name != null && this.Class != null && this.Project != null) { Videos.Add(this); } }
async Task ExecuteLoadVideosCommand(bool forceRefresh = true) { if (IsBusy) { return; } if (!forceRefresh && Videos.Count > 0) { return; } IsBusy = true; try { Videos.Clear(); var items = await DataSource.GetItemsAsync(); foreach (var item in items) { Videos.Add(item); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private void InitializeBackgroundVideo(ShellSettings settings) { var defaultItem = "None"; var dir = ThemeManager.GetVideoDir(); if (dir != null) { var mediaFiles = dir.GetFiles(); foreach (var mediaFile in mediaFiles) { Videos.Add(mediaFile.Name); } if (!string.IsNullOrWhiteSpace(settings.Theme.BackgroundVideo)) { SelectedVideo = settings.Theme.BackgroundVideo; } else { SelectedVideo = defaultItem; } if (Videos.Count > 0) { Videos.Insert(0, defaultItem); } } }
public async Task InitializeAsync() { var settingsLoader = new SettingsLoader(); VideosPerPage = int.Parse((await settingsLoader.GetSettingAsync(Setting.MAXVIDEOSPERPAGE))?.Value ?? "50"); ThumpnailSize = int.Parse((await settingsLoader.GetSettingAsync(Setting.THUMPNAILSIZE))?.Value ?? "320"); var videos = await _VideoProvider.GetVideos(); videos = videos.OrderBy(x => x.Artist.Name).ThenBy(x => x.Name).ToList(); foreach (var video in videos) { var vidVM = new VideoViewModel(video); Videos.Add(vidVM); } FilteredVideos = Videos.ToList(); // Add all videos to CurrentPageVideos, page filtering is done via SourceCollectionView.Filter foreach (var video in Videos) { CurrentPageVideos.Add(video); } VideoCollectionView.MoveCurrentToFirst(); MaxPage = Videos.Count / VideosPerPage; GroupAfterArtist(null); foreach (var video in Videos) { video.ThumbailBitmap = await video.GetThumbnailBitmap().ConfigureAwait(false); } }
public override async Task Reload() { const string url = "http://www.nicovideo.jp/api/deflist/list"; var json = await GetJsonAsync(url); Videos.Clear(); foreach (dynamic item in json["mylistitem"]) { var video = VideoStatusModel.Instance.GetVideo((string)item["item_id"]); video.VideoUrl = item["item_id"]; video.Title = item["item_data"]["title"]; video.Description = item["description"]; //video.Tags = data["tags"]; //video.CategoryTag = data["categoryTags"]; video.ViewCounter = long.Parse(item["item_data"]["view_counter"]); video.MylistCounter = long.Parse(item["item_data"]["mylist_counter"]); video.CommentCounter = long.Parse(item["item_data"]["num_res"]); video.StartTime = NicoDataConverter.FromUnixTime((long)item["item_data"]["first_retrieve"]); //video.LastCommentTime = Converter.item(data["lastCommentTime"]); video.LengthSeconds = long.Parse(item["item_data"]["length_seconds"]); video.ThumbnailUrl = item["item_data"]["thumbnail_url"]; video.LastResBody = item["item_data"]["last_res_body"]; //video.CommunityIcon = data["communityIcon"]; Videos.Add(video.VideoId); } }
public void addVideo(string url) { YouTubeVideo video = youTube.GetVideo(url); Videos.Add(video); OnNotifyPropertyChanged(nameof(Videos)); }
public List <Video> GetByVideoMiolo(VideoMiolo vm, string matricula = null, Aplicacoes IdAplicacao = Aplicacoes.MsProMobile, string VersaoApp = "") { VideoMioloEntity vme = new VideoMioloEntity(); vme.setVersaoAplicacao((int)IdAplicacao, VersaoApp); vme.setChaveamentoVimeoApostila(new ChaveamentoVimeoMediMiolo()); var lst = vme.GetByFilters(vm).ToList(); var lstv = new Videos(); foreach (var valor in lst) { if (!lstv.Any(i => i.Url.Equals(valor.HTTPURL))) { var video = new Video(); video.ID = Convert.ToInt32(valor.ID); video.VideoId = valor.VideoID; video.Url = valor.HTTPURL; video.Thumb = valor.URLThumb; video.Links = valor.Links; video = CreateVideoObject(video, matricula); lstv.Add(video); } } return(lstv); }
public void AddVideo(string path) { if (Videos.Where(video => video.Path == path).Count() != 0) { Videos.Add(new Video(path)); } }
public void AddVideosFromDirectory(string path, bool recursive = true) { foreach (Video v in VideoMgr.GetVideosFromDirectory(path, recursive)) { Videos.Add(v); } }
public void AddVideo(Video video) { if (video != null) { Videos.Add(video); } }
/// <summary> /// Method to invoke when the ImportCommand command is executed. /// </summary> private void OnImportExecute() { FileInfo fi = new FileInfo(excelFilePath); using (ExcelPackage ep = new ExcelPackage(fi)) { ExcelWorksheet ws = ep.Workbook.Worksheets[1]; int row = 2; while (ws.Cells[row, 1].Value != null) { bool isBibleHour = false; string title = string.Empty; string speaker = string.Empty; string ecclesia = string.Empty; string link = string.Empty; DateTime date = DateTime.FromOADate((double)ws.Cells[row, 1].Value); if (ws.Cells[row, 2].Value != null) { isBibleHour = ws.Cells[row, 2].Value.ToString() == "Bible Hour"; } if (ws.Cells[row, 3].Value != null) { title = ws.Cells[row, 3].Value.ToString(); } if (ws.Cells[row, 4].Value != null) { speaker = ws.Cells[row, 4].Value.ToString(); int ind = speaker.IndexOf('('); if (ind != -1) { ecclesia = speaker.Substring(ind + 1); ecclesia = ecclesia.Replace(')', ' ').Trim(); speaker = speaker.Substring(0, ind - 1).Trim(); } } if (ws.Cells[row, 5].Value != null) { link = ws.Cells[row, 5].Value.ToString(); } var video = new VideoModel() { Title = title, Link = link, Date = date, IsBibleHour = isBibleHour, Speaker = speaker, Ecclesia = ecclesia }; Videos.Add(video); row++; } } }
private void LoadData(IThumbnailGenerator thumbnailGenerator) { List <string> allVideoUrls = new List <string>(); foreach (var path in _statusResourcesPaths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path).Where(x => x.EndsWith(".mp4")); allVideoUrls.AddRange(files); } } Videos.Clear(); foreach (string url in allVideoUrls) { Videos.Add(new Video { ImageCachePath = thumbnailGenerator.GenerateThumbnailAsPath(url, 1000, _appCachePath), ImageSource = null,/*thumbnailGenerator.GenerateThumbnail(url, 1000),*/ Path = url, BackgroundColor = _unselectedStateColor }); } }
public bool AddVideo(Video video) { video.User = this; Videos.Add(video); return(true); }
public List <Video> GetVideoQuestaoConcurso(int idQuestao, int idAplicacao = 5, string appVersion = "") { using (var ctx = new AcademicoContext()) { using (var ctxMatDir = new DesenvContext()) { var lst = new Videos(); int VideoId = (from qv in ctxMatDir.tblVideo_Questao_Concurso where qv.intQuestaoID == idQuestao select qv.intVideoID).FirstOrDefault(); var consulta = (from v in ctx.tblVideo where v.intVideoID == VideoId select v).FirstOrDefault(); if (consulta != null) { //TODO: Refatorar para a classe de business VideoBusiness videoBusiness = new VideoBusiness(this); string url = videoBusiness.ObterUrlVideo(idAplicacao, consulta, new ChaveamentoQuestaoConcurso(), appVersion); lst.Add(new Video { ID = consulta.intVideoID, Url = url, Thumb = !string.IsNullOrEmpty(consulta.txtUrlThumbVimeo) ? consulta.txtUrlThumbVimeo : videoBusiness.ObterURLThumb(consulta.intVideoID, consulta.txtUrlThumbVimeo), Nome = consulta.txtName.Trim(), ExisteAmazon = videoBusiness.UrlVideoValida(url), Links = GetLinksVideoVariasQualidades(consulta.txtVideoInfo, url) });; } else { lst.Add(new Video { Url = "http://iosstream.s3.amazonaws.com/videosemcomentario.mp4", Nome = string.Empty }); } return(lst); } } }
public void AddVideos(IEnumerable <Video> videos) { if (videos != null) { foreach (Video v in videos) { Videos.Add(v); } } }
/// <summary> /// Searches for a YouTube /// </summary> private async void Search() { var result = await youtube.SearchYoutubeVideo(SearchText); Videos.Clear(); foreach (var video in result) { Videos.Add(video); } }
public async Task <bool> Next() { if (Complate) { return(false); } if (first == true) { CurrentPageHtml = await WebHelper.GetString(this.Url); first = false; } List <string> pageList = GetPageUrlList(); int pageCount = (pageList != null && pageList.Count > 1) ? pageList.Count : 1; if (pageCount == 1) { var list = await GetPageVideos(this.Url); foreach (var li in list) { Videos.Add(li); await Task.Delay(20); } Complate = true; CurrentIndex++; return(false); } else { string url = pageList[CurrentIndex]; var list = await GetPageVideos(url); foreach (var li in list) { Videos.Add(li); await Task.Delay(new Random().Next(20, 50)); } CurrentIndex++; if (CurrentIndex >= pageCount) { Complate = true; return(false); } } return(true); }
internal void UpdateFeedResult(IList <NicoVideo> result, DateTime updatedAt) { Videos.Clear(); foreach (var video in result.Select(x => new VideoListItemControlViewModel(x))) { Videos.Add(video); } LastUpdatedAt = updatedAt; }
public Video AddVideo(string url, string comment) { lock (Videos) { var v = new Video(ObjectMode.New) { Vehicle = this, Url = url, Comment = comment }; Videos.Add(v); return(v); } }
public bool TryAdd(Video video) { if (Videos.Any(v => v.ID == video.ID)) { return(false); } SizeInMb -= video.SizeInMb; Videos.Add(video); return(true); }
private async void LoadMore() { var videos = await YoutubeService.ListarVideosYoutube(Search, TokenNextPage); if (videos.items != null && videos.items.Any()) { foreach (var item in videos.items) { Videos.Add(item); } TokenNextPage = videos.nextPageToken; } }
public async Task ExecuteLoadVideosCommandAsync() { IsBusy = true; var videos = await LoadVideosAsync(); foreach (var video in videos) { Videos.Add(video); } IsBusy = false; }
public override async Task Reload() { if (string.IsNullOrWhiteSpace(Word)) { ServiceFactory.MessageService.Error("検索ワードが入力されていません。"); return; } Videos.Clear(); string targets = IsTag ? "tagsExact" : "title,description,tags"; string q = NicoDataConverter.ToUrlEncode(Word); string fields = "contentId,title,description,tags,categoryTags,viewCounter,mylistCounter,commentCounter,startTime,lastCommentTime,lengthSeconds,thumbnailUrl"; string offset = Offset.ToString(); string limit = Limit.ToString(); string context = "kaz.server-on.net/NicoV4"; string sort = OrderBy; string url = String.Format("http://api.search.nicovideo.jp/api/v2/video/contents/search?q={0}&targets={1}&fields={2}&_sort={3}&_offset={4}&_limit={5}&_context={6}", q, targets, fields, sort, offset, limit, context ); // TODO 入力チェック var json = await GetJsonAsync(url); Videos.Clear(); foreach (dynamic data in json["data"]) { var video = VideoStatusModel.Instance.GetVideo(NicoDataConverter.ToId(data["contentId"])); video.Title = data["title"]; video.Description = data["description"]; video.Tags = data["tags"]; video.CategoryTag = data["categoryTags"]; video.ViewCounter = data["viewCounter"]; video.MylistCounter = data["mylistCounter"]; video.CommentCounter = data["commentCounter"]; video.StartTime = NicoDataConverter.ToDatetime(data["startTime"]); video.LastCommentTime = NicoDataConverter.ToDatetime(data["lastCommentTime"]); video.LengthSeconds = data["lengthSeconds"]; video.ThumbnailUrl = data["thumbnailUrl"]; //CommunityIcon = data["communityIcon"] // 自身に追加 Videos.Add(video.VideoId); } DataLength = json["meta"]["totalCount"]; ServiceFactory.MessageService.Debug(url); }
public override async Task Reload() { if (string.IsNullOrWhiteSpace(Target) || string.IsNullOrWhiteSpace(Period) || string.IsNullOrWhiteSpace(Category)) { ServiceFactory.MessageService.Error("検索ワードが入力されていません。"); return; } const string url = "http://www.nicovideo.jp/ranking/genre/{0}?tag={1}&term={2}&rss=2.0&lang=ja-jp"; var urltmp = string.Format(url, Target, Category, Period); var channel = (await GetXmlAsync(urltmp)) .Descendants("channel").First(); Videos.Clear(); foreach (var item in channel.Descendants("item")) { try { Videos.Add(UpdateVideoFromXml( item, "nico-info-total-view", "nico-info-total-mylist", "nico-info-total-res" )); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } //var desc = CreateDesc(item); //var lengthSecondsStr = (string)desc // .Descendants("strong") // .Where(x => (string)x.Attribute("class") == "nico-info-length") // .First(); //var video = VideoStatusModel.Instance.GetVideo(NicoDataConverter.ToId(item.Element("link").Value)); //video.Title = item.Element("title").Value; //video.ViewCounter = NicoDataConverter.ToCounter(desc, "nico-info-total-view"); //video.MylistCounter = NicoDataConverter.ToCounter(desc, "nico-info-total-res"); //video.CommentCounter = NicoDataConverter.ToCounter(desc, "nico-info-total-mylist"); //video.StartTime = NicoDataConverter.ToRankingDatetime(desc, "nico-info-date"); //video.ThumbnailUrl = (string)desc.Descendants("img").First().Attribute("src"); //video.LengthSeconds = NicoDataConverter.ToLengthSeconds(lengthSecondsStr); //video.Description = (string)desc.Descendants("p").FirstOrDefault(x => (string)x.Attribute("class") == "nico-description"); //// 自身に追加 //Videos.Add(video.VideoId); } }
private void LoadVideosFromDatabase() { Videos.Clear(); LogHelper.Log("Loading videos from VideoDB ..."); var videos = LoadVideos(x => x.IsCameraRoll == false && x.IsTvShow == false); LogHelper.Log($"Found {videos.Count} artists from VideoDB"); var newVideos = videos.OrderBy(x => x.Name); foreach (var v in newVideos) { Videos.Add(v); } }
public VideoModel GetVideo(string id) { var video = Videos.FirstOrDefault(v => v.VideoId == id); if (video == null) { video = new VideoModel() { VideoId = id }; Videos.Add(video); } return(video); }
public async void NavListBoxSelectionChanged() { // Load videos var result = await YoutubeApi.GetVideosByChannelAsync(SelectedChannel, 10); if (result.Exception == null) { Videos.Clear(); result.Result.ForEach(x => Videos.Add(x)); } else { ShowError(result.Exception); } }
private async void VideoProvider_VideoAdded(object sender, Video e) { if (Videos.Any(x => x.FilePath == e.FilePath)) { return; } var videoVM = new VideoViewModel(e); Videos.Add(videoVM); FilteredVideos.Add(videoVM); SetCurrentPage(); videoVM.ThumbailBitmap = await videoVM.GetThumbnailBitmap().ConfigureAwait(false); }
public Videos GetVideoQuestaoSimulado(int QuestaoID, int idAplicacao = 0, string versaoApp = "") { string versao = versaoApp != "" ? versaoApp : ConfigurationProvider.Get("Settings:ChaveamentoVersaoMinimaMsPro"); using (var ctx = new AcademicoContext()) { var lst = new Videos(); var consulta = (from v in ctx.tblVideo join qv in ctx.tblVideo_Questao_Simulado on v.intVideoID equals qv.intVideoID where qv.intQuestaoID == QuestaoID select new { v.intVideoID, v.txtFileName, v.txtPath, v.guidVideoID, v.txtVideoInfo }).FirstOrDefault(); if (consulta != null) { VideoBusiness videoBusiness = new VideoBusiness(new VideoEntity()); var url = GetUrlVideoPorVideoID(consulta.intVideoID, new ChaveamentoVimeoSimulado(), idAplicacao, versao); lst.Add(new Video { ID = consulta.intVideoID, Url = url, Thumb = videoBusiness.ObterURLThumb(consulta.intVideoID, ""), Nome = consulta.txtFileName.Replace(".xml", "").Trim(), Links = GetLinksVideoVariasQualidades(consulta.txtVideoInfo, url) }); } else { lst.Add(new Video { Url = "http://iosstream.s3.amazonaws.com/videosemcomentario.mp4", Nome = string.Empty }); } return(lst); } }
public ActionResult VideoVote() { Contest contest = Contest.GetLastContest(); ViewBag.Contest = contest; mu = Membership.GetUser(); if (ContestVideo.IsUserContestVoted(Convert.ToInt32(mu.ProviderUserKey), contest.ContestID) && contest.DeadLine.AddHours(72) > DateTime.UtcNow) { LoadContestResults(); return View(); } ContestVideos cvids = new ContestVideos(); cvids.GetContestVideosForContest(contest.ContestID); Videos vidsInContest = new Videos(); Video vid2 = null; foreach (ContestVideo cv1 in cvids) { vid2 = new Video(cv1.VideoID); vidsInContest.Add(vid2); } vidsInContest.Sort(delegate(Video p1, Video p2) { return p1.PublishDate.CompareTo(p2.PublishDate); }); ViewBag.ContestVideos = vidsInContest; //SongRecords sngrcds3 = new SongRecords(); //SongRecord sng3 = new SongRecord(); //foreach (Video v1 in vidsInContest) //{ // sng3 = new SongRecord(v1); // sngrcds3.Add(sng3); //} //ViewBag.ContestVideoList = sngrcds3.VideosList(); return View(); }
public ActionResult ManageVideos() { mu = Membership.GetUser(); UserAccountVideos uavs = new UserAccountVideos(); uavs.GetVideosForUserAccount(Convert.ToInt32(mu.ProviderUserKey), 'U'); if (uavs.Count > 0) { Videos favvids = new Videos(); Video f1 = new Video(); foreach (UserAccountVideo uav1 in uavs) { f1 = new Video(uav1.VideoID); if (f1.IsEnabled) favvids.Add(f1); } SongRecord sng1 = null; SongRecords sngrcds2 = new SongRecords(); foreach (Video v1 in favvids) { sng1 = new SongRecord(v1); sngrcds2.Add(sng1); } sngrcds2.IsUserSelected = true; sngrcds2.EnableChangeOrder = false; ViewBag.UserUploaded = sngrcds2.VideoPlaylist(); } return View(uavs); }
public ActionResult ProfileDetail(string userName) { ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277; ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400; _ua = new UserAccount(userName); var uad = new UserAccountDetail(); uad.GetUserAccountDeailForUser(_ua.UserAccountID); uad.BandsSeen = ContentLinker.InsertBandLinks(uad.BandsSeen, false); uad.BandsToSee = ContentLinker.InsertBandLinks(uad.BandsToSee, false); var model = new ProfileModel(); model.ProfilePhotoMainRaw = uad.RawProfilePicUrl; if (_ua.UserAccountID > 0) { model.UserAccountID = _ua.UserAccountID; model.PhotoCount = PhotoItems.GetPhotoItemCountForUser(_ua.UserAccountID); model.CreateDate = _ua.CreateDate; } if (_mu != null) { ViewBag.IsBlocked = BlockedUser.IsBlockedUser(_ua.UserAccountID, Convert.ToInt32(_mu.ProviderUserKey)); ViewBag.IsBlocking = BlockedUser.IsBlockedUser(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID); if (_ua.UserAccountID == Convert.ToInt32(_mu.ProviderUserKey)) { model.IsViewingSelf = true; } else { var ucon = new UserConnection(); ucon.GetUserToUserConnection(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID); model.UserConnectionID = ucon.UserConnectionID; if (BlockedUser.IsBlockedUser(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID)) { return RedirectToAction("index", "home"); } } } else { if (uad.MembersOnlyProfile) { return RedirectToAction("LogOn", "Account"); } } ViewBag.ThumbIcon = uad.FullProfilePicURL; SetModelForUserAccount(model, uad); // var su = new StatusUpdate(); su.GetMostRecentUserStatus(_ua.UserAccountID); if (su.StatusUpdateID > 0) { model.LastStatusUpdate = su.CreateDate; model.MostRecentStatusUpdate = su.Message; } model.ProfileVisitorCount = ProfileLog.GetUniqueProfileVisitorCount(_ua.UserAccountID); GetUserPhotos(model); GetUserNews(model); model.MetaDescription = _ua.UserName + " " + Messages.Profile + " " + FromDate.DateToYYYY_MM_DD(_ua.LastActivityDate); GetUserPlaylist(); ForumThreads(_ua.UserAccountID, model); if (uad.UserAccountID > 0) { model.Birthday = uad.BirthDate; if (uad.ShowOnMapLegal) { // because of the foreign cultures, numbers need to stay in the English version unless a javascript encoding could be added string currentLang = Utilities.GetCurrentLanguageCode(); Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString()); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString()); model.DisplayOnMap = uad.ShowOnMapLegal; var rnd = new Random(); int offset = rnd.Next(10, 100); SiteStructs.LatLong latlong = GeoData.GetLatLongForCountryPostal(uad.Country, uad.PostalCode); if (latlong.latitude != 0 && latlong.longitude != 0) { model.Latitude = Convert.ToDecimal(latlong.latitude + Convert.ToDouble("0.00" + offset)) .ToString(CultureInfo.InvariantCulture); model.Longitude = Convert.ToDecimal(latlong.longitude + Convert.ToDouble("0.00" + offset)) .ToString(CultureInfo.InvariantCulture); } else { model.DisplayOnMap = false; } Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(currentLang); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(currentLang); } ViewBag.ThumbIcon = uad.FullProfilePicThumbURL; LoadCurrentImagesViewBag(uad.UserAccountID); } ViewBag.UserAccountDetail = uad; ViewBag.UserAccount = _ua; GetUserContacts(model); UserAccountDetail uadLooker = null; if (_mu != null) { uadLooker = new UserAccountDetail(); uadLooker.GetUserAccountDeailForUser(Convert.ToInt32(_mu.ProviderUserKey)); } if (uadLooker != null && (_mu != null && _ua.UserAccountID > 0 && uadLooker.EnableProfileLogging && uad.EnableProfileLogging)) { var pl = new ProfileLog { LookedAtUserAccountID = _ua.UserAccountID, LookingUserAccountID = Convert.ToInt32(_mu.ProviderUserKey) }; if (pl.LookingUserAccountID != pl.LookedAtUserAccountID) pl.Create(); ArrayList al = ProfileLog.GetRecentProfileViews(_ua.UserAccountID); if (al != null && al.Count > 0) { var uas = new UserAccounts(); foreach (UserAccount viewwer in al.Cast<int>().Select(id => new UserAccount(id)) .Where(viewwer => !viewwer.IsLockedOut && viewwer.IsApproved) .TakeWhile(viewwer => uas.Count < Maxcountusers)) { uas.Add(viewwer); } } } GetUserAccountVideos(); // this is either a youtube user or this is a band var art = new Artist(); art.GetArtistByAltname(userName); if (art.ArtistID > 0) { // try this way for dashers model.UserName = art.Name; } var vids = new Videos(); var sngrs = new SongRecords(); if (art.ArtistID == 0) { vids.GetAllVideosByUser(userName); var uavs = new UserAccountVideos(); uavs.GetRecentUserAccountVideos(_ua.UserAccountID, 'U'); foreach (Video f2 in uavs.Select(uav1 => new Video(uav1.VideoID)).Where(f2 => !vids.Contains(f2))) { vids.Add(f2); } vids.Sort((x, y) => (y.PublishDate.CompareTo(x.PublishDate))); model.UserName = _ua != null ? _ua.UserName : userName; } else { GetArtistProfile(art, vids); } vids.Sort((p1, p2) => p2.PublishDate.CompareTo(p1.PublishDate)); sngrs.AddRange(vids.Select(v1 => new SongRecord(v1))); if (_mu != null && _ua.UserAccountID != Convert.ToInt32(_mu.ProviderUserKey)) { var uc1 = new UserConnection(); uc1.GetUserToUserConnection(_ua.UserAccountID, Convert.ToInt32(_mu.ProviderUserKey)); if (uc1.UserConnectionID > 0) { switch (uc1.StatusType) { case 'C': if (uc1.IsConfirmed) { model.IsCyberFriend = true; } else { model.IsWatingToBeCyberFriend = true; } break; case 'R': if (uc1.IsConfirmed) { model.IsRealFriend = true; } else { model.IsWatingToBeRealFriend = true; } break; default: model.IsDeniedCyberFriend = true; model.IsDeniedRealFriend = true; break; } } } if (sngrs.Count == 0 && art.ArtistID == 0 && _ua.UserAccountID == 0) { // no longer exists Response.RedirectPermanent("/"); return new EmptyResult(); } var sngDisplay = new SongRecords(); sngDisplay.AddRange(from sr1 in sngrs let vidToShow = new Video(sr1.VideoID) where vidToShow.IsEnabled select sr1); model.SongRecords = sngDisplay.VideosList(); return View(model); }
public ActionResult Index() { // CONTESTS Contest cndss = Contest.GetCurrentContest(); ContestVideos cvids = new ContestVideos(); Videos vidsInContest = new Videos(); BootBaronLib.AppSpec.DasKlub.BOL.Video vid2 = null; foreach (ContestVideo cv1 in cvids) { vid2 = new BootBaronLib.AppSpec.DasKlub.BOL.Video(cv1.VideoID); vidsInContest.Add(vid2); } vidsInContest.Sort(delegate(BootBaronLib.AppSpec.DasKlub.BOL.Video p1, BootBaronLib.AppSpec.DasKlub.BOL.Video p2) { return p2.PublishDate.CompareTo(p1.PublishDate); }); SongRecords sngrcds3 = new SongRecords(); SongRecord sng3 = new SongRecord(); foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in vidsInContest) { sng3 = new SongRecord(v1); sngrcds3.Add(sng3); } ViewBag.ContestVideoList = sngrcds3.VideosList(); ViewBag.CurrentContest = cndss; // PhotoItems pitms = new PhotoItems(); pitms.UseThumb = true; pitms.ShowTitle = false; pitms.GetPhotoItemsPageWise(1, 4); ViewBag.PhotoList = pitms.ToUnorderdList; Contents cnts = new Contents(); cnts.GetContentPageWiseAll(1, 3); ViewBag.RecentArticles = cnts.ToUnorderdList; UserAccounts uas = new UserAccounts(); uas.GetNewestUsers(); ViewBag.NewestUsers = uas.ToUnorderdList; Videos newestVideos = new Videos(); newestVideos.GetMostRecentVideos(); SongRecords newSongs = new SongRecords(); SongRecord sng1 = null; foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in newestVideos) { sng1 = new SongRecord(v1); newSongs.Add(sng1); } ViewBag.NewestVideos = newSongs.VideosList(); BootBaronLib.AppSpec.DasKlub.BOL.Video vid = new BootBaronLib.AppSpec.DasKlub.BOL.Video(BootBaronLib.AppSpec.DasKlub.BOL.Video.RandomVideoIDVideo()); ViewBag.RandomVideoKey = vid.ProviderKey; ///video submit MultiProperties addList = null; PropertyType propTyp = null; MultiProperties mps = null; // video typesa propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.DisplayName.CompareTo(p2.DisplayName); }); ViewBag.VideoTypes = mps; // person types propTyp = new PropertyType(SiteEnums.PropertyTypeCode.HUMAN); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.DisplayName.CompareTo(p2.DisplayName); }); ViewBag.PersonTypes = mps; //// footage types propTyp = new PropertyType(SiteEnums.PropertyTypeCode.FOOTG); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.DisplayName.CompareTo(p2.DisplayName); }); addList = new MultiProperties(); ViewBag.FootageTypes = mps; return View(); }
public ActionResult ProfileDetail(string userName) { ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277; ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400; ua = new UserAccount(userName); UserAccountDetail uad = new UserAccountDetail(); uad.GetUserAccountDeailForUser(ua.UserAccountID); uad.BandsSeen = ContentLinker.InsertBandLinks(uad.BandsSeen, false); uad.BandsToSee = ContentLinker.InsertBandLinks(uad.BandsToSee, false); MembershipUser mu = Membership.GetUser(); ProfileModel model = new ProfileModel(); if (ua.UserAccountID > 0) { model.UserAccountID = ua.UserAccountID; model.PhotoCount = PhotoItems.GetPhotoItemCountForUser(ua.UserAccountID); model.CreateDate = ua.CreateDate; } if (mu != null) { ViewBag.IsBlocked = BlockedUser.IsBlockedUser(ua.UserAccountID, Convert.ToInt32(mu.ProviderUserKey)); ViewBag.IsBlocking = BlockedUser.IsBlockedUser(Convert.ToInt32(mu.ProviderUserKey), ua.UserAccountID); if (ua.UserAccountID == Convert.ToInt32(mu.ProviderUserKey)) { model.IsViewingSelf = true; } else { UserConnection ucon = new UserConnection(); ucon.GetUserToUserConnection(Convert.ToInt32(mu.ProviderUserKey), ua.UserAccountID); model.UserConnectionID = ucon.UserConnectionID; if (BlockedUser.IsBlockedUser(Convert.ToInt32(mu.ProviderUserKey), ua.UserAccountID)) { return RedirectToAction("index", "home"); } } } else { if (uad.MembersOnlyProfile) { return RedirectToAction("Account", "LogOn"); } } // model.UserName = ua.UserName; model.CreateDate = ua.CreateDate; model.LastActivityDate = ua.LastActivityDate; // model.DisplayAge = uad.DisplayAge; model.Age = uad.YearsOld; model.BandsSeen = uad.BandsSeen; model.BandsToSee = uad.BandsToSee; model.HardwareAndSoftwareSkills = uad.HardwareSoftware; model.MessageToTheWorld = uad.AboutDescription; model.YouAreFull = uad.Sex; model.InterestedInFull = uad.InterestedFull; model.RelationshipStatusFull = uad.RelationshipStatusFull ; model.RelationshipStatus = uad.RelationshipStatus; model.InterestedIn = uad.InterestedIn; model.YouAre = uad.YouAre; model.Website = uad.ExternalURL; model.CountryCode = uad.Country; model.CountryName = uad.CountryName; model.IsBirthday = uad.IsBirthdayToday; model.ProfilePhotoMain = uad.FullProfilePicURL; model.ProfilePhotoMainThumb = uad.FullProfilePicThumbURL; model.DefaultLanguage = uad.DefaultLanguage; model.EnableProfileLogging = uad.EnableProfileLogging; model.Handed = uad.HandedFull; model.RoleIcon = uad.SiteBages; // StatusUpdate su = new StatusUpdate(); su.GetMostRecentUserStatus(ua.UserAccountID); if (su.StatusUpdateID > 0) { model.LastStatusUpdate = su.CreateDate; model.MostRecentStatusUpdate = su.Message; } model.ProfileVisitorCount = ProfileLog.GetUniqueProfileVisitorCount(ua.UserAccountID); PhotoItems ptiems = new PhotoItems(); ptiems.GetUserPhotos(ua.UserAccountID); if (ptiems.Count > 0) { ptiems.Sort((PhotoItem x, PhotoItem y) => (y.CreateDate.CompareTo(x.CreateDate))); PhotoItems ptiemsDisplay = new PhotoItems(); int maxPhotos = 8; foreach (PhotoItem pitm1 in ptiems) { pitm1.UseThumb = true; if (ptiemsDisplay.Count < maxPhotos) { ptiemsDisplay.Add(pitm1); } else break; } ptiemsDisplay.UseThumb = true; ptiemsDisplay.ShowTitle = false; model.HasMoreThanMaxPhotos = (ptiems.Count > maxPhotos); ptiemsDisplay.IsUserPhoto = true; model.PhotoItems = ptiemsDisplay.ToUnorderdList; } Contents conts = new Contents(); conts.GetContentForUser(ua.UserAccountID); model.NewsCount = conts.Count; if (conts.Count > 0) { conts.Sort((Content x, Content y) => (y.ReleaseDate.CompareTo(x.ReleaseDate))); Contents displayContents = new Contents(); int maxCont = 1; int currentCount = 0; foreach (Content ccn1 in conts) { currentCount++; if (maxCont >= currentCount) { displayContents.Add(ccn1); } else break; } displayContents.IncludeStartAndEndTags = false; model.NewsArticles = displayContents.ToUnorderdList; } model.MetaDescription = ua.UserName + " " + BootBaronLib.Resources.Messages.Profile + " " + FromDate.DateToYYYY_MM_DD(ua.LastActivityDate); // playlist BootBaronLib.AppSpec.DasKlub.BOL.Playlist plyst = new Playlist(); plyst.GetUserPlaylist(ua.UserAccountID); if (plyst.PlaylistID > 0 && PlaylistVideos.GetCountOfVideosInPlaylist(plyst.PlaylistID) > 0) { ViewBag.AutoPlay = plyst.AutoPlay; ViewBag.AutoPlayNumber = (plyst.AutoPlay) ? 1 : 0; ViewBag.UserPlaylistID = plyst.PlaylistID; } if (uad.UserAccountID > 0) { model.Birthday = uad.BirthDate; if (uad.ShowOnMapLegal) { byte[] myarray2 = Encoding.Unicode.GetBytes(string.Empty); // because of the foreign cultures, numbers need to stay in the English version unless a javascript encoding could be added string currentLang = Utilities.GetCurrentLanguageCode(); Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString()); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString()); Encoding iso = Encoding.GetEncoding("ISO-8859-1"); Encoding utf8 = Encoding.UTF8; model.DisplayOnMap = uad.ShowOnMapLegal; Random rnd = new Random(); int offset = rnd.Next(10, 100); SiteStructs.LatLong latlong = GeoData.GetLatLongForCountryPostal(uad.Country, uad.PostalCode); if (latlong.latitude != 0 && latlong.longitude != 0) { model.Latitude = Convert.ToDecimal(latlong.latitude + Convert.ToDouble("0.00" + offset)).ToString(); model.Longitude = Convert.ToDecimal(latlong.longitude + Convert.ToDouble("0.00" + offset)).ToString(); } else { model.DisplayOnMap = false; } Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(currentLang); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(currentLang); } ViewBag.ThumbIcon = uad.FullProfilePicThumbURL; LoadCurrentImagesViewBag(uad.UserAccountID); } ViewBag.UserAccountDetail = uad; ViewBag.UserAccount = ua; UserConnections ucons = new UserConnections(); ucons.GetUserConnections(ua.UserAccountID); ucons.Shuffle(); UserAccounts irlContacts = new UserAccounts(); UserAccounts CyberAssociates = new UserAccounts(); UserAccount userCon = null; foreach (UserConnection uc1 in ucons) { if (!uc1.IsConfirmed) continue; switch (uc1.StatusType) { case 'C': if (CyberAssociates.Count >= maxcountusers) continue; if (uc1.ToUserAccountID != ua.UserAccountID) { userCon = new UserAccount(uc1.ToUserAccountID); } else { userCon = new UserAccount(uc1.FromUserAccountID); } CyberAssociates.Add(userCon); break; case 'R': if (irlContacts.Count >= maxcountusers) continue; if (uc1.ToUserAccountID != ua.UserAccountID) { userCon = new UserAccount(uc1.ToUserAccountID); } else { userCon = new UserAccount(uc1.FromUserAccountID); } irlContacts.Add(userCon); break; default: break; } } if (irlContacts.Count > 0) { model.IRLFriendCount = irlContacts.Count; } if (CyberAssociates.Count > 0) { // ViewBag.CyberAssociatesCount = Convert.ToString( CyberAssociates.Count ); model.CyberFriendCount = CyberAssociates.Count; } mu = Membership.GetUser(); UserAccountDetail uadLooker = null; if (mu != null) { uadLooker = new UserAccountDetail(); uadLooker.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey)); } if (mu != null && ua.UserAccountID > 0 && uadLooker.EnableProfileLogging && uad.EnableProfileLogging) { ProfileLog pl = new ProfileLog(); pl.LookedAtUserAccountID = ua.UserAccountID; pl.LookingUserAccountID = Convert.ToInt32(mu.ProviderUserKey); if (pl.LookingUserAccountID != pl.LookedAtUserAccountID) pl.Create(); ArrayList al = ProfileLog.GetRecentProfileViews(ua.UserAccountID); if (al != null && al.Count > 0) { UserAccounts uas = new UserAccounts(); UserAccount viewwer = null; foreach (int ID in al) { viewwer = new UserAccount(ID); if (!viewwer.IsLockedOut && viewwer.IsApproved) { if (uas.Count >= maxcountusers) break; uas.Add(viewwer); } } // model.ViewingUsers = uas.ToUnorderdList; } } UserAccountVideos uavs = null; if (ua.UserAccountID > 0) { uavs = new UserAccountVideos(); uavs.GetRecentUserAccountVideos(ua.UserAccountID, 'F'); if (uavs.Count > 0) { Videos favvids = new Videos(); Video f1 = new Video(); foreach (UserAccountVideo uav1 in uavs) { f1 = new Video(uav1.VideoID); if (f1.IsEnabled) favvids.Add(f1); } SongRecord sng1 = null; SongRecords sngrcds2 = new SongRecords(); foreach (Video v1 in favvids) { sng1 = new SongRecord(v1); sngrcds2.Add(sng1); } sngrcds2.IsUserSelected = true; ViewBag.UserFavorites = sngrcds2.VideosList();//.ListOfVideos(); } } // this is either a youtube user or this is a band Artist art = new Artist( ); art.GetArtistByAltname(userName); if (art.ArtistID > 0) { // try this way for dashers model.UserName = art.Name; } Videos vids = new Videos(); SongRecords sngrs = new SongRecords(); if (art.ArtistID == 0) { vids.GetAllVideosByUser(userName); uavs = new UserAccountVideos(); uavs.GetRecentUserAccountVideos(ua.UserAccountID, 'U'); Video f2 = null; foreach (UserAccountVideo uav1 in uavs) { f2 = new Video(uav1.VideoID); if (!vids.Contains(f2)) vids.Add(f2); } vids.Sort((Video x, Video y) => (y.PublishDate.CompareTo(x.PublishDate))); model.UserName = userName; } else { // photo ArtistProperty aprop = new ArtistProperty(); aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.PH.ToString()); if (!string.IsNullOrEmpty(aprop.PropertyContent)) { ViewBag.ArtistPhoto = System.Web.VirtualPathUtility.ToAbsolute(aprop.PropertyContent); ViewBag.ThumbIcon = System.Web.VirtualPathUtility.ToAbsolute(aprop.PropertyContent); } // meta descriptione aprop = new ArtistProperty(); aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.MD.ToString()); if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.MetaDescription = aprop.PropertyContent; // description aprop = new ArtistProperty(); aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.LD.ToString()); if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.ArtistDescription = ContentLinker.InsertBandLinks(aprop.PropertyContent, false); #region rss ///// rss //RssResources rssrs = new RssResources(); //rssrs.GetArtistRssResource(art.ArtistID); //if (rssrs.Count > 0) //{ // RssItems ritems = new RssItems(); // RssItems ritemsOUT = new RssItems(); // foreach (RssResource rssre in rssrs) // { // ritems.GetTopRssItemsForResource(rssre.RssResourceID); // //ritm = new RssItem(rssre..ArtistID); // } // ritems.Sort((RssItem x, RssItem y) => (y.PubDate.CompareTo(x.PubDate))); // foreach (RssItem ritm in ritems) // { // if (ritemsOUT.Count < 10) // { // ritemsOUT.Add(ritm); // } // } // ViewBag.ArtistNews = ritemsOUT.ToUnorderdList; //} //else //{ // ViewBag.ArtistNews = null; //} //ViewBag.DisplayName = art.DisplayName; #endregion Songs sngss = new Songs(); sngss.GetSongsForArtist(art.ArtistID); SongRecord snrcd = new SongRecord(); foreach (Song sn1 in sngss) { vids.GetVideosForSong(sn1.SongID); } } vids.Sort(delegate(Video p1, Video p2) { return p2.PublishDate.CompareTo(p1.PublishDate); }); foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in vids) { sngrs.Add(new SongRecord(v1)); } if (mu != null && ua.UserAccountID != Convert.ToInt32(mu.ProviderUserKey)) { UserConnection uc1 = new UserConnection(); uc1.GetUserToUserConnection(ua.UserAccountID, Convert.ToInt32(mu.ProviderUserKey)); if (uc1.UserConnectionID > 0) { switch (uc1.StatusType) { case 'C': if (uc1.IsConfirmed) { model.IsCyberFriend = true; } else { model.IsWatingToBeCyberFriend = true; } break; case 'R': if (uc1.IsConfirmed) { model.IsRealFriend = true; } else { model.IsWatingToBeRealFriend = true; } break; default: model.IsDeniedCyberFriend = true; model.IsDeniedRealFriend = true; break; } } } if (sngrs == null || sngrs.Count == 0 && art.ArtistID == 0 && ua.UserAccountID == 0) { // no longer exists Response.RedirectPermanent("/"); return new EmptyResult(); } //sngrs.Sort((SongRecord x, SongRecord y) => (y.cre.CompareTo(x.CreateDate))); SongRecords sngDisplay = new SongRecords(); Video vidToShow = null; foreach (SongRecord sr1 in sngrs) { vidToShow = new Video(sr1.VideoID); if (vidToShow.IsEnabled) { sngDisplay.Add(sr1); } } model.SongRecords = sngDisplay.VideosList(); return View(model); }