diff --git a/app/VideoWeb/WebVideo.class.st b/app/VideoWeb/WebVideo.class.st index 3e383b2..8326a4c 100644 --- a/app/VideoWeb/WebVideo.class.st +++ b/app/VideoWeb/WebVideo.class.st @@ -34,6 +34,12 @@ WebVideo >> authorId: anObject [ authorId := anObject ] +{ #category : #accessing } +WebVideo >> defaultThumbnailLink [ + ^ (self videoThumbnails + detect: [ :thumbnail | (thumbnail at: 'quality') = 'high' ]) at: 'url' +] + { #category : #accessing } WebVideo >> description [ ^ description @@ -44,6 +50,12 @@ WebVideo >> description: anObject [ description := anObject ] +{ #category : #accessing } +WebVideo >> duration [ + ^ self lengthSeconds asInteger asDuration asString + "This is a new method" +] + { #category : #accessing } WebVideo >> fromDictionary: aDictionary [ ^ self author: (aDictionary at: 'author'); @@ -80,7 +92,15 @@ WebVideo >> likeCount: anObject [ WebVideo >> printOn: aStream [ super printOn: aStream. aStream - nextPutAll: '( ', self videoId, ' | ', self title, ' | ', self author, ' )' + nextPutAll: '( ', self videoId, ' | ', self title, ' | ', self duration,' | ', self author, ' )' +] + +{ #category : #accessing } +WebVideo >> thumbnail [ + + ^ SkiaImage + fromForm: (Form + fromBase64String: self defaultThumbnailLink asUrl retrieveContents base64Encoded) ] { #category : #accessing }