37 lines
1.0 KiB
Plaintext
37 lines
1.0 KiB
Plaintext
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
|
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
|
|
|
@job("ChannelContentJob")
|
|
function ExecuteJob() as void
|
|
input = JobGetInput()
|
|
contentNode = input.content
|
|
invidiousNode = input.invidious
|
|
|
|
if JobIsCancelled()
|
|
contentNode.loadState = FeedLoadState.None
|
|
JobCancel()
|
|
return
|
|
end if
|
|
|
|
service = new Invidious.InvidiousService(invidiousNode)
|
|
cancellation = JobGetCancellation()
|
|
response = service.GetChannel(contentNode.authorId, cancellation)
|
|
|
|
if JobIsCancelled()
|
|
contentNode.loadState = FeedLoadState.None
|
|
JobCancel()
|
|
return
|
|
end if
|
|
|
|
metadata = response.Json()
|
|
|
|
if not response.IsSuccess() or metadata = invalid
|
|
contentNode.loadState = FeedLoadState.Error
|
|
JobError(response.ErrorMessage())
|
|
return
|
|
end if
|
|
|
|
InvidiousContent.ToChannelContentNode(contentNode, metadata)
|
|
contentNode.loadState = FeedLoadState.Loaded
|
|
end function
|