def safe_delete_stream(stream: IStream): if stream: from pyfastocloud_models.subscriber.entry import Subscriber subscribers = Subscriber.objects.all() for subscriber in subscribers: subscriber.remove_official_stream(stream) subscriber.remove_official_vod(stream) subscriber.remove_official_catchup(stream) for catchup in stream.parts: safe_delete_stream(catchup) stream.delete()
def remove_stream(self, stream: IStream): if stream: self.streams.remove(stream) stream.delete()