mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 20:00:15 +00:00
extend unsubscribe for channels and playlists
This commit is contained in:
parent
407325e0a9
commit
2ebd0a3e2f
@ -423,7 +423,6 @@ class PlaylistSubscription:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# update subscribed status
|
# update subscribed status
|
||||||
print(f"changing status of {playlist_id} to {subscribe_status}")
|
|
||||||
headers = {"Content-type": "application/json"}
|
headers = {"Content-type": "application/json"}
|
||||||
url = f"{es_url}/ta_playlist/_update/{playlist_id}"
|
url = f"{es_url}/ta_playlist/_update/{playlist_id}"
|
||||||
payload = json.dumps(
|
payload = json.dumps(
|
||||||
|
@ -27,7 +27,11 @@ from home.forms import (
|
|||||||
VideoSearchForm,
|
VideoSearchForm,
|
||||||
)
|
)
|
||||||
from home.src.config import AppConfig
|
from home.src.config import AppConfig
|
||||||
from home.src.download import ChannelSubscription, PendingList
|
from home.src.download import (
|
||||||
|
ChannelSubscription,
|
||||||
|
PendingList,
|
||||||
|
PlaylistSubscription,
|
||||||
|
)
|
||||||
from home.src.helper import RedisArchivist, RedisQueue, UrlListParser
|
from home.src.helper import RedisArchivist, RedisQueue, UrlListParser
|
||||||
from home.src.index import (
|
from home.src.index import (
|
||||||
WatchState,
|
WatchState,
|
||||||
@ -1077,12 +1081,24 @@ class PostData:
|
|||||||
return {"success": True}
|
return {"success": True}
|
||||||
|
|
||||||
def unsubscribe(self):
|
def unsubscribe(self):
|
||||||
"""unsubscribe from channel"""
|
"""unsubscribe from channels or playlists"""
|
||||||
channel_id_unsub = self.exec_val
|
id_unsub = self.exec_val
|
||||||
print("unsubscribe from " + channel_id_unsub)
|
print("unsubscribe from " + id_unsub)
|
||||||
ChannelSubscription().change_subscribe(
|
to_unsub_list = UrlListParser(id_unsub).process_list()
|
||||||
channel_id_unsub, channel_subscribed=False
|
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}
|
return {"success": True}
|
||||||
|
|
||||||
def sort_order(self):
|
def sort_order(self):
|
||||||
|
@ -45,10 +45,10 @@ function isUnwatched(youtube_id) {
|
|||||||
document.getElementById(youtube_id).replaceWith(unseenIcon);
|
document.getElementById(youtube_id).replaceWith(unseenIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
function unsubscribe(channel_id) {
|
function unsubscribe(id_unsub) {
|
||||||
var payload = JSON.stringify({'unsubscribe': channel_id});
|
var payload = JSON.stringify({'unsubscribe': id_unsub});
|
||||||
sendPost(payload);
|
sendPost(payload);
|
||||||
document.getElementById(channel_id).remove();
|
document.getElementById(id_unsub).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeView(image) {
|
function changeView(image) {
|
||||||
|
Loading…
Reference in New Issue
Block a user