mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-19 01:25:06 +00:00
Refactor: Remove unused stream deactivation and filtering methods from M3UAccount and M3UFilter classes
This commit is contained in:
parent
44b1b3b572
commit
2ef9ab0dcf
1 changed files with 0 additions and 31 deletions
|
|
@ -111,18 +111,6 @@ class M3UAccount(models.Model):
|
|||
def display_action(self):
|
||||
return "Exclude" if self.exclude else "Include"
|
||||
|
||||
def deactivate_streams(self):
|
||||
"""Deactivate all streams linked to this account."""
|
||||
for stream in self.streams.all():
|
||||
stream.is_active = False
|
||||
stream.save()
|
||||
|
||||
def reactivate_streams(self):
|
||||
"""Reactivate all streams linked to this account."""
|
||||
for stream in self.streams.all():
|
||||
stream.is_active = True
|
||||
stream.save()
|
||||
|
||||
@classmethod
|
||||
def get_custom_account(cls):
|
||||
return cls.objects.get(name=CUSTOM_M3U_ACCOUNT_NAME, locked=True)
|
||||
|
|
@ -205,25 +193,6 @@ class M3UFilter(models.Model):
|
|||
exclude_status = "Exclude" if self.exclude else "Include"
|
||||
return f"[{self.m3u_account.name}] {filter_type_display}: {self.regex_pattern} ({exclude_status})"
|
||||
|
||||
@staticmethod
|
||||
def filter_streams(streams, filters):
|
||||
included_streams = set()
|
||||
excluded_streams = set()
|
||||
|
||||
for f in filters:
|
||||
for stream in streams:
|
||||
if f.applies_to(stream.name, stream.group_name):
|
||||
if f.exclude:
|
||||
excluded_streams.add(stream)
|
||||
else:
|
||||
included_streams.add(stream)
|
||||
|
||||
# If no include filters exist, assume all non-excluded streams are valid
|
||||
if not any(not f.exclude for f in filters):
|
||||
return streams.exclude(id__in=[s.id for s in excluded_streams])
|
||||
|
||||
return streams.filter(id__in=[s.id for s in included_streams])
|
||||
|
||||
|
||||
class ServerGroup(models.Model):
|
||||
"""Represents a logical grouping of servers or channels."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue