mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-02 09:41:07 +00:00
add get_overwrites and set_overwrites methods for channel
This commit is contained in:
parent
8170d4913b
commit
026cc378fe
@ -39,6 +39,16 @@
|
|||||||
"channel_last_refresh": {
|
"channel_last_refresh": {
|
||||||
"type": "date",
|
"type": "date",
|
||||||
"format": "epoch_second"
|
"format": "epoch_second"
|
||||||
|
},
|
||||||
|
"channel_overwrites": {
|
||||||
|
"properties": {
|
||||||
|
"format": {
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
|
"autodelete_days": {
|
||||||
|
"type": "long"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"expected_set": {
|
"expected_set": {
|
||||||
@ -102,6 +112,16 @@
|
|||||||
"channel_last_refresh": {
|
"channel_last_refresh": {
|
||||||
"type": "date",
|
"type": "date",
|
||||||
"format": "epoch_second"
|
"format": "epoch_second"
|
||||||
|
},
|
||||||
|
"channel_overwrites": {
|
||||||
|
"properties": {
|
||||||
|
"format": {
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
|
"autodelete_days": {
|
||||||
|
"type": "long"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -267,3 +267,19 @@ class YoutubeChannel(YouTubeItem):
|
|||||||
}
|
}
|
||||||
all_playlists = IndexPaginate("ta_playlist", data).get_results()
|
all_playlists = IndexPaginate("ta_playlist", data).get_results()
|
||||||
return all_playlists
|
return all_playlists
|
||||||
|
|
||||||
|
def get_overwrites(self):
|
||||||
|
"""get all per channel overwrites"""
|
||||||
|
return self.json_data.get("channel_overwrites", False)
|
||||||
|
|
||||||
|
def set_overwrites(self, overwrites):
|
||||||
|
"""set per channel overwrites"""
|
||||||
|
valid_keys = ["format", "autodelete_days"]
|
||||||
|
for key in overwrites:
|
||||||
|
if key not in valid_keys:
|
||||||
|
raise ValueError(f"invalid overwrite key: {key}")
|
||||||
|
|
||||||
|
if "channel_overwrites" in self.json_data.keys():
|
||||||
|
self.json_data["channel_overwrites"].update(overwrites)
|
||||||
|
else:
|
||||||
|
self.json_data["channel_overwrites"] = overwrites
|
||||||
|
Loading…
Reference in New Issue
Block a user