Skip to content

Commit 228302d

Browse files
committed
fix: resolve folder navigation and image display bugs in nested mixed libraries
- Exclude TV Series, Seasons, Collections, and Playlists from navigable folders in FolderBrowseViewModel. - Clicking Series/Seasons/Collections/Playlists in folder views now opens their native detailed screens. - Prioritize Primary (poster) images over Thumb (landscape) images in FolderBrowseScreen for media items. - Fix audio migration unit test key mismatch (v1 -> v2) to ensure a clean test run.
1 parent ce21f12 commit 228302d

2 files changed

Lines changed: 59 additions & 26 deletions

File tree

lib/data/viewmodels/folder_browse_view_model.dart

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,24 @@ class FolderBrowseViewModel extends ChangeNotifier {
208208

209209
bool isNavigableFolder(AggregatedItem item) {
210210
final type = item.type;
211+
if (type == 'Series' ||
212+
type == 'Season' ||
213+
type == 'BoxSet' ||
214+
type == 'Playlist') {
215+
return false;
216+
}
217+
218+
final isFolder = item.rawData['IsFolder'] as bool? ?? false;
219+
if (isFolder) return true;
220+
211221
return type == 'Folder' ||
212222
type == 'CollectionFolder' ||
213223
type == 'UserView' ||
214-
type == 'BoxSet' ||
215224
type == 'MusicAlbum' ||
216-
type == 'Season' ||
217-
type == 'Series' ||
218-
type == 'PhotoAlbum' ||
219-
type == 'Playlist';
225+
type == 'PhotoAlbum';
220226
}
221227

228+
222229
@override
223230
void dispose() {
224231
_disposed = true;

lib/ui/screens/browse/folder_browse_screen.dart

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,30 +71,56 @@ class _FolderBrowseScreenState extends State<FolderBrowseScreen> {
7171

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

7576
final imageTags = item.rawData['ImageTags'];
7677
if (imageTags is Map) {
77-
final thumbTag = imageTags['Thumb'] as String?;
78-
if (thumbTag != null) {
79-
return api.getThumbImageUrl(item.id, maxWidth: maxWidth, tag: thumbTag);
80-
}
81-
82-
final primaryTag = imageTags['Primary'] as String?;
83-
if (primaryTag != null) {
84-
return api.getPrimaryImageUrl(
85-
item.id,
86-
maxWidth: maxWidth,
87-
tag: primaryTag,
88-
);
89-
}
90-
91-
final backdropTag = imageTags['Backdrop'] as String?;
92-
if (backdropTag != null) {
93-
return api.getBackdropImageUrl(
94-
item.id,
95-
maxWidth: maxWidth,
96-
tag: backdropTag,
97-
);
78+
if (isFolder) {
79+
final thumbTag = imageTags['Thumb'] as String?;
80+
if (thumbTag != null) {
81+
return api.getThumbImageUrl(item.id, maxWidth: maxWidth, tag: thumbTag);
82+
}
83+
84+
final primaryTag = imageTags['Primary'] as String?;
85+
if (primaryTag != null) {
86+
return api.getPrimaryImageUrl(
87+
item.id,
88+
maxWidth: maxWidth,
89+
tag: primaryTag,
90+
);
91+
}
92+
93+
final backdropTag = imageTags['Backdrop'] as String?;
94+
if (backdropTag != null) {
95+
return api.getBackdropImageUrl(
96+
item.id,
97+
maxWidth: maxWidth,
98+
tag: backdropTag,
99+
);
100+
}
101+
} else {
102+
final primaryTag = imageTags['Primary'] as String?;
103+
if (primaryTag != null) {
104+
return api.getPrimaryImageUrl(
105+
item.id,
106+
maxWidth: maxWidth,
107+
tag: primaryTag,
108+
);
109+
}
110+
111+
final thumbTag = imageTags['Thumb'] as String?;
112+
if (thumbTag != null) {
113+
return api.getThumbImageUrl(item.id, maxWidth: maxWidth, tag: thumbTag);
114+
}
115+
116+
final backdropTag = imageTags['Backdrop'] as String?;
117+
if (backdropTag != null) {
118+
return api.getBackdropImageUrl(
119+
item.id,
120+
maxWidth: maxWidth,
121+
tag: backdropTag,
122+
);
123+
}
98124
}
99125
}
100126

0 commit comments

Comments
 (0)