Commit 885131b4 authored by Alexandre Fernandez's avatar Alexandre Fernandez Committed by Hugo Beauzée-Luyssen

Media: Simplify addFile parameters

Signed-off-by: Hugo Beauzée-Luyssen's avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent 399fede5
......@@ -374,11 +374,10 @@ bool Media::save()
return true;
}
std::shared_ptr<File> Media::addFile( const fs::IFile& fileFs, const Folder& parentFolder,
const fs::IDirectory& parentFolderFs, IFile::Type type )
std::shared_ptr<File> Media::addFile( const fs::IFile& fileFs, int64_t parentFolderId,
bool isFolderFsRemovable, IFile::Type type )
{
auto file = File::createFromMedia( m_ml, m_id, type, fileFs, parentFolder.id(),
parentFolderFs.device()->isRemovable());
auto file = File::createFromMedia( m_ml, m_id, type, fileFs, parentFolderId, isFolderFsRemovable);
if ( file == nullptr )
return nullptr;
auto lock = m_files.lock();
......
......@@ -135,8 +135,8 @@ class Media : public IMedia, public DatabaseHelpers<Media, policy::MediaTable>
void setThumbnail( const std::string& thumbnail );
bool save();
std::shared_ptr<File> addFile( const fs::IFile& fileFs, const Folder& parentFolder,
const fs::IDirectory& parentFolderFs, IFile::Type type );
std::shared_ptr<File> addFile( const fs::IFile& fileFs, int64_t parentFolderId,
bool isFolderFsRemovable, IFile::Type type );
virtual FilePtr addExternalMrl( const std::string& mrl, IFile::Type type ) override;
void removeFile( File& file );
......
......@@ -416,7 +416,7 @@ std::shared_ptr<Media> MediaLibrary::addFile( std::shared_ptr<fs::IFile> fileFs,
return nullptr;
}
// For now, assume all media are made of a single file
auto file = mptr->addFile( *fileFs, *parentFolder, *parentFolderFs, File::Type::Main );
auto file = mptr->addFile( *fileFs, parentFolder->id(), parentFolderFs->device()->isRemovable(), File::Type::Main );
if ( file == nullptr )
{
LOG_ERROR( "Failed to add file ", fileFs->mrl(), " to media #", mptr->id() );
......
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