void SingleGenreView::browseGenre(QString objectId) { currentObjectId = objectId; connect(mafwTrackerSource, SIGNAL(containerChanged(QString)), this, SLOT(onContainerChanged(QString)), Qt::UniqueConnection); if (mafwTrackerSource->isReady()) listArtists(); }
int MediaLibrary::List( int listQuery, const vlc_ml_query_params_t* params, va_list args ) { if ( Start() == false ) return VLC_EGENERIC; medialibrary::QueryParameters p{}; medialibrary::QueryParameters* paramsPtr = nullptr; uint32_t nbItems = 0; uint32_t offset = 0; const char* psz_pattern = nullptr; if ( params ) { p.desc = params->b_desc; p.sort = sortingCriteria( params->i_sort ); nbItems = params->i_nbResults; offset = params->i_offset; psz_pattern = params->psz_pattern; paramsPtr = &p; } switch ( listQuery ) { case VLC_ML_LIST_MEDIA_OF: case VLC_ML_COUNT_MEDIA_OF: case VLC_ML_LIST_ARTISTS_OF: case VLC_ML_COUNT_ARTISTS_OF: case VLC_ML_LIST_ALBUMS_OF: case VLC_ML_COUNT_ALBUMS_OF: { auto parentType = va_arg( args, int ); listQuery = filterListChildrenQuery( listQuery, parentType ); } default: break; } switch( listQuery ) { case VLC_ML_LIST_ALBUM_TRACKS: case VLC_ML_COUNT_ALBUM_TRACKS: case VLC_ML_LIST_ALBUM_ARTISTS: case VLC_ML_COUNT_ALBUM_ARTISTS: return listAlbums( listQuery, paramsPtr, psz_pattern, nbItems, offset, args ); case VLC_ML_LIST_ARTIST_ALBUMS: case VLC_ML_COUNT_ARTIST_ALBUMS: case VLC_ML_LIST_ARTIST_TRACKS: case VLC_ML_COUNT_ARTIST_TRACKS: return listArtists( listQuery, paramsPtr, psz_pattern, nbItems, offset, args ); case VLC_ML_LIST_VIDEOS: { medialibrary::Query<medialibrary::IMedia> query; if ( psz_pattern != nullptr ) query = m_ml->searchVideo( psz_pattern, paramsPtr ); else query = m_ml->videoFiles( paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; auto res = ml_convert_list<vlc_ml_media_list_t, vlc_ml_media_t>( query->items( nbItems, offset ) ); *va_arg( args, vlc_ml_media_list_t**) = res; break; } case VLC_ML_COUNT_VIDEOS: { medialibrary::Query<medialibrary::IMedia> query; if ( psz_pattern != nullptr ) query = m_ml->searchVideo( psz_pattern, paramsPtr ); else query = m_ml->videoFiles( paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; *va_arg( args, size_t* ) = query->count(); break; } case VLC_ML_LIST_AUDIOS: { medialibrary::Query<medialibrary::IMedia> query; if ( psz_pattern != nullptr ) query = m_ml->searchAudio( psz_pattern, paramsPtr ); else query = m_ml->audioFiles( paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; auto res = ml_convert_list<vlc_ml_media_list_t, vlc_ml_media_t>( query->items( nbItems, offset ) ); *va_arg( args, vlc_ml_media_list_t**) = res; break; } case VLC_ML_COUNT_AUDIOS: { medialibrary::Query<medialibrary::IMedia> query; if ( psz_pattern != nullptr ) query = m_ml->searchAudio( psz_pattern, paramsPtr ); else query = m_ml->audioFiles( paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; *va_arg( args, size_t* ) = query->count(); break; } case VLC_ML_LIST_ALBUMS: { medialibrary::Query<medialibrary::IAlbum> query; if ( psz_pattern != nullptr ) query = m_ml->searchAlbums( psz_pattern, paramsPtr ); else query = m_ml->albums( paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; auto res = ml_convert_list<vlc_ml_album_list_t, vlc_ml_album_t>( query->items( nbItems, offset ) ); *va_arg( args, vlc_ml_album_list_t**) = res; break; } case VLC_ML_COUNT_ALBUMS: { medialibrary::Query<medialibrary::IAlbum> query; if ( psz_pattern != nullptr ) query = m_ml->searchAlbums( psz_pattern, paramsPtr ); else query = m_ml->albums( paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; *va_arg( args, size_t* ) = query->count(); break; } case VLC_ML_LIST_GENRES: { medialibrary::Query<medialibrary::IGenre> query; if ( psz_pattern != nullptr ) query = m_ml->searchGenre( psz_pattern, paramsPtr ); else query = m_ml->genres( paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; auto res = ml_convert_list<vlc_ml_genre_list_t,vlc_ml_genre_t>( query->items( nbItems, offset ) ); *va_arg( args, vlc_ml_genre_list_t**) = res; break; } case VLC_ML_COUNT_GENRES: { medialibrary::Query<medialibrary::IGenre> query; if ( psz_pattern != nullptr ) query = m_ml->searchGenre( psz_pattern, paramsPtr ); else query = m_ml->genres( paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; *va_arg( args, size_t* ) = query->count(); break; } case VLC_ML_LIST_ARTISTS: { medialibrary::Query<medialibrary::IArtist> query; bool includeAll = va_arg( args, int ) != 0; if ( psz_pattern != nullptr ) query = m_ml->searchArtists( psz_pattern, paramsPtr ); else query = m_ml->artists( includeAll, paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; auto res = ml_convert_list<vlc_ml_artist_list_t, vlc_ml_artist_t>( query->items( nbItems, offset ) ); *va_arg( args, vlc_ml_artist_list_t**) = res; break; } case VLC_ML_COUNT_ARTISTS: { medialibrary::Query<medialibrary::IArtist> query; bool includeAll = va_arg( args, int ) != 0; if ( psz_pattern != nullptr ) query = m_ml->searchArtists( psz_pattern, paramsPtr ); else query = m_ml->artists( includeAll, paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; *va_arg( args, size_t* ) = query->count(); break; } case VLC_ML_LIST_GENRE_ARTISTS: case VLC_ML_COUNT_GENRE_ARTISTS: case VLC_ML_LIST_GENRE_TRACKS: case VLC_ML_COUNT_GENRE_TRACKS: case VLC_ML_LIST_GENRE_ALBUMS: case VLC_ML_COUNT_GENRE_ALBUMS: return listGenre( listQuery, paramsPtr, psz_pattern, nbItems, offset, args ); case VLC_ML_LIST_MEDIA_LABELS: case VLC_ML_COUNT_MEDIA_LABELS: { auto media = m_ml->media( va_arg( args, int64_t ) ); if ( media == nullptr ) return VLC_EGENERIC; auto query = media->labels(); if ( query == nullptr ) return VLC_EGENERIC; switch ( listQuery ) { case VLC_ML_LIST_MEDIA_LABELS: *va_arg( args, vlc_ml_label_list_t**) = ml_convert_list<vlc_ml_label_list_t, vlc_ml_label_t>( query->items( nbItems, offset ) ); return VLC_SUCCESS; case VLC_ML_COUNT_MEDIA_LABELS: *va_arg( args, size_t* ) = query->count(); return VLC_SUCCESS; default: vlc_assert_unreachable(); } } case VLC_ML_LIST_SHOWS: { medialibrary::Query<medialibrary::IShow> query; if ( psz_pattern != nullptr ) query = m_ml->searchShows( psz_pattern, paramsPtr ); else query = m_ml->shows( paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; *va_arg( args, vlc_ml_show_list_t** ) = ml_convert_list<vlc_ml_show_list_t, vlc_ml_show_t>( query->items( nbItems, offset ) ); return VLC_SUCCESS; } case VLC_ML_COUNT_SHOWS: { auto query = m_ml->shows( paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; *va_arg( args, int64_t* ) = query->count(); return VLC_SUCCESS; } case VLC_ML_LIST_SHOW_EPISODES: case VLC_ML_COUNT_SHOW_EPISODES: { auto show = m_ml->show( va_arg( args, int64_t ) ); if ( show == nullptr ) return VLC_EGENERIC; medialibrary::Query<medialibrary::IMedia> query; if ( psz_pattern != nullptr ) query = show->searchEpisodes( psz_pattern, paramsPtr ); else query = show->episodes( paramsPtr ); if ( query == nullptr ) return VLC_EGENERIC; switch ( listQuery ) { case VLC_ML_LIST_SHOW_EPISODES: *va_arg( args, vlc_ml_media_list_t**) = ml_convert_list<vlc_ml_media_list_t, vlc_ml_media_t>( query->items( nbItems, offset ) ); return VLC_SUCCESS; case VLC_ML_COUNT_SHOW_EPISODES: *va_arg( args, int64_t* ) = query->count(); return VLC_SUCCESS; default: vlc_assert_unreachable(); } } case VLC_ML_LIST_PLAYLIST_MEDIA: case VLC_ML_COUNT_PLAYLIST_MEDIA: case VLC_ML_LIST_PLAYLISTS: case VLC_ML_COUNT_PLAYLISTS: return listPlaylist( listQuery, paramsPtr, psz_pattern, nbItems, offset, args ); case VLC_ML_LIST_HISTORY: { auto query = m_ml->history(); if ( query == nullptr ) return VLC_EGENERIC; *va_arg( args, vlc_ml_media_list_t**) = ml_convert_list<vlc_ml_media_list_t, vlc_ml_media_t>( query->items( nbItems, offset ) ); return VLC_SUCCESS; } case VLC_ML_LIST_STREAM_HISTORY: { auto query = m_ml->streamHistory(); if ( query == nullptr ) return VLC_EGENERIC; *va_arg( args, vlc_ml_media_list_t**) = ml_convert_list<vlc_ml_media_list_t, vlc_ml_media_t>( query->items( nbItems, offset ) ); return VLC_SUCCESS; } } return VLC_SUCCESS; }