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

Method release_stream

apps/channels/models.py:248–277  ·  view source on GitHub ↗

Called when a stream is finished to release the lock. Returns: bool: True if stream was successfully released, False if no profile info could be found for cleanup.

(self)

Source from the content-addressed store, hash-verified

246 return None, None, "All active M3U profiles have reached maximum connection limits", False
247
248 def release_stream(self):
249 """
250 Called when a stream is finished to release the lock.
251
252 Returns:
253 bool: True if stream was successfully released, False if
254 no profile info could be found for cleanup.
255 """
256 redis_client = RedisClient.get_client()
257
258 stream_id = self.id
259 # Get the matched profile for cleanup
260 profile_id = redis_client.get(f"stream_profile:{stream_id}")
261 if not profile_id:
262 logger.debug(
263 f"Stream {stream_id}: no profile found in "
264 f"stream_profile:{stream_id}"
265 )
266 return False
267
268 redis_client.delete(f"stream_profile:{stream_id}") # Remove profile association
269
270 profile_id = int(profile_id)
271 logger.debug(
272 f"Stream {stream_id}: found profile_id={profile_id}"
273 )
274
275 release_profile_slot(profile_id, redis_client)
276
277 return True
278
279
280class ChannelManager(models.Manager):

Callers 6

generate_stream_urlFunction · 0.45
_clean_redis_keysMethod · 0.45
stream_tsFunction · 0.45
_cleanupMethod · 0.45
_cleanupMethod · 0.45

Calls 4

release_profile_slotFunction · 0.90
get_clientMethod · 0.80
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected