Merge pull request #32 from TheLidlMan/issue-20-hide-music-libraries
Hide music libraries from app (Issue #20)
This commit is contained in:
@@ -339,23 +339,35 @@ class PlexClient {
|
||||
return results;
|
||||
}
|
||||
|
||||
/// Get recently added media
|
||||
/// Get recently added media (filtered to video content only)
|
||||
Future<List<PlexMetadata>> getRecentlyAdded({int limit = 50}) async {
|
||||
final response = await _dio.get(
|
||||
'/library/recentlyAdded',
|
||||
queryParameters: {'X-Plex-Container-Size': limit, 'includeGuids': 1},
|
||||
);
|
||||
return _extractMetadataList(response);
|
||||
final allItems = _extractMetadataList(response);
|
||||
|
||||
// Filter out music content (artists, albums, tracks)
|
||||
return allItems.where((item) {
|
||||
final type = item.type.toLowerCase();
|
||||
return type != 'artist' && type != 'album' && type != 'track';
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/// Get on deck items (continue watching)
|
||||
/// Get on deck items (continue watching, filtered to video content only)
|
||||
Future<List<PlexMetadata>> getOnDeck() async {
|
||||
final response = await _dio.get('/library/onDeck');
|
||||
final container = _getMediaContainer(response);
|
||||
if (container != null && container['Metadata'] != null) {
|
||||
return (container['Metadata'] as List)
|
||||
final allItems = (container['Metadata'] as List)
|
||||
.map((json) => PlexMetadata.fromJsonWithImages(json))
|
||||
.toList();
|
||||
|
||||
// Filter out music content (artists, albums, tracks)
|
||||
return allItems.where((item) {
|
||||
final type = item.type.toLowerCase();
|
||||
return type != 'artist' && type != 'album' && type != 'track';
|
||||
}).toList();
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -97,9 +97,15 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
final storage = await StorageService.getInstance();
|
||||
final allLibraries = await client.getLibraries();
|
||||
|
||||
// Filter out music libraries (type: 'artist') since music playback is not yet supported
|
||||
// Only show movie and TV show libraries
|
||||
final filteredLibraries = allLibraries
|
||||
.where((lib) => lib.type.toLowerCase() != 'artist')
|
||||
.toList();
|
||||
|
||||
// Load saved library order and apply it
|
||||
final savedOrder = storage.getLibraryOrder();
|
||||
final orderedLibraries = _applyLibraryOrder(allLibraries, savedOrder);
|
||||
final orderedLibraries = _applyLibraryOrder(filteredLibraries, savedOrder);
|
||||
|
||||
setState(() {
|
||||
_allLibraries = orderedLibraries; // Store all libraries with ordering applied
|
||||
|
||||
@@ -36,6 +36,19 @@ class _MediaCardState extends State<MediaCard> {
|
||||
|
||||
final itemType = widget.item.type.toLowerCase();
|
||||
|
||||
// Music content is not yet supported
|
||||
if (itemType == 'artist' || itemType == 'album' || itemType == 'track') {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Music playback is not yet supported'),
|
||||
duration: Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// For episodes, start playback directly
|
||||
if (itemType == 'episode') {
|
||||
final result = await navigateToVideoPlayer(
|
||||
|
||||
Reference in New Issue
Block a user