Adding instance monitoring information.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-12-29 10:13:54 -05:00
parent 510fdb03e4
commit 873a5cd609

View File

@ -7,11 +7,17 @@ Class {
#instVars : [
'uri',
'region',
'api'
'api',
'monitor'
],
#category : #VideoWeb
}
{ #category : #accessing }
Invidious class >> defaultInstance [
^ self instances select: [ :instance | instance api = true ]
]
{ #category : #accessing }
Invidious class >> instances [
@ -36,16 +42,33 @@ Invidious >> api: booleanValue [
{ #category : #accessing }
Invidious >> fromDictionary: aDictionary [
| rawMonitor|
self
uri: (aDictionary at: 'uri');
region: (aDictionary at: 'region');
api: (aDictionary at: 'api')
api: (aDictionary at: 'api').
rawMonitor := aDictionary at: 'monitor'.
rawMonitor ifNil: [ ^ self ].
self monitor
at: '90DaysRatio' put: ((aDictionary at: 'monitor' at: '90dRatio') at: 'ratio');
at: '30DaysRatio' put: ((aDictionary at: 'monitor' at: '30dRatio') at: 'ratio');
yourself.
]
{ #category : #accessing }
Invidious >> monitor [
^ monitor ifNil: [ monitor := Dictionary new]
]
{ #category : #accessing }
Invidious >> monitor: aDictionary [
monitor := aDictionary
]
{ #category : #accessing }
Invidious >> printOn: aStream [
super printOn: aStream.
^ aStream nextPutAll: ' ( ', self uri asString, ' | ', self region, ' ) '
^ aStream nextPutAll: ' ( ', self uri asString, ' | ', self region, ' | ', (self monitor at: '90DaysRatio'), '% ) '
]
{ #category : #accessing }