mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-19 15:25:51 +00:00
remove legacy process subscribe methods
This commit is contained in:
parent
076452c612
commit
2bccb698e6
@ -4,14 +4,9 @@ Functionality:
|
|||||||
- called via user input
|
- called via user input
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from home.src.download.subscriptions import (
|
|
||||||
ChannelSubscription,
|
|
||||||
PlaylistSubscription,
|
|
||||||
)
|
|
||||||
from home.src.index.playlist import YoutubePlaylist
|
from home.src.index.playlist import YoutubePlaylist
|
||||||
from home.src.ta.ta_redis import RedisArchivist
|
from home.src.ta.ta_redis import RedisArchivist
|
||||||
from home.src.ta.urlparser import Parser
|
from home.tasks import run_restore_backup
|
||||||
from home.tasks import run_restore_backup, subscribe_to
|
|
||||||
|
|
||||||
|
|
||||||
class PostData:
|
class PostData:
|
||||||
@ -36,8 +31,6 @@ class PostData:
|
|||||||
exec_map = {
|
exec_map = {
|
||||||
"change_view": self._change_view,
|
"change_view": self._change_view,
|
||||||
"change_grid": self._change_grid,
|
"change_grid": self._change_grid,
|
||||||
"unsubscribe": self._unsubscribe,
|
|
||||||
"subscribe": self._subscribe,
|
|
||||||
"sort_order": self._sort_order,
|
"sort_order": self._sort_order,
|
||||||
"hide_watched": self._hide_watched,
|
"hide_watched": self._hide_watched,
|
||||||
"show_subed_only": self._show_subed_only,
|
"show_subed_only": self._show_subed_only,
|
||||||
@ -67,34 +60,6 @@ class PostData:
|
|||||||
RedisArchivist().set_message(key, {"status": grid_items})
|
RedisArchivist().set_message(key, {"status": grid_items})
|
||||||
return {"success": True}
|
return {"success": True}
|
||||||
|
|
||||||
def _unsubscribe(self):
|
|
||||||
"""unsubscribe from channels or playlists"""
|
|
||||||
id_unsub = self.exec_val
|
|
||||||
print(f"{id_unsub}: unsubscribe")
|
|
||||||
to_unsub_list = Parser(id_unsub).parse()
|
|
||||||
for to_unsub in to_unsub_list:
|
|
||||||
unsub_type = to_unsub["type"]
|
|
||||||
unsub_id = to_unsub["url"]
|
|
||||||
if unsub_type == "playlist":
|
|
||||||
PlaylistSubscription().change_subscribe(
|
|
||||||
unsub_id, subscribe_status=False
|
|
||||||
)
|
|
||||||
elif unsub_type == "channel":
|
|
||||||
ChannelSubscription().change_subscribe(
|
|
||||||
unsub_id, channel_subscribed=False
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
raise ValueError("failed to process " + id_unsub)
|
|
||||||
|
|
||||||
return {"success": True}
|
|
||||||
|
|
||||||
def _subscribe(self):
|
|
||||||
"""subscribe to channel or playlist, called from js buttons"""
|
|
||||||
id_sub = self.exec_val
|
|
||||||
print(f"{id_sub}: subscribe")
|
|
||||||
subscribe_to.delay(id_sub)
|
|
||||||
return {"success": True}
|
|
||||||
|
|
||||||
def _sort_order(self):
|
def _sort_order(self):
|
||||||
"""change the sort between published to downloaded"""
|
"""change the sort between published to downloaded"""
|
||||||
sort_order = {"status": self.exec_val}
|
sort_order = {"status": self.exec_val}
|
||||||
|
Loading…
Reference in New Issue
Block a user