From 74af2f9fc60c54ee1f01d1c53a00514cf8d99bad Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sat, 7 Jan 2023 13:38:37 -0500 Subject: [PATCH] Implementing WebVideo duration and printing. --- app/VideoWeb/WebVideo.class.st | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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 }