예제 #1
0
        public static UserVideoDto VideoEntity2VideoDTO(this USER_Videos video, int userId, int uses)
        {
            if (video == null)
            {
                return new UserVideoDto {
                           userId = userId
                }
            }
            ;


            var token = new UserVideoDto
            {
                userId       = userId
                , identifier = video.BcIdentifier.ToString()
                , bcid       = video.BcIdentifier.ToString()
                , name       = video.Name
                , title      = video.ShortDescription
                , views      = video.PlaysTotal
                , uses       = uses
                , duration   = video.Length.VideoLength2Duration()
                , minutes    = video.Length.VideoLength2Duration().Duration2HoursString()
                , thumbUrl   = video.BcIdentifier.CombimeVideoUrl(userId, CommonEnums.eVideoPictureTypes.Thumb).ToCloudfrontSignedUrl()
                , stillUrl   = video.BcIdentifier.CombimeVideoUrl(userId, CommonEnums.eVideoPictureTypes.Still).ToCloudfrontSignedUrl()
                , addon      = video.CreationDate
                , tags       = string.IsNullOrEmpty(video.Tags) ? new string[0] : video.Tags.Split(Convert.ToChar(","))
                , millisec   = video.Length
                , status     = ImportJobsEnums.eFileInterfaceStatus.Transferred
            };

            token.tagsStr = token.tags.StringsList2String();

            return(token);
        }
예제 #2
0
 public static VideoDTO UserVideoEntity2UserVideoDto(this USER_Videos entity, Users user)
 {
     return(new VideoDTO
     {
         user = new BaseUserInfoDTO
         {
             UserId = user.Id
             , FullName = user.Entity2FullName()
         }
         , videoId = entity.VideoId
         , identifier = entity.BcIdentifier
         , name = entity.Name
         , inUse = entity.Attached2Chapter
         , addon = entity.CreationDate
         , duration = entity.Duration
         , thumb = entity.ThumbUrl
     });
 }