mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-19 15:25:51 +00:00
fix sponsorblock segments parser, #397
This commit is contained in:
parent
14e0429758
commit
34ed6ebc63
@ -73,20 +73,14 @@ class SponsorBlock:
|
|||||||
|
|
||||||
def _get_sponsor_dict(self, all_segments):
|
def _get_sponsor_dict(self, all_segments):
|
||||||
"""format and process response"""
|
"""format and process response"""
|
||||||
has_unlocked = False
|
_ = [i.pop("description", None) for i in all_segments]
|
||||||
cleaned_segments = []
|
has_unlocked = not any(i.get("locked") for i in all_segments)
|
||||||
for segment in all_segments:
|
|
||||||
if not segment["locked"]:
|
|
||||||
has_unlocked = True
|
|
||||||
del segment["userID"]
|
|
||||||
del segment["description"]
|
|
||||||
cleaned_segments.append(segment)
|
|
||||||
|
|
||||||
sponsor_dict = {
|
sponsor_dict = {
|
||||||
"last_refresh": self.last_refresh,
|
"last_refresh": self.last_refresh,
|
||||||
"has_unlocked": has_unlocked,
|
"has_unlocked": has_unlocked,
|
||||||
"is_enabled": True,
|
"is_enabled": True,
|
||||||
"segments": cleaned_segments,
|
"segments": all_segments,
|
||||||
}
|
}
|
||||||
return sponsor_dict
|
return sponsor_dict
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user