Skip to content

Commit

Permalink
fix empty queue source when adding to empty queue
Browse files Browse the repository at this point in the history
- this fixes jmshrv#743
  • Loading branch information
Chaphasilor committed May 24, 2024
1 parent 0755fde commit cec5b3d
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions lib/services/queue_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,21 @@ class QueueService {
required List<jellyfin_models.BaseItemDto> items,
QueueItemSource? source,
}) async {

if (_queueAudioSource.length == 0) {
return _replaceWholeQueue(
itemList: items,
source: source ?? QueueItemSource(
type: QueueItemSourceType.queue,
name: const QueueItemSourceName(type: QueueItemSourceNameType.queue),
id: "queue",
item: null,
),
initialIndex: 0,
beginPlaying: false,
);
}

try {
if (_savedQueueState == SavedQueueState.pendingSave) {
_savedQueueState = SavedQueueState.saving;
Expand Down Expand Up @@ -606,6 +621,21 @@ class QueueService {
required List<jellyfin_models.BaseItemDto> items,
QueueItemSource? source,
}) async {

if (_queueAudioSource.length == 0) {
return _replaceWholeQueue(
itemList: items,
source: source ?? QueueItemSource(
type: QueueItemSourceType.queue,
name: const QueueItemSourceName(type: QueueItemSourceNameType.queue),
id: "queue",
item: null,
),
initialIndex: 0,
beginPlaying: false,
);
}

try {
if (_savedQueueState == SavedQueueState.pendingSave) {
_savedQueueState = SavedQueueState.saving;
Expand Down Expand Up @@ -647,6 +677,21 @@ class QueueService {
required List<jellyfin_models.BaseItemDto> items,
QueueItemSource? source,
}) async {

if (_queueAudioSource.length == 0) {
return _replaceWholeQueue(
itemList: items,
source: source ?? QueueItemSource(
type: QueueItemSourceType.queue,
name: const QueueItemSourceName(type: QueueItemSourceNameType.queue),
id: "queue",
item: null,
),
initialIndex: 0,
beginPlaying: false,
);
}

try {
if (_savedQueueState == SavedQueueState.pendingSave) {
_savedQueueState = SavedQueueState.saving;
Expand Down

0 comments on commit cec5b3d

Please sign in to comment.