Commit 772c45fa authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

IMedia: Publicly expose a way to add external streams

parent 37f18569
......@@ -26,6 +26,7 @@
#include <memory>
#include "IMediaLibrary.h"
#include "IFile.h"
namespace medialibrary
{
......@@ -84,6 +85,7 @@ class IMedia
virtual bool increasePlayCount() = 0;
virtual ShowEpisodePtr showEpisode() const = 0;
virtual const std::vector<FilePtr>& files() const = 0;
virtual FilePtr addExternalMrl( const std::string& mrl, IFile::Type type ) = 0;
virtual bool isFavorite() const = 0;
virtual bool setFavorite( bool favorite ) = 0;
virtual bool addLabel( LabelPtr label ) = 0;
......
......@@ -370,9 +370,9 @@ std::shared_ptr<File> Media::addFile( const fs::IFile& fileFs, Folder& parentFol
return file;
}
std::shared_ptr<File> Media::addExternalMrl( const std::string& mrl )
FilePtr Media::addExternalMrl( const std::string& mrl , IFile::Type type )
{
auto file = File::create( m_ml, m_id, File::Type::External, mrl );
auto file = File::create( m_ml, m_id, type, mrl );
if ( file == nullptr )
return nullptr;
auto lock = m_files.lock();
......
......@@ -127,7 +127,7 @@ class Media : public IMedia, public DatabaseHelpers<Media, policy::MediaTable>
bool save();
std::shared_ptr<File> addFile( const fs::IFile& fileFs, Folder& parentFolder, fs::IDirectory& parentFolderFs , IFile::Type type);
std::shared_ptr<File> addExternalMrl( const std::string& mrl );
virtual FilePtr addExternalMrl( const std::string& mrl, IFile::Type type ) override;
void removeFile( File& file );
static std::vector<MediaPtr> listAll(MediaLibraryPtr ml, Type type , SortingCriteria sort, bool desc);
......
......@@ -308,7 +308,7 @@ MediaPtr MediaLibrary::addMedia( const std::string& mrl )
auto media = Media::create( this, IMedia::Type::Unknown, utils::file::fileName( mrl ) );
if ( media == nullptr )
return nullptr;
media->addExternalMrl( mrl );
media->addExternalMrl( mrl, IFile::Type::External );
return media;
}
......
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