Commit c71c0f8e authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

Add a MediaLibrary class shell

parent d52cec18
......@@ -17,6 +17,7 @@ vlmc_SOURCES = \
src/Backend/MLT/MLTMultiTrack.cpp \
src/EffectsEngine/EffectHelper.cpp \
src/Library/Library.cpp \
src/Library/MediaLibrary.cpp \
src/Library/MediaContainer.cpp \
src/Main/Core.cpp \
src/Main/main.cpp \
......@@ -93,6 +94,7 @@ vlmc_SOURCES += \
src/Main/Core.h \
src/Library/Library.h \
src/Library/MediaContainer.h \
src/Library/MediaLibrary.h \
src/Workflow/Helper.h \
src/Workflow/Types.h \
src/Workflow/MainWorkflow.h \
......@@ -126,6 +128,7 @@ nodist_vlmc_SOURCES = \
src/Tools/OutputEventWatcher.moc.cpp \
src/Services/UploaderIODevice.moc.cpp \
src/Library/Library.moc.cpp \
src/Library/MediaLibrary.moc.cpp \
$(NULL)
vlmc_RC = \
......
/*****************************************************************************
* MediaLibrary.cpp: Wraps the media library
*****************************************************************************
* Copyright (C) 2008-2016 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "MediaLibrary.h"
#include "Settings/Settings.h"
MediaLibrary::MediaLibrary( Settings* settings )
{
m_ml.reset( NewMediaLibrary() );
settings->createVar( SettingValue::List, QStringLiteral( "vlmc/mlDirs" ), QVariant(),
"", "", SettingValue::Nothing );
connect( settings, &Settings::postLoad, this, &MediaLibrary::postLoad, Qt::DirectConnection );
}
void MediaLibrary::postLoad()
{
auto workspace = VLMC_GET_STRING( "vlmc/Workspace" ).toStdString();
Q_ASSERT( workspace.length() != 0 );
m_ml->initialize( workspace + "/ml.db", workspace + "/thumbnails/", this );
}
void MediaLibrary::onMediaAdded( std::vector<medialibrary::MediaPtr> )
{
}
void MediaLibrary::onMediaUpdated( std::vector<medialibrary::MediaPtr> )
{
}
void MediaLibrary::onMediaDeleted( std::vector<int64_t> )
{
}
void MediaLibrary::onArtistsAdded( std::vector<medialibrary::ArtistPtr> )
{
}
void MediaLibrary::onArtistsModified( std::vector<medialibrary::ArtistPtr> )
{
}
void MediaLibrary::onArtistsDeleted( std::vector<int64_t> )
{
}
void MediaLibrary::onAlbumsAdded( std::vector<medialibrary::AlbumPtr> )
{
}
void MediaLibrary::onAlbumsModified( std::vector<medialibrary::AlbumPtr> )
{
}
void MediaLibrary::onAlbumsDeleted( std::vector<int64_t> )
{
}
void MediaLibrary::onTracksAdded( std::vector<medialibrary::AlbumTrackPtr> )
{
}
void MediaLibrary::onTracksDeleted( std::vector<int64_t> )
{
}
void MediaLibrary::onDiscoveryStarted( const std::string& )
{
}
void MediaLibrary::onDiscoveryCompleted( const std::string& )
{
}
void MediaLibrary::onReloadStarted( const std::string& )
{
}
void MediaLibrary::onReloadCompleted( const std::string& )
{
}
void MediaLibrary::onParsingStatsUpdated( uint32_t )
{
}
/*****************************************************************************
* MediaLibrary.h: Wraps the media library
*****************************************************************************
* Copyright (C) 2008-2016 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef MEDIALIBRARY_H
#define MEDIALIBRARY_H
#include <medialibrary/IMediaLibrary.h>
#include <QObject>
#include <memory>
class Settings;
class MediaLibrary : public QObject, private medialibrary::IMediaLibraryCb
{
Q_OBJECT
Q_DISABLE_COPY( MediaLibrary )
public:
explicit MediaLibrary( Settings* settings );
private:
void postLoad();
private:
virtual void onMediaAdded( std::vector<medialibrary::MediaPtr> media ) override;
virtual void onMediaUpdated( std::vector<medialibrary::MediaPtr> media ) override;
virtual void onMediaDeleted( std::vector<int64_t> ids ) override;
virtual void onArtistsAdded( std::vector<medialibrary::ArtistPtr> artists ) override;
virtual void onArtistsModified( std::vector<medialibrary::ArtistPtr> artist ) override;
virtual void onArtistsDeleted( std::vector<int64_t> ids ) override;
virtual void onAlbumsAdded( std::vector<medialibrary::AlbumPtr> albums ) override;
virtual void onAlbumsModified( std::vector<medialibrary::AlbumPtr> albums ) override;
virtual void onAlbumsDeleted( std::vector<int64_t> ids ) override;
virtual void onTracksAdded( std::vector<medialibrary::AlbumTrackPtr> tracks ) override;
virtual void onTracksDeleted( std::vector<int64_t> trackIds ) override;
virtual void onDiscoveryStarted( const std::string& entryPoint ) override;
virtual void onDiscoveryCompleted( const std::string& entryPoint ) override;
virtual void onReloadStarted( const std::string& entryPoint ) override;
virtual void onReloadCompleted( const std::string& entryPoint ) override;
virtual void onParsingStatsUpdated( uint32_t percent ) override;
private:
std::unique_ptr<medialibrary::IMediaLibrary> m_ml;
};
#endif // MEDIALIBRARY_H
......@@ -34,6 +34,7 @@
#include <Backend/IBackend.h>
#include "Library/Library.h"
#include "Library/MediaLibrary.h"
#include "Project/RecentProjects.h"
#include "Project/Workspace.h"
#include <Settings/Settings.h>
......@@ -48,6 +49,7 @@ Core::Core()
createSettings();
m_currentProject = new Project( m_settings );
m_library = new Library( m_currentProject->settings() );
m_ml.reset( new MediaLibrary( m_settings ) );
m_recentProjects = new RecentProjects( m_settings );
m_workspace = new Workspace( m_settings );
m_workflow = new MainWorkflow( m_currentProject->settings() );
......
......@@ -26,6 +26,7 @@
class AutomaticBackup;
class Library;
class MainWorkflow;
class MediaLibrary;
class NotificationZone;
class Project;
class RecentProjects;
......@@ -52,6 +53,7 @@ class Core : public ScopedSingleton<Core>
Project* project();
MainWorkflow* workflow();
Library* library();
MediaLibrary* mediaLibrary();
/**
* @brief runtime returns the application runtime
*/
......@@ -76,6 +78,7 @@ class Core : public ScopedSingleton<Core>
Project* m_currentProject;
MainWorkflow* m_workflow;
Library* m_library;
std::unique_ptr<MediaLibrary> m_ml;
QElapsedTimer m_timer;
friend Singleton_t::AllowInstantiation;
......
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