Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
712b7c5e
Commit
712b7c5e
authored
Sep 28, 2015
by
Hugo Beauzée-Luyssen
Browse files
IMediaLibrary: Don't expose addMetadataService
Instead, automatically add available service.
parent
84ec8879
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/IMediaLibrary.h
View file @
712b7c5e
...
...
@@ -52,16 +52,6 @@ class IMediaLibrary
virtual
MoviePtr
movie
(
const
std
::
string
&
title
)
=
0
;
virtual
MoviePtr
createMovie
(
const
std
::
string
&
title
)
=
0
;
/**
* @brief addMetadataService Adds a service to parse media
*
* User is expected to add all services before calling parse for the first time.
* Once parse has been called, adding another service is an undefined behavior.
* This method will call service->initialize(), therefor the passed ServiceStatus
* is expected to be uninitialized.
*/
virtual
void
addMetadataService
(
std
::
unique_ptr
<
IMetadataService
>
service
)
=
0
;
/**
* @brief discover Launch a discovery on the provided entry point.
* There no garanty on how this will be processed, or if it will be processed synchronously or not.
...
...
src/MediaLibrary.cpp
View file @
712b7c5e
...
...
@@ -19,6 +19,10 @@
// Discoverers:
#include "discoverer/FsDiscoverer.h"
// Metadata services:
#include "metadata_services/vlc/VLCMetadataService.h"
#include "metadata_services/vlc/VLCThumbnailer.h"
#include "filesystem/IDirectory.h"
#include "filesystem/IFile.h"
#include "factory/FileSystem.h"
...
...
@@ -68,6 +72,19 @@ bool MediaLibrary::initialize( const std::string& dbPath, const std::string& sna
m_snapshotPath
=
snapshotPath
;
m_metadataCb
=
metadataCb
;
if
(
metadataCb
!=
nullptr
)
{
const
char
*
args
[]
=
{
"-vv"
,
"--vout=dummy"
,
};
VLC
::
Instance
vlcInstance
(
sizeof
(
args
)
/
sizeof
(
args
[
0
]),
args
);
auto
vlcService
=
std
::
unique_ptr
<
VLCMetadataService
>
(
new
VLCMetadataService
(
vlcInstance
)
);
auto
thumbnailerService
=
std
::
unique_ptr
<
VLCThumbnailer
>
(
new
VLCThumbnailer
(
vlcInstance
)
);
addMetadataService
(
std
::
move
(
vlcService
)
);
addMetadataService
(
std
::
move
(
thumbnailerService
)
);
}
m_discoverers
.
emplace_back
(
new
FsDiscoverer
(
m_fsFactory
,
this
)
);
sqlite3
*
dbConnection
;
...
...
src/MediaLibrary.h
View file @
712b7c5e
...
...
@@ -37,7 +37,6 @@ class MediaLibrary : public IMediaLibrary, public IDiscovererCb
virtual
MoviePtr
movie
(
const
std
::
string
&
title
);
virtual
MoviePtr
createMovie
(
const
std
::
string
&
title
);
virtual
void
addMetadataService
(
std
::
unique_ptr
<
IMetadataService
>
service
);
virtual
void
parse
(
FilePtr
file
,
IMetadataCb
*
cb
);
virtual
void
discover
(
const
std
::
string
&
entryPoint
)
override
;
...
...
@@ -55,6 +54,7 @@ class MediaLibrary : public IMediaLibrary, public IDiscovererCb
bool
checkSubfolders
(
fs
::
IDirectory
*
folder
,
unsigned
int
parentId
);
void
checkFiles
(
fs
::
IDirectory
*
folder
,
unsigned
int
parentId
);
FilePtr
addFile
(
const
fs
::
IFile
*
file
,
unsigned
int
folderId
);
void
addMetadataService
(
std
::
unique_ptr
<
IMetadataService
>
service
);
private:
std
::
shared_ptr
<
sqlite3
>
m_dbConnection
;
...
...
test/VLCMetadataServices.cpp
View file @
712b7c5e
...
...
@@ -9,8 +9,6 @@
#include "IAlbum.h"
#include "IAlbumTrack.h"
#include "IVideoTrack.h"
#include "metadata_services/vlc/VLCMetadataService.h"
#include "metadata_services/vlc/VLCThumbnailer.h"
class
ServiceCb
:
public
IMetadataCb
{
...
...
@@ -38,17 +36,6 @@ class VLCMetadataServices : public Tests
virtual
void
SetUp
()
override
{
Tests
::
Reload
(
nullptr
,
cb
.
get
()
);
const
char
*
args
[]
=
{
"-vv"
,
"--vout=dummy"
,
};
VLC
::
Instance
vlcInstance
(
sizeof
(
args
)
/
sizeof
(
args
[
0
]),
args
);
auto
vlcService
=
std
::
unique_ptr
<
VLCMetadataService
>
(
new
VLCMetadataService
(
vlcInstance
)
);
auto
thumbnailerService
=
std
::
unique_ptr
<
VLCThumbnailer
>
(
new
VLCThumbnailer
(
vlcInstance
)
);
ml
->
addMetadataService
(
std
::
move
(
vlcService
)
);
ml
->
addMetadataService
(
std
::
move
(
thumbnailerService
)
);
}
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment