Commit 52e7e4ec authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Fix useless requests copies

parent 7c02ae77
......@@ -557,7 +557,8 @@ Query<IAlbum> Album::fromArtist( MediaLibraryPtr ml, int64_t artistId, const Que
break;
}
return make_query<Album, IAlbum>( ml, "*", req, std::move( groupAndOrder ),
return make_query<Album, IAlbum>( ml, "*", std::move( req ),
std::move( groupAndOrder ),
artistId, artistId );
}
......
......@@ -199,7 +199,8 @@ Query<IGenre> Genre::search( MediaLibraryPtr ml, const std::string& name,
std::string orderBy = "ORDER BY name";
if ( params != nullptr && params->desc == true )
orderBy += " DESC";
return make_query<Genre, IGenre>( ml, "*", req, std::move( orderBy ), name );
return make_query<Genre, IGenre>( ml, "*", std::move( req ),
std::move( orderBy ), name );
}
Query<IGenre> Genre::listAll( MediaLibraryPtr ml, const QueryParameters* params )
......
......@@ -673,8 +673,9 @@ Query<IMedia> Media::search( MediaLibraryPtr ml, const std::string& title,
" AND f.is_present = 1"
" AND f.type = ?"
" AND m.type != ? AND m.type != ?";
return make_query<Media, IMedia>( ml, "m.*", req, sortRequest( params ),
title, File::Type::Main,
return make_query<Media, IMedia>( ml, "m.*", std::move( req ),
sortRequest( params ), title,
File::Type::Main,
Media::Type::External, Media::Type::Stream );
}
......@@ -689,8 +690,9 @@ Query<IMedia> Media::search( MediaLibraryPtr ml, const std::string& title,
" AND f.is_present = 1"
" AND f.type = ?"
" AND m.type = ?";
return make_query<Media, IMedia>( ml, "m.*", req, sortRequest( params ),
title, File::Type::Main, type );
return make_query<Media, IMedia>( ml, "m.*", std::move( req ),
sortRequest( params ), title,
File::Type::Main, type );
}
Query<IMedia> Media::searchAlbumTracks(MediaLibraryPtr ml, const std::string& pattern, int64_t albumId, const QueryParameters* params)
......@@ -705,8 +707,8 @@ Query<IMedia> Media::searchAlbumTracks(MediaLibraryPtr ml, const std::string& pa
" AND f.is_present = 1"
" AND f.type = ?"
" AND m.subtype = ?";
return make_query<Media, IMedia>( ml, "m.*", req, sortRequest( params ),
pattern, albumId,
return make_query<Media, IMedia>( ml, "m.*", std::move( req ),
sortRequest( params ), pattern, albumId,
File::Type::Main, Media::SubType::AlbumTrack );
}
......@@ -722,8 +724,8 @@ Query<IMedia> Media::searchArtistTracks(MediaLibraryPtr ml, const std::string& p
" AND f.is_present = 1"
" AND f.type = ?"
" AND m.subtype = ?";
return make_query<Media, IMedia>( ml, "m.*", req, sortRequest( params ),
pattern, artistId,
return make_query<Media, IMedia>( ml, "m.*", std::move( req ),
sortRequest( params ), pattern, artistId,
File::Type::Main, Media::SubType::AlbumTrack );
}
......@@ -739,8 +741,8 @@ Query<IMedia> Media::searchGenreTracks(MediaLibraryPtr ml, const std::string& pa
" AND f.is_present = 1"
" AND f.type = ?"
" AND m.subtype = ?";
return make_query<Media, IMedia>( ml, "m.*", req, sortRequest( params ),
pattern, genreId,
return make_query<Media, IMedia>( ml, "m.*", std::move( req ),
sortRequest( params ), pattern, genreId,
File::Type::Main, Media::SubType::AlbumTrack );
}
......@@ -757,8 +759,8 @@ Query<IMedia> Media::searchShowEpisodes(MediaLibraryPtr ml, const std::string& p
" AND f.is_present = 1"
" AND f.type = ?"
" AND m.subtype = ?";
return make_query<Media, IMedia>( ml, "m.*", req, sortRequest( params ),
pattern, showId,
return make_query<Media, IMedia>( ml, "m.*", std::move( req ),
sortRequest( params ), pattern, showId,
File::Type::Main, Media::SubType::ShowEpisode );
}
......
......@@ -296,14 +296,15 @@ Query<IPlaylist> Playlist::search( MediaLibraryPtr ml, const std::string& name,
{
std::string req = "FROM " + policy::PlaylistTable::Name + " WHERE id_playlist IN "
"(SELECT rowid FROM " + policy::PlaylistTable::Name + "Fts WHERE name MATCH '*' || ? || '*')";
return make_query<Playlist, IPlaylist>( ml, "*", req, sortRequest( params ),
name );
return make_query<Playlist, IPlaylist>( ml, "*", std::move( req ),
sortRequest( params ), name );
}
Query<IPlaylist> Playlist::listAll( MediaLibraryPtr ml, const QueryParameters* params )
{
std::string req = "FROM " + policy::PlaylistTable::Name;
return make_query<Playlist, IPlaylist>( ml, "*", req, sortRequest( params ) );
return make_query<Playlist, IPlaylist>( ml, "*", std::move( req ),
sortRequest( params ) );
}
void Playlist::clearExternalPlaylistContent(MediaLibraryPtr ml)
......
......@@ -160,7 +160,8 @@ Query<IMedia> Show::episodes( const QueryParameters* params ) const
break;
}
return make_query<Media, IMedia>( m_ml, "*", req, std::move( orderBy), m_id );
return make_query<Media, IMedia>( m_ml, "*", std::move( req ),
std::move( orderBy), m_id );
}
Query<IMedia> Show::searchEpisodes( const std::string& pattern,
......@@ -257,7 +258,8 @@ Query<IShow> Show::search( MediaLibraryPtr ml, const std::string& pattern,
std::string req = "FROM " + policy::ShowTable::Name + " WHERE id_show IN"
"(SELECT rowid FROM " + policy::ShowTable::Name + "Fts WHERE " +
policy::ShowTable::Name + "Fts MATCH '*' || ? || '*')";
return make_query<Show, IShow>( ml, "*", req, orderBy( params ), pattern );
return make_query<Show, IShow>( ml, "*", std::move( req ),
orderBy( params ), pattern );
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment