MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / get_queryset

Method get_queryset

apps/channels/api_views.py:155–179  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

153 return [Authenticated()]
154
155 def get_queryset(self):
156 qs = super().get_queryset()
157 # Exclude streams from inactive M3U accounts
158 qs = qs.exclude(m3u_account__is_active=False)
159
160 assigned = self.request.query_params.get("assigned")
161 if assigned is not None:
162 qs = qs.filter(channels__id=assigned)
163
164 unassigned = self.request.query_params.get("unassigned")
165 if unassigned and str(unassigned).lower() in ("1", "true", "yes", "on"):
166 # Use annotation with Count for better performance on large datasets
167 qs = qs.annotate(channel_count=Count('channels')).filter(channel_count=0)
168
169 channel_group = self.request.query_params.get("channel_group")
170 if channel_group:
171 group_names = channel_group.split(",")
172 qs = qs.filter(channel_group__name__in=group_names)
173
174 # Allow client to hide stale streams (streams marked as is_stale=True)
175 hide_stale = self.request.query_params.get("hide_stale")
176 if hide_stale and str(hide_stale).lower() in ("1", "true", "yes", "on"):
177 qs = qs.filter(is_stale=False)
178
179 return qs
180
181 def list(self, request, *args, **kwargs):
182 ids = request.query_params.get("ids", None)

Callers 2

get_idsMethod · 0.95
get_filter_optionsMethod · 0.95

Calls 3

get_querysetMethod · 0.45
getMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected