Exemple #1
0
        public bool IsVideoPlayed(VideoId videoId, out VideoPlayHistoryEntry history)
        {
            var entry = _collection.FindById(videoId.ToString());

            history = entry;
            return(entry?.PlayCount > 0);
        }
Exemple #2
0
 public NicoVideo Get(VideoId videoId)
 {
     return(_collection
            .Include(x => x.Owner)
            .FindById(videoId.ToString())
            ?? new NicoVideo()
     {
         Id = videoId
     });
 }
Exemple #3
0
        public async Task <IActionResult> REDIR(string id, string prefix)
        {
            try{
                VideoId v     = id;
                string  newid = v.ToString();

                return(Redirect(prefix + newid));
            }catch (Exception)
            {
                return(NotFound("nope not avail"));
            }
        }
Exemple #4
0
        public VideoPlayHistoryEntry VideoPlayedIfNotWatched(VideoId videoId, TimeSpan playedPosition)
        {
            var history = _collection.FindById(videoId.ToString());

            if (history != null)
            {
                return(history);
            }
            else
            {
                history = new VideoPlayHistoryEntry
                {
                    VideoId            = videoId,
                    PlayCount          = 1,
                    LastPlayed         = DateTime.Now,
                    LastPlayedPosition = playedPosition
                };
            }

            _collection.Upsert(history);

            return(history);
        }
Exemple #5
0
            public bool ExistPlaylistItem(string playlistId, VideoId videoId)
            {
                var videoIdStr = videoId.ToString();

                return(_collection.Exists(x => x.PlaylistId == playlistId && x.ContentId == videoIdStr));
            }
Exemple #6
0
            public bool DeletePlaylistItem(string playlistId, VideoId contentId)
            {
                var strId = contentId.ToString();

                return(_collection.DeleteMany(x => x.PlaylistId == playlistId && x.ContentId == strId) > 0);
            }
Exemple #7
0
 public bool IsVideoPlayed(VideoId videoId)
 {
     return(_collection.FindById(videoId.ToString())?.PlayCount > 0);
 }
Exemple #8
0
 public VideoPlayHistoryEntry Get(VideoId videoId)
 {
     return(_collection.FindById(videoId.ToString()));
 }
Exemple #9
0
 public string GetNameFor(VideoId videoId) => videoId.ToString();