Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to specify a custom API server #197

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
{"id": "",
"name": ""
}
]
],
"api_server": "https://sponsor.ajay.app"
}
5 changes: 3 additions & 2 deletions src/iSponsorBlockTV/api_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(self, config, web_session: ClientSession) -> None:
self.skip_count_tracking = config.skip_count_tracking
self.web_session = web_session
self.num_devices = len(config.devices)
self.api_server = config.api_server

# Not used anymore, maybe it can stay here a little longer
@AsyncLRU(maxsize=10)
Expand Down Expand Up @@ -130,7 +131,7 @@ async def get_segments(self, vid_id):
"service": constants.SponsorBlock_service,
}
headers = {"Accept": "application/json"}
url = constants.SponsorBlock_api + "skipSegments/" + vid_id_hashed
url = self.api_server + "/api/skipSegments/" + vid_id_hashed
async with self.web_session.get(
url, headers=headers, params=params
) as response:
Expand Down Expand Up @@ -201,7 +202,7 @@ async def mark_viewed_segments(self, uuids):
Lets the contributor know that someone skipped the segment (thanks)"""
if self.skip_count_tracking:
for i in uuids:
url = constants.SponsorBlock_api + "viewedVideoSponsorTime/"
url = self.api_server + "/api/viewedVideoSponsorTime/"
params = {"UUID": i}
await self.web_session.post(url, params=params)

Expand Down
Loading
Loading