mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-25 06:26:37 +00:00
Handle unbalanced channels better
This commit is contained in:
parent
c7c37b12d8
commit
e84643b95e
@ -544,10 +544,15 @@ class Source(db.models.Model):
|
|||||||
if not self.is_playlist:
|
if not self.is_playlist:
|
||||||
if self.index_streams:
|
if self.index_streams:
|
||||||
streams = self.get_index('streams')
|
streams = self.get_index('streams')
|
||||||
# do not allow streams to consume all of the queue
|
if entries.maxlen is None or 0 == len(entries):
|
||||||
if entries.maxlen and entries.maxlen <= len(streams):
|
entries.extend(streams)
|
||||||
streams = streams[-1 * ( entries.maxlen // 2 ) :]
|
else:
|
||||||
entries.extend(reversed(streams))
|
# share the queue between streams and videos
|
||||||
|
allowed_streams = max(
|
||||||
|
entries.maxlen // 2,
|
||||||
|
entries.maxlen - len(entries),
|
||||||
|
)
|
||||||
|
entries.extend(streams[-1 * allowed_streams :])
|
||||||
|
|
||||||
return entries
|
return entries
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user