Implementing WebVideo duration and printing.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-01-07 13:38:37 -05:00
parent 10717232c2
commit 74af2f9fc6

View File

@ -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 }