Add a max playlist limit to the tracklist.
This commit is contained in:
parent
4614f04c8b
commit
f6f490efc5
@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
|
||||
import logging
|
||||
import random
|
||||
|
||||
from mopidy import exceptions
|
||||
from mopidy.core import listener
|
||||
from mopidy.internal import deprecation, validation
|
||||
from mopidy.models import TlTrack, Track
|
||||
@ -433,6 +434,13 @@ class TracklistController(object):
|
||||
tl_tracks = []
|
||||
|
||||
for track in tracks:
|
||||
if(self.get_length() >=
|
||||
self.core._config['core']['max_tracklist_length']):
|
||||
|
||||
raise exceptions.TracklistFull(
|
||||
'TracklistFull: Tried to add ' +
|
||||
'too many uris to the tracklist.')
|
||||
break
|
||||
tl_track = TlTrack(self._next_tlid, track)
|
||||
self._next_tlid += 1
|
||||
if at_position is not None:
|
||||
|
||||
@ -19,10 +19,10 @@ class MopidyException(Exception):
|
||||
|
||||
class BackendError(MopidyException):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class CoreError(MopidyException):
|
||||
|
||||
|
||||
def __init(self, message, errno=None):
|
||||
super(CoreError, self).__init(message, errno)
|
||||
self.errno = errno
|
||||
@ -50,9 +50,9 @@ class MixerError(MopidyException):
|
||||
class ScannerError(MopidyException):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class TracklistFull(CoreError):
|
||||
|
||||
|
||||
def __init(self, message, errno=None):
|
||||
super(TracklistFull, self).__init(message, errno)
|
||||
self.errno = errno
|
||||
|
||||
Loading…
Reference in New Issue
Block a user