|
|
|
@ -332,7 +332,7 @@ class SubscriptionHandler:
|
|
|
|
|
self.task = task
|
|
|
|
|
self.to_subscribe = False
|
|
|
|
|
|
|
|
|
|
def subscribe(self):
|
|
|
|
|
def subscribe(self, expected_type=False):
|
|
|
|
|
"""subscribe to url_str items"""
|
|
|
|
|
if self.task:
|
|
|
|
|
self.task.send_progress(["Processing form content."])
|
|
|
|
@ -343,11 +343,16 @@ class SubscriptionHandler:
|
|
|
|
|
if self.task:
|
|
|
|
|
self._notify(idx, item, total)
|
|
|
|
|
|
|
|
|
|
self.subscribe_type(item)
|
|
|
|
|
self.subscribe_type(item, expected_type=expected_type)
|
|
|
|
|
|
|
|
|
|
def subscribe_type(self, item):
|
|
|
|
|
def subscribe_type(self, item, expected_type):
|
|
|
|
|
"""process single item"""
|
|
|
|
|
if item["type"] == "playlist":
|
|
|
|
|
if expected_type and expected_type != "playlist":
|
|
|
|
|
raise TypeError(
|
|
|
|
|
f"expected {expected_type} url but got {item.get('type')}"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
PlaylistSubscription().process_url_str([item])
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
@ -360,6 +365,11 @@ class SubscriptionHandler:
|
|
|
|
|
else:
|
|
|
|
|
raise ValueError("failed to subscribe to: " + item["url"])
|
|
|
|
|
|
|
|
|
|
if expected_type and expected_type != "channel":
|
|
|
|
|
raise TypeError(
|
|
|
|
|
f"expected {expected_type} url but got {item.get('type')}"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
self._subscribe(channel_id)
|
|
|
|
|
|
|
|
|
|
def _subscribe(self, channel_id):
|
|
|
|
|