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 : [ #instVars : [
'uri', 'uri',
'region', 'region',
'api' 'api',
'monitor'
], ],
#category : #VideoWeb #category : #VideoWeb
} }
{ #category : #accessing }
Invidious class >> defaultInstance [
^ self instances select: [ :instance | instance api = true ]
]
{ #category : #accessing } { #category : #accessing }
Invidious class >> instances [ Invidious class >> instances [
@ -36,16 +42,33 @@ Invidious >> api: booleanValue [
{ #category : #accessing } { #category : #accessing }
Invidious >> fromDictionary: aDictionary [ Invidious >> fromDictionary: aDictionary [
| rawMonitor|
self self
uri: (aDictionary at: 'uri'); uri: (aDictionary at: 'uri');
region: (aDictionary at: 'region'); 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 } { #category : #accessing }
Invidious >> printOn: aStream [ Invidious >> printOn: aStream [
super 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 } { #category : #accessing }