Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions lib/data/viewmodels/folder_browse_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,24 @@ class FolderBrowseViewModel extends ChangeNotifier {

bool isNavigableFolder(AggregatedItem item) {
final type = item.type;
if (type == 'Series' ||
type == 'Season' ||
type == 'BoxSet' ||
type == 'Playlist') {
return false;
}

final isFolder = item.rawData['IsFolder'] as bool? ?? false;
if (isFolder) return true;

return type == 'Folder' ||
type == 'CollectionFolder' ||
type == 'UserView' ||
type == 'BoxSet' ||
type == 'MusicAlbum' ||
type == 'Season' ||
type == 'Series' ||
type == 'PhotoAlbum' ||
type == 'Playlist';
type == 'PhotoAlbum';
}


@override
void dispose() {
_disposed = true;
Expand Down
68 changes: 47 additions & 21 deletions lib/ui/screens/browse/folder_browse_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,56 @@ class _FolderBrowseScreenState extends State<FolderBrowseScreen> {

String? _imageUrl(AggregatedItem item, {int? maxWidth}) {
final api = _vm.imageApi;
final isFolder = _vm.isNavigableFolder(item);

final imageTags = item.rawData['ImageTags'];
if (imageTags is Map) {
final thumbTag = imageTags['Thumb'] as String?;
if (thumbTag != null) {
return api.getThumbImageUrl(item.id, maxWidth: maxWidth, tag: thumbTag);
}

final primaryTag = imageTags['Primary'] as String?;
if (primaryTag != null) {
return api.getPrimaryImageUrl(
item.id,
maxWidth: maxWidth,
tag: primaryTag,
);
}

final backdropTag = imageTags['Backdrop'] as String?;
if (backdropTag != null) {
return api.getBackdropImageUrl(
item.id,
maxWidth: maxWidth,
tag: backdropTag,
);
if (isFolder) {
final thumbTag = imageTags['Thumb'] as String?;
if (thumbTag != null) {
return api.getThumbImageUrl(item.id, maxWidth: maxWidth, tag: thumbTag);
}

final primaryTag = imageTags['Primary'] as String?;
if (primaryTag != null) {
return api.getPrimaryImageUrl(
item.id,
maxWidth: maxWidth,
tag: primaryTag,
);
}

final backdropTag = imageTags['Backdrop'] as String?;
if (backdropTag != null) {
return api.getBackdropImageUrl(
item.id,
maxWidth: maxWidth,
tag: backdropTag,
);
}
} else {
final primaryTag = imageTags['Primary'] as String?;
if (primaryTag != null) {
return api.getPrimaryImageUrl(
item.id,
maxWidth: maxWidth,
tag: primaryTag,
);
}

final thumbTag = imageTags['Thumb'] as String?;
if (thumbTag != null) {
return api.getThumbImageUrl(item.id, maxWidth: maxWidth, tag: thumbTag);
}

final backdropTag = imageTags['Backdrop'] as String?;
if (backdropTag != null) {
return api.getBackdropImageUrl(
item.id,
maxWidth: maxWidth,
tag: backdropTag,
);
}
}
}

Expand Down
Loading