Exemplo n.º 1
0
        public void Read()
        {
            VideoStreamResponse r = new VideoStreamResponse()
            {
                NextStart = 0
            };

            while (!r.EndOfVideos)
            {
                r = RequestVideoStream(r.NextStart);
                if (r == null || !(String.IsNullOrEmpty(r.Error)))
                {
                    //return on error
                    return;
                }
                else
                {
                    Videos.AddRange(r.VideoEntries);
                }

                if (!r.EndOfVideos)
                {
                    Thread.Sleep(CrawlUtil.GetVariableDelay(DelayBetweenAPIRequests));
                }
            }
        }
Exemplo n.º 2
0
        public void Load(IEnumerable <QueryResult> videos)
        {
            SelectedVideos.Clear();
            Videos.Clear();

            Videos.AddRange(videos.Select(_videoFactory.MakeMatchedVideoViewModel));
        }
Exemplo n.º 3
0
        private async Task LoadMovieVideosAsync(int movieId)
        {
            var movieVideos = await ApiService.GetMovieVideosAsync(movieId).ConfigureAwait(false);

            if (movieVideos != null)
            {
                Videos.AddRange(movieVideos.Results);
                HeightVideos = Videos.Count * HeightVideos;
            }
        }
        /// <summary>
        /// Raises the QueryPath event.
        /// </summary>
        private void RaiseQueryPath()
        {
            QueryPathEventArgs e = new QueryPathEventArgs()
            {
                Context = this.Context
            };

            QueryPath?.Invoke(this, e);

            if (!e.Cancel)
            {
                Videos.AddRange(e.TMDbDetails);
            }
        }
Exemplo n.º 5
0
        private void GetUserAccountVideos()
        {
            if (_ua.UserAccountID <= 0) return;

            var uavs = new UserAccountVideos();

            uavs.GetRecentUserAccountVideos(_ua.UserAccountID, 'F');

            if (uavs.Count <= 0) return;

            var favvids = new Videos();
            favvids.AddRange(uavs.Select(uav1 => new Video(uav1.VideoID)).Where(f1 => f1.IsEnabled));

            var sngrcds2 = new SongRecords();
            sngrcds2.AddRange(favvids.Select(v1 => new SongRecord(v1)));

            sngrcds2.IsUserSelected = true;

            ViewBag.UserFavorites = sngrcds2.VideosList();
        }
Exemplo n.º 6
0
        public ActionResult VideoVote()
        {
            Contest contest = Contest.GetLastContest();

            ViewBag.Contest = contest;

            if (_mu != null &&
                (ContestVideo.IsUserContestVoted(Convert.ToInt32(_mu.ProviderUserKey), contest.ContestID) &&
                 contest.DeadLine.AddHours(72) > DateTime.UtcNow))
            {
                LoadContestResults();

                return View();
            }

            var cvids = new ContestVideos();

            cvids.GetContestVideosForContest(contest.ContestID);

            var vidsInContest = new Videos();
            vidsInContest.AddRange(cvids.Select(cv1 => new Video(cv1.VideoID)));

            vidsInContest.Sort((p1, p2) => p1.PublishDate.CompareTo(p2.PublishDate));

            ViewBag.ContestVideos = vidsInContest;

            return View();
        }
Exemplo n.º 7
0
        public ActionResult Playlist()
        {
            ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277;
            ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400;

            if (_mu != null) _ua = new UserAccount(Convert.ToInt32(_mu.ProviderUserKey));

            ViewBag.UserName = _ua.UserName;

            var plyst = new Playlist();

            plyst.GetUserPlaylist(_ua.UserAccountID);

            ViewBag.AutoPlay = plyst.AutoPlay;

            ViewBag.AutoPlayNumber = (plyst.AutoPlay) ? 1 : 0;

            ViewBag.UserPlaylistID = plyst.PlaylistID;

            var plyvids = new PlaylistVideos();

            plyvids.GetPlaylistVideosForPlaylist(plyst.PlaylistID);

            var vids = new Videos();
            vids.AddRange(plyvids.Select(plv => new Video(plv.VideoID)));

            var sngrcs = new SongRecords();
            sngrcs.AddRange(vids.Select(vi => new SongRecord(vi)));

            ViewBag.PlaylistVideos = sngrcs.VideoPlaylist();

            return View();
        }
Exemplo n.º 8
0
        public ActionResult ManageVideos()
        {
            var uavs = new UserAccountVideos();
            if (_mu != null) uavs.GetVideosForUserAccount(Convert.ToInt32(_mu.ProviderUserKey), 'U');

            if (uavs.Count > 0)
            {
                var favvids = new Videos();
                favvids.AddRange(uavs.Select(uav1 => new Video(uav1.VideoID)).Where(f1 => f1.IsEnabled));

                var sngrcds2 = new SongRecords();
                sngrcds2.AddRange(favvids.Select(v1 => new SongRecord(v1)));

                sngrcds2.IsUserSelected = true;
                sngrcds2.EnableChangeOrder = false;

                ViewBag.UserUploaded = sngrcds2.VideoPlaylist();
            }

            return View(uavs);
        }
Exemplo n.º 9
0
        public ActionResult Index()
        {
            int randomVideo = Video.RandomVideoIDVideo();

            if (randomVideo > 0)
            {
                var randomVid = new Video(randomVideo);
                ViewBag.NewestVideo = randomVid.ProviderKey;
            }

            LoadUserBandViewBag();

            LoadFilteredVideos(false);

            Contest cndss = Lib.BOL.VideoContest.Contest.GetCurrentContest();
            var cvids = new ContestVideos();
            var vidsInContest = new Videos();
            vidsInContest.AddRange(cvids.Select(cv1 => new Video(cv1.VideoID)));
            vidsInContest.Sort((p1, p2) => p2.PublishDate.CompareTo(p1.PublishDate));
            var sngrcds3 = new SongRecords();
            sngrcds3.AddRange(vidsInContest.Select(v1 => new SongRecord(v1)));

            ViewBag.ContestVideoList = sngrcds3.VideosList();
            ViewBag.CurrentContest = cndss;
            ViewBag.VideoTypes = GetVideoTypes();
            ViewBag.PersonTypes = GetPersonTypes();
            ViewBag.FootageTypes = GetFootageTypes();

            return View();
        }