Commit 11670527 authored by Alexandre Fernandez's avatar Alexandre Fernandez
Browse files

MediaLibrary: changed return value in addFile()

addFile() can't return media anymore, so it returns boolean status
parent 6442f125
......@@ -403,9 +403,9 @@ bool MediaLibrary::isExtensionSupported( const char* ext )
});
}
std::shared_ptr<Media> MediaLibrary::addFile( std::shared_ptr<fs::IFile> fileFs,
std::shared_ptr<Folder> parentFolder,
std::shared_ptr<fs::IDirectory> parentFolderFs )
bool MediaLibrary::addFile( std::shared_ptr<fs::IFile> fileFs,
std::shared_ptr<Folder> parentFolder,
std::shared_ptr<fs::IDirectory> parentFolderFs )
{
#if 0
......@@ -414,7 +414,7 @@ std::shared_ptr<Media> MediaLibrary::addFile( std::shared_ptr<fs::IFile> fileFs,
auto mptr = Media::create( this, IMedia::Type::Unknown, fileFs->name() );
if ( mptr == nullptr )
{
LOG_ERROR( "Failed to add media ", fileFs.mrl(), " to the media library" );
LOG_ERROR( "Failed to add media ", fileFs->mrl(), " to the media library" );
return false;
}
// For now, assume all media are made of a single file
......@@ -427,7 +427,7 @@ std::shared_ptr<Media> MediaLibrary::addFile( std::shared_ptr<fs::IFile> fileFs,
}
#endif
if ( m_parser != nullptr )
m_parser->parse( fileFs.mrl() );
m_parser->parse( fileFs->mrl() );
return true;
}
......
......@@ -72,7 +72,9 @@ class MediaLibrary : public IMediaLibrary, public IDeviceListerCb
virtual std::vector<MediaPtr> audioFiles( SortingCriteria sort, bool desc) const override;
virtual std::vector<MediaPtr> videoFiles( SortingCriteria sort, bool desc) const override;
bool addFile( const fs::IFile& fileFs, Folder& parentFolder, fs::IDirectory& parentFolderFs );
bool addFile( std::shared_ptr<fs::IFile> fileFs,
std::shared_ptr<Folder> parentFolder,
std::shared_ptr<fs::IDirectory> parentFolderFs );
bool deleteFolder(const Folder& folder );
......
......@@ -67,7 +67,7 @@ bool MediaLibraryTester::addFile( const std::string& path )
return MediaLibrary::addFile( file, dummyFolder, *dummyDirectory );
}
bool MediaLibraryTester::addFile( fs::IFile& file )
bool MediaLibraryTester::addFile( std::shared_ptr<fs::IFile> file )
{
return MediaLibrary::addFile( file, dummyFolder, *dummyDirectory );
}
......
......@@ -55,7 +55,7 @@ public:
void deleteTrack( int64_t trackId );
std::shared_ptr<AlbumTrack> albumTrack( int64_t id );
// Use to run tests that fiddles with file properties (modification dates, size...)
bool addFile(fs::IFile& file);
bool addFile(std::shared_ptr<fs::IFile> file);
// Used when we need an actual file instead of an external media
bool addFile( const std::string& path );
virtual void addLocalFsFactory() override;
......
Supports Markdown
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