Commit 4be33502 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Cache: Remove INTF template parameter

Instead, have the caller specify which type they want.
This allows us avoid using those ugly std::static_pointer_cast
parent e6960e3e
......@@ -58,7 +58,7 @@ class IMedia
virtual bool removeLabel( LabelPtr label ) = 0;
virtual MoviePtr movie() = 0;
virtual const std::string& artist() const = 0;
virtual std::vector<std::shared_ptr<ILabel> > labels() = 0;
virtual std::vector<LabelPtr> labels() = 0;
virtual std::vector<VideoTrackPtr> videoTracks() = 0;
virtual std::vector<AudioTrackPtr> audioTracks() = 0;
// Returns the location of this file snapshot.
......
......@@ -151,7 +151,7 @@ std::vector<MediaPtr> Album::tracks() const
" LEFT JOIN " + policy::AlbumTrackTable::Name + " att ON att.media_id = med.id_media "
" WHERE att.album_id = ? ORDER BY att.disc_number, att.track_number";
m_tracks = Media::fetchAll( m_dbConnection, req, m_id );
m_tracks = Media::fetchAll<IMedia>( m_dbConnection, req, m_id );
m_tracksCached = true;
return m_tracks;
}
......@@ -214,7 +214,7 @@ std::vector<ArtistPtr> Album::artists() const
static const std::string req = "SELECT art.* FROM " + policy::ArtistTable::Name + " art "
"LEFT JOIN AlbumArtistRelation aar ON aar.id_artist = art.id_artist "
"WHERE aar.id_album = ?";
return Artist::fetchAll( m_dbConnection, req, m_id );
return Artist::fetchAll<IArtist>( m_dbConnection, req, m_id );
}
bool Album::addArtist( std::shared_ptr<Artist> artist )
......
......@@ -47,10 +47,10 @@ struct AlbumTable
};
}
class Album : public IAlbum, public Cache<Album, IAlbum, policy::AlbumTable>
class Album : public IAlbum, public Cache<Album, policy::AlbumTable>
{
private:
typedef Cache<Album, IAlbum, policy::AlbumTable> _Cache;
using _Cache = Cache<Album, policy::AlbumTable>;
public:
Album( DBConnection dbConnection, sqlite::Row& row );
Album( const std::string& title );
......@@ -103,7 +103,7 @@ class Album : public IAlbum, public Cache<Album, IAlbum, policy::AlbumTable>
mutable bool m_tracksCached;
mutable std::mutex m_tracksLock;
friend class Cache<Album, IAlbum, policy::AlbumTable>;
friend _Cache;
friend struct policy::AlbumTable;
};
......
......@@ -44,10 +44,10 @@ struct AlbumTrackTable
};
}
class AlbumTrack : public IAlbumTrack, public Cache<AlbumTrack, IAlbumTrack, policy::AlbumTrackTable>
class AlbumTrack : public IAlbumTrack, public Cache<AlbumTrack, policy::AlbumTrackTable>
{
private:
typedef Cache<AlbumTrack, IAlbumTrack, policy::AlbumTrackTable> _Cache;
using _Cache = Cache<AlbumTrack, policy::AlbumTrackTable>;
public:
AlbumTrack( DBConnection dbConnection, sqlite::Row& row );
AlbumTrack(Media* media, unsigned int trackNumber, unsigned int albumId , unsigned int discNumber);
......@@ -80,7 +80,7 @@ class AlbumTrack : public IAlbumTrack, public Cache<AlbumTrack, IAlbumTrack, pol
std::shared_ptr<Album> m_album;
friend class Cache<AlbumTrack, IAlbumTrack, policy::AlbumTrackTable>;
friend _Cache;
friend struct policy::AlbumTrackTable;
};
......
......@@ -80,7 +80,7 @@ std::vector<AlbumPtr> Artist::albums() const
return {};
static const std::string req = "SELECT * FROM " + policy::AlbumTable::Name + " alb "
"WHERE artist_id = ? ORDER BY release_year, title";
return Album::fetchAll( m_dbConnection, req, m_id );
return Album::fetchAll<IAlbum>( m_dbConnection, req, m_id );
}
std::vector<MediaPtr> Artist::media() const
......@@ -90,7 +90,7 @@ std::vector<MediaPtr> Artist::media() const
static const std::string req = "SELECT med.* FROM " + policy::MediaTable::Name + " med "
"LEFT JOIN MediaArtistRelation mar ON mar.id_media = med.id_media "
"WHERE mar.id_artist = ?";
return Media::fetchAll( m_dbConnection, req, m_id );
return Media::fetchAll<IMedia>( m_dbConnection, req, m_id );
}
else
{
......@@ -99,7 +99,7 @@ std::vector<MediaPtr> Artist::media() const
static const std::string req = "SELECT med.* FROM " + policy::MediaTable::Name + " med "
"LEFT JOIN MediaArtistRelation mar ON mar.id_media = med.id_media "
"WHERE mar.id_artist IS NULL";
return Media::fetchAll( m_dbConnection, req );
return Media::fetchAll<IMedia>( m_dbConnection, req );
}
}
......
......@@ -40,10 +40,10 @@ struct ArtistTable
};
}
class Artist : public IArtist, public Cache<Artist, IArtist, policy::ArtistTable>
class Artist : public IArtist, public Cache<Artist, policy::ArtistTable>
{
private:
using _Cache = Cache<Artist, IArtist, policy::ArtistTable>;
using _Cache = Cache<Artist, policy::ArtistTable>;
public:
Artist( DBConnection dbConnection, sqlite::Row& row );
......
......@@ -39,8 +39,10 @@ struct AudioTrackTable
};
}
class AudioTrack : public IAudioTrack, public Cache<AudioTrack, IAudioTrack, policy::AudioTrackTable>
class AudioTrack : public IAudioTrack, public Cache<AudioTrack, policy::AudioTrackTable>
{
using _Cache = Cache<AudioTrack, policy::AudioTrackTable>;
public:
AudioTrack( DBConnection dbConnection, sqlite::Row& row );
AudioTrack(const std::string& codec, unsigned int bitrate, unsigned int sampleRate, unsigned int nbChannels, const std::string& language, const std::string& desc , unsigned int mediaId);
......@@ -71,7 +73,6 @@ class AudioTrack : public IAudioTrack, public Cache<AudioTrack, IAudioTrack, pol
private:
typedef Cache<AudioTrack, IAudioTrack, policy::AudioTrackTable> _Cache;
friend struct policy::AudioTrackTable;
};
......
......@@ -104,14 +104,14 @@ std::vector<MediaPtr> Folder::files()
{
static const std::string req = "SELECT * FROM " + policy::MediaTable::Name +
" WHERE folder_id = ?";
return Media::fetchAll( m_dbConection, req, m_id );
return Media::fetchAll<IMedia>( m_dbConection, req, m_id );
}
std::vector<FolderPtr> Folder::folders()
{
static const std::string req = "SELECT * FROM " + policy::FolderTable::Name +
" WHERE id_parent = ?";
return fetchAll( m_dbConection, req, m_id );
return fetchAll<IFolder>( m_dbConection, req, m_id );
}
FolderPtr Folder::parent()
......
......@@ -52,9 +52,9 @@ struct FolderCache
}
class Folder : public IFolder, public Cache<Folder, IFolder, policy::FolderTable, policy::FolderCache>
class Folder : public IFolder, public Cache<Folder, policy::FolderTable, policy::FolderCache>
{
using _Cache = Cache<Folder, IFolder, policy::FolderTable, policy::FolderCache>;
using _Cache = Cache<Folder, policy::FolderTable, policy::FolderCache>;
public:
Folder( DBConnection dbConnection, sqlite::Row& row );
......
......@@ -60,7 +60,7 @@ std::vector<MediaPtr> Label::files()
static const std::string req = "SELECT f.* FROM " + policy::MediaTable::Name + " f "
"LEFT JOIN LabelFileRelation lfr ON lfr.id_media = f.id_media "
"WHERE lfr.id_label = ?";
return Media::fetchAll( m_dbConnection, req, m_id );
return Media::fetchAll<IMedia>( m_dbConnection, req, m_id );
}
LabelPtr Label::create(DBConnection dbConnection, const std::string& name )
......
......@@ -50,10 +50,10 @@ struct LabelCachePolicy
}
class Label : public ILabel, public Cache<Label, ILabel, policy::LabelTable, policy::LabelCachePolicy>
class Label : public ILabel, public Cache<Label, policy::LabelTable, policy::LabelCachePolicy>
{
private:
typedef Cache<Label, ILabel, policy::LabelTable, policy::LabelCachePolicy> _Cache;
using _Cache = Cache<Label, policy::LabelTable, policy::LabelCachePolicy>;
public:
Label( DBConnection dbConnection, sqlite::Row& row );
Label( const std::string& name );
......@@ -70,7 +70,7 @@ class Label : public ILabel, public Cache<Label, ILabel, policy::LabelTable, pol
unsigned int m_id;
std::string m_name;
friend class Cache<Label, ILabel, policy::LabelTable>;
friend _Cache;
friend struct policy::LabelTable;
};
......
......@@ -158,12 +158,12 @@ bool Media::setShowEpisode(ShowEpisodePtr showEpisode)
return true;
}
std::vector<std::shared_ptr<ILabel> > Media::labels()
std::vector<LabelPtr> Media::labels()
{
static const std::string req = "SELECT l.* FROM " + policy::LabelTable::Name + " l "
"LEFT JOIN LabelFileRelation lfr ON lfr.id_label = l.id_label "
"WHERE lfr.id_media = ?";
return Label::fetchAll( m_dbConnection, req, m_id );
return Label::fetchAll<ILabel>( m_dbConnection, req, m_id );
}
int Media::playCount() const
......@@ -205,7 +205,7 @@ std::vector<VideoTrackPtr> Media::videoTracks()
{
static const std::string req = "SELECT * FROM " + policy::VideoTrackTable::Name +
" WHERE media_id = ?";
return VideoTrack::fetchAll( m_dbConnection, req, m_id );
return VideoTrack::fetchAll<IVideoTrack>( m_dbConnection, req, m_id );
}
bool Media::addAudioTrack( const std::string& codec, unsigned int bitrate,
......@@ -219,7 +219,7 @@ std::vector<AudioTrackPtr> Media::audioTracks()
{
static const std::string req = "SELECT * FROM " + policy::AudioTrackTable::Name +
" WHERE media_id = ?";
return AudioTrack::fetchAll( m_dbConnection, req, m_id );
return AudioTrack::fetchAll<IAudioTrack>( m_dbConnection, req, m_id );
}
const std::string &Media::snapshot()
......
......@@ -57,10 +57,10 @@ struct MediaCache
};
}
class Media : public IMedia, public Cache<Media, IMedia, policy::MediaTable, policy::MediaCache>
class Media : public IMedia, public Cache<Media, policy::MediaTable, policy::MediaCache>
{
private:
typedef Cache<Media, IMedia, policy::MediaTable, policy::MediaCache> _Cache;
using _Cache = Cache<Media, policy::MediaTable, policy::MediaCache>;
public:
// Those should be private, however the standard states that the expression
......@@ -88,7 +88,7 @@ class Media : public IMedia, public Cache<Media, IMedia, policy::MediaTable, pol
bool setShowEpisode( ShowEpisodePtr showEpisode );
virtual bool addLabel( LabelPtr label ) override;
virtual bool removeLabel( LabelPtr label ) override;
virtual std::vector<std::shared_ptr<ILabel> > labels() override;
virtual std::vector<LabelPtr> labels() override;
virtual int playCount() const override;
virtual const std::string& mrl() const override;
virtual MoviePtr movie() override;
......@@ -135,7 +135,7 @@ class Media : public IMedia, public Cache<Media, IMedia, policy::MediaTable, pol
ShowEpisodePtr m_showEpisode;
MoviePtr m_movie;
friend class Cache<Media, IMedia, policy::MediaTable, policy::MediaCache>;
friend _Cache;
friend struct policy::MediaTable;
};
......
......@@ -173,19 +173,19 @@ void MediaLibrary::setVerbosity(LogLevel v)
std::vector<MediaPtr> MediaLibrary::files()
{
return Media::fetchAll( m_dbConnection.get() );
return Media::fetchAll<IMedia>( m_dbConnection.get() );
}
std::vector<MediaPtr> MediaLibrary::audioFiles()
{
static const std::string req = "SELECT * FROM " + policy::MediaTable::Name + " WHERE type = ? ORDER BY title";
return Media::fetchAll( m_dbConnection.get(), req, IMedia::Type::AudioType );
return Media::fetchAll<IMedia>( m_dbConnection.get(), req, IMedia::Type::AudioType );
}
std::vector<MediaPtr> MediaLibrary::videoFiles()
{
static const std::string req = "SELECT * FROM " + policy::MediaTable::Name + " WHERE type = ? ORDER BY title";
return Media::fetchAll( m_dbConnection.get(), req, IMedia::Type::VideoType );
return Media::fetchAll<IMedia>( m_dbConnection.get(), req, IMedia::Type::VideoType );
}
MediaPtr MediaLibrary::file( const std::string& path )
......@@ -290,7 +290,7 @@ std::vector<AlbumPtr> MediaLibrary::albums()
{
static const std::string req = "SELECT * FROM " + policy::AlbumTable::Name +
" ORDER BY title ASC";
return Album::fetchAll( m_dbConnection.get(), req );
return Album::fetchAll<IAlbum>( m_dbConnection.get(), req );
}
ShowPtr MediaLibrary::show(const std::string& name)
......@@ -338,7 +338,7 @@ std::vector<ArtistPtr> MediaLibrary::artists() const
{
static const std::string req = "SELECT * FROM " + policy::ArtistTable::Name +
" WHERE nb_albums > 0";
return Artist::fetchAll( m_dbConnection.get(), req );
return Artist::fetchAll<IArtist>( m_dbConnection.get(), req );
}
void MediaLibrary::addMetadataService(std::unique_ptr<IMetadataService> service)
......
......@@ -121,7 +121,7 @@ std::vector<MediaPtr> Movie::files()
{
static const std::string req = "SELECT * FROM " + policy::MediaTable::Name
+ " WHERE movie_id = ?";
return Media::fetchAll( m_dbConnection, req, m_id );
return Media::fetchAll<IMedia>( m_dbConnection, req, m_id );
}
bool Movie::createTable( DBConnection dbConnection )
......
......@@ -39,8 +39,10 @@ struct MovieTable
};
}
class Movie : public IMovie, public Cache<Movie, IMovie, policy::MovieTable>
class Movie : public IMovie, public Cache<Movie, policy::MovieTable>
{
using _Cache = Cache<Movie, policy::MovieTable>;
public:
Movie( DBConnection dbConnection, sqlite::Row& row );
Movie( const std::string& title );
......@@ -69,7 +71,6 @@ class Movie : public IMovie, public Cache<Movie, IMovie, policy::MovieTable>
std::string m_artworkUrl;
std::string m_imdbId;
typedef Cache<Movie, IMovie, policy::MovieTable> _Cache;
friend struct policy::MovieTable;
};
......
......@@ -142,12 +142,11 @@ void Parser::restore()
static const std::string req = "SELECT * FROM " + policy::MediaTable::Name
+ " WHERE parsed = 0";
auto media = Media::fetchAll( m_dbConnection, req );
auto media = Media::fetchAll<Media>( m_dbConnection, req );
std::lock_guard<std::mutex> lock( m_lock );
for ( auto& it : media )
for ( auto& m : media )
{
auto m = std::static_pointer_cast<Media>( it );
m_tasks.push( new Task( m, m_services, m_callback ) );
}
}
......
......@@ -132,7 +132,7 @@ std::vector<ShowEpisodePtr> Show::episodes()
{
static const std::string req = "SELECT * FROM " + policy::ShowEpisodeTable::Name
+ " WHERE show_id = ?";
return ShowEpisode::fetchAll( m_dbConnection, req, m_id );
return ShowEpisode::fetchAll<IShowEpisode>( m_dbConnection, req, m_id );
}
bool Show::createTable(DBConnection dbConnection)
......
......@@ -42,8 +42,10 @@ struct ShowTable
};
}
class Show : public IShow, public Cache<Show, IShow, policy::ShowTable>
class Show : public IShow, public Cache<Show, policy::ShowTable>
{
using _Cache = Cache<Show, policy::ShowTable>;
public:
Show( DBConnection dbConnection, sqlite::Row& row );
Show( const std::string& name );
......@@ -75,9 +77,8 @@ class Show : public IShow, public Cache<Show, IShow, policy::ShowTable>
time_t m_lastSyncDate;
std::string m_tvdbId;
friend class Cache<Show, IShow, policy::ShowTable>;
friend _Cache;
friend struct policy::ShowTable;
typedef Cache<Show, IShow, policy::ShowTable> _Cache;
};
#endif // SHOW_H
......@@ -145,7 +145,7 @@ std::vector<MediaPtr> ShowEpisode::files()
{
static const std::string req = "SELECT * FROM " + policy::MediaTable::Name
+ " WHERE show_episode_id = ?";
return Media::fetchAll( m_dbConnection, req, m_id );
return Media::fetchAll<IMedia>( m_dbConnection, req, m_id );
}
bool ShowEpisode::createTable( DBConnection dbConnection )
......
......@@ -43,8 +43,10 @@ struct ShowEpisodeTable
};
}
class ShowEpisode : public IShowEpisode, public Cache<ShowEpisode, IShowEpisode, policy::ShowEpisodeTable>
class ShowEpisode : public IShowEpisode, public Cache<ShowEpisode, policy::ShowEpisodeTable>
{
using _Cache = Cache<ShowEpisode, policy::ShowEpisodeTable>;
public:
ShowEpisode( DBConnection dbConnection, sqlite::Row& row );
ShowEpisode(const std::string& name, unsigned int episodeNumber, unsigned int showId );
......@@ -80,9 +82,8 @@ class ShowEpisode : public IShowEpisode, public Cache<ShowEpisode, IShowEpisode,
unsigned int m_showId;
ShowPtr m_show;
friend class Cache<ShowEpisode, IShowEpisode, policy::ShowEpisodeTable>;
friend _Cache;
friend struct policy::ShowEpisodeTable;
typedef Cache<ShowEpisode, IShowEpisode, policy::ShowEpisodeTable> _Cache;
};
#endif // SHOWEPISODE_H
......@@ -40,8 +40,10 @@ struct VideoTrackTable
};
}
class VideoTrack : public IVideoTrack, public Cache<VideoTrack, IVideoTrack, policy::VideoTrackTable>
class VideoTrack : public IVideoTrack, public Cache<VideoTrack, policy::VideoTrackTable>
{
using _Cache = Cache<VideoTrack, policy::VideoTrackTable>;
public:
VideoTrack( DBConnection dbConnection, sqlite::Row& row );
VideoTrack( const std::string& codec, unsigned int width, unsigned int height, float fps, unsigned int mediaId );
......@@ -66,7 +68,6 @@ class VideoTrack : public IVideoTrack, public Cache<VideoTrack, IVideoTrack, pol
unsigned int m_mediaId;
private:
typedef Cache<VideoTrack, IVideoTrack, policy::VideoTrackTable> _Cache;
friend struct policy::VideoTrackTable;
};
......
......@@ -68,7 +68,7 @@ class PrimaryKeyCacheKeyPolicy
* - Inherit this class and specify the template parameter & policies accordingly
* - Make this class a friend class of the class you inherit from
*/
template <typename IMPL, typename INTF, typename TABLEPOLICY, typename CACHEPOLICY = PrimaryKeyCacheKeyPolicy >
template <typename IMPL, typename TABLEPOLICY, typename CACHEPOLICY = PrimaryKeyCacheKeyPolicy >
class Cache
{
public:
......@@ -96,6 +96,7 @@ class Cache
/*
* Will fetch all elements from the database & cache them.
*/
template <typename INTF = IMPL>
static std::vector<std::shared_ptr<INTF>> fetchAll( DBConnection dbConnection )
{
static const std::string req = "SELECT * FROM " + TABLEPOLICY::Name;
......@@ -105,7 +106,7 @@ class Cache
return sqlite::Tools::fetchAll<IMPL, INTF>( dbConnection, req );
}
template <typename... Args>
template <typename INTF, typename... Args>
static std::vector<std::shared_ptr<INTF>> fetchAll( DBConnection dbConnection, const std::string &req, Args&&... args )
{
Lock lock( Mutex );
......@@ -136,7 +137,8 @@ class Cache
return sqlite::Tools::executeDelete( dbConnection, req, key );
}
static bool destroy( DBConnection dbConnection, const INTF* self )
template <typename T>
static bool destroy( DBConnection dbConnection, const T* self )
{
const auto& key = CACHEPOLICY::key( self );
return destroy( dbConnection, key );
......@@ -192,11 +194,11 @@ class Cache
typedef std::lock_guard<std::recursive_mutex> Lock;
};
template <typename IMPL, typename INTF, typename TABLEPOLICY, typename CACHEPOLICY>
template <typename IMPL, typename TABLEPOLICY, typename CACHEPOLICY>
std::unordered_map<typename CACHEPOLICY::KeyType, std::shared_ptr<IMPL> >
Cache<IMPL, INTF, TABLEPOLICY, CACHEPOLICY>::Store;
Cache<IMPL, TABLEPOLICY, CACHEPOLICY>::Store;
template <typename IMPL, typename INTF, typename TABLEPOLICY, typename CACHEPOLICY>
std::recursive_mutex Cache<IMPL, INTF, TABLEPOLICY, CACHEPOLICY>::Mutex;
template <typename IMPL, typename TABLEPOLICY, typename CACHEPOLICY>
std::recursive_mutex Cache<IMPL, TABLEPOLICY, CACHEPOLICY>::Mutex;
#endif // CACHE_H
......@@ -81,10 +81,9 @@ void FsDiscoverer::reload()
//FIXME: This shouldn't be done for "removable"/network files
static const std::string req = "SELECT * FROM " + policy::FolderTable::Name
+ " WHERE id_parent IS NULL";
auto rootFolders = Folder::fetchAll( m_dbConn, req );
for ( const auto& it : rootFolders )
auto rootFolders = Folder::fetchAll<Folder>( m_dbConn, req );
for ( const auto& f : rootFolders )
{
auto f = std::static_pointer_cast<Folder>( it );
auto folder = m_fsFactory->createDirectory( f->path() );
if ( folder->lastModificationDate() == f->lastModificationDate() )
continue;
......@@ -108,7 +107,7 @@ bool FsDiscoverer::checkSubfolders( fs::IDirectory* folder, FolderPtr parentFold
static const std::string req = "SELECT * FROM " + policy::FolderTable::Name
+ " WHERE id_parent = ?";
LOG_INFO( "Checking for modifications in ", folder->path() );
auto subFoldersInDB = Folder::fetchAll( m_dbConn, req, parentFolder->id() );
auto subFoldersInDB = Folder::fetchAll<Folder>( m_dbConn, req, parentFolder->id() );
for ( const auto& subFolderPath : folder->dirs() )
{
auto subFolder = m_fsFactory->createDirectory( subFolderPath );
......@@ -127,7 +126,7 @@ bool FsDiscoverer::checkSubfolders( fs::IDirectory* folder, FolderPtr parentFold
f->setLastModificationDate( subFolder->lastModificationDate() );
continue;
}
auto folderInDb = std::static_pointer_cast<Folder>( *it );
auto folderInDb = *it;
if ( subFolder->lastModificationDate() == folderInDb->lastModificationDate() )
{
// Remove all folders that still exist in FS. That way, the list of folders that
......@@ -156,7 +155,7 @@ void FsDiscoverer::checkFiles( fs::IDirectory* folder, FolderPtr parentFolder )
LOG_INFO( "Checking file in ", folder->path() );
static const std::string req = "SELECT * FROM " + policy::MediaTable::Name
+ " WHERE folder_id = ?";
auto files = Media::fetchAll( m_dbConn, req, parentFolder->id() );
auto files = Media::fetchAll<Media>( m_dbConn, req, parentFolder->id() );
for ( const auto& filePath : folder->files() )
{
auto it = std::find_if( begin( files ), end( files ), [filePath](const std::shared_ptr<IMedia>& f) {
......@@ -168,8 +167,7 @@ void FsDiscoverer::checkFiles( fs::IDirectory* folder, FolderPtr parentFolder )
continue;
}
auto file = m_fsFactory->createFile( filePath );
auto fileInDb = std::static_pointer_cast<Media>( *it );
if ( file->lastModificationDate() == fileInDb->lastModificationDate() )
if ( file->lastModificationDate() == (*it)->lastModificationDate() )
{
// Unchanged file
files.erase( it );
......
......@@ -200,7 +200,7 @@ std::shared_ptr<Album> VLCMetadataService::findAlbum( Media* media, VLC::Media&
{
static const std::string req = "SELECT * FROM " + policy::AlbumTable::Name +
" WHERE title = ?";
auto albums = Album::fetchAll( m_dbConn, req, title );
auto albums = Album::fetchAll<Album>( m_dbConn, req, title );
if ( albums.size() == 0 )
return nullptr;
......@@ -224,7 +224,7 @@ std::shared_ptr<Album> VLCMetadataService::findAlbum( Media* media, VLC::Media&
*/
for ( auto it = begin( albums ); it != end( albums ); )
{
auto a = static_cast<Album*>( (*it).get() );
auto a = (*it).get();
if ( albumArtist != nullptr )
{
// We assume that an album without album artist is a positive match.
......
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