Skip to content

Commit

Permalink
play correct item from search while still using full downloads as que…
Browse files Browse the repository at this point in the history
…ue in offline mode
  • Loading branch information
Chaphasilor committed Apr 28, 2024
1 parent 4786086 commit d29bd8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/components/AlbumScreen/song_list_tile.dart
Expand Up @@ -66,6 +66,7 @@ class SongListTile extends ConsumerStatefulWidget {
/// the remove from playlist button.
this.isInPlaylist = false,
this.isOnArtistScreen = false,
this.isShownInSearch = false,
}) : super(key: key);

final jellyfin_models.BaseItemDto item;
Expand All @@ -78,6 +79,7 @@ class SongListTile extends ConsumerStatefulWidget {
final bool showPlayCount;
final bool isInPlaylist;
final bool isOnArtistScreen;
final bool isShownInSearch;

@override
ConsumerState<SongListTile> createState() => _SongListTileState();
Expand Down Expand Up @@ -276,10 +278,10 @@ class _SongListTileState extends ConsumerState<SongListTile>
var items = offlineItems.map((e) => e.baseItem).whereNotNull().toList();

items = sortItems(items, settings.tabSortBy[TabContentType.songs], settings.tabSortOrder[TabContentType.songs]);

await _queueService.startPlayback(
items: items,
startingIndex: await widget.index,
startingIndex: widget.isShownInSearch ? items.indexWhere((element) => element.id == widget.item.id) : await widget.index,
source: QueueItemSource(
name: QueueItemSourceName(
type: QueueItemSourceNameType.preTranslated,
Expand Down
1 change: 1 addition & 0 deletions lib/components/MusicScreen/music_screen_tab_view.dart
Expand Up @@ -319,6 +319,7 @@ class _MusicScreenTabViewState extends State<MusicScreenTabView>
item: item,
isSong: true,
index: Future.value(index),
isShownInSearch: widget.searchTerm != null,
)
: AlbumItem(
key: ValueKey(item.id),
Expand Down

0 comments on commit d29bd8f

Please sign in to comment.