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

            history = entry;
            return(entry?.PlayCount > 0);
        }
コード例 #2
0
 public NicoVideo Get(VideoId videoId)
 {
     return(_collection
            .Include(x => x.Owner)
            .FindById(videoId.ToString())
            ?? new NicoVideo()
     {
         Id = videoId
     });
 }
コード例 #3
0
ファイル: YoutubeController.cs プロジェクト: tesses50/ytapic
        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"));
            }
        }
コード例 #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);
        }
コード例 #5
0
            public bool ExistPlaylistItem(string playlistId, VideoId videoId)
            {
                var videoIdStr = videoId.ToString();

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

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