Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
medialibrary
Commits
d7d9a59a
Commit
d7d9a59a
authored
Sep 30, 2015
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MediaLibrary: Expose video/audio files listing
parent
7cdba23c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
include/IMediaLibrary.h
include/IMediaLibrary.h
+2
-0
src/MediaLibrary.cpp
src/MediaLibrary.cpp
+15
-0
src/MediaLibrary.h
src/MediaLibrary.h
+2
-0
No files found.
include/IMediaLibrary.h
View file @
d7d9a59a
...
@@ -60,6 +60,8 @@ class IMediaLibrary
...
@@ -60,6 +60,8 @@ class IMediaLibrary
virtual
bool
deleteLabel
(
const
std
::
string
&
label
)
=
0
;
virtual
bool
deleteLabel
(
const
std
::
string
&
label
)
=
0
;
virtual
bool
deleteLabel
(
LabelPtr
label
)
=
0
;
virtual
bool
deleteLabel
(
LabelPtr
label
)
=
0
;
virtual
std
::
vector
<
FilePtr
>
files
()
=
0
;
virtual
std
::
vector
<
FilePtr
>
files
()
=
0
;
virtual
std
::
vector
<
FilePtr
>
audioFiles
()
=
0
;
virtual
std
::
vector
<
FilePtr
>
videoFiles
()
=
0
;
virtual
AlbumPtr
album
(
const
std
::
string
&
title
)
=
0
;
virtual
AlbumPtr
album
(
const
std
::
string
&
title
)
=
0
;
virtual
AlbumPtr
createAlbum
(
const
std
::
string
&
title
)
=
0
;
virtual
AlbumPtr
createAlbum
(
const
std
::
string
&
title
)
=
0
;
virtual
ShowPtr
show
(
const
std
::
string
&
name
)
=
0
;
virtual
ShowPtr
show
(
const
std
::
string
&
name
)
=
0
;
...
...
src/MediaLibrary.cpp
View file @
d7d9a59a
...
@@ -123,6 +123,21 @@ std::vector<FilePtr> MediaLibrary::files()
...
@@ -123,6 +123,21 @@ std::vector<FilePtr> MediaLibrary::files()
return
File
::
fetchAll
(
m_dbConnection
);
return
File
::
fetchAll
(
m_dbConnection
);
}
}
std
::
vector
<
FilePtr
>
MediaLibrary
::
audioFiles
()
{
static
const
std
::
string
req
=
"SELECT * FROM "
+
policy
::
FileTable
::
Name
+
" WHERE type = ?"
;
//FIXME: Replace this with template magic in sqlite's traits
using
type_t
=
std
::
underlying_type
<
IFile
::
Type
>::
type
;
return
sqlite
::
Tools
::
fetchAll
<
File
,
IFile
>
(
m_dbConnection
,
req
,
static_cast
<
type_t
>
(
IFile
::
Type
::
AudioType
)
);
}
std
::
vector
<
FilePtr
>
MediaLibrary
::
videoFiles
()
{
static
const
std
::
string
req
=
"SELECT * FROM "
+
policy
::
FileTable
::
Name
+
" WHERE type = ?"
;
using
type_t
=
std
::
underlying_type
<
IFile
::
Type
>::
type
;
return
sqlite
::
Tools
::
fetchAll
<
File
,
IFile
>
(
m_dbConnection
,
req
,
static_cast
<
type_t
>
(
IFile
::
Type
::
VideoType
)
);
}
FilePtr
MediaLibrary
::
file
(
const
std
::
string
&
path
)
FilePtr
MediaLibrary
::
file
(
const
std
::
string
&
path
)
{
{
return
File
::
fetch
(
m_dbConnection
,
path
);
return
File
::
fetch
(
m_dbConnection
,
path
);
...
...
src/MediaLibrary.h
View file @
d7d9a59a
...
@@ -18,6 +18,8 @@ class MediaLibrary : public IMediaLibrary, public IDiscovererCb
...
@@ -18,6 +18,8 @@ class MediaLibrary : public IMediaLibrary, public IDiscovererCb
virtual
void
setFsFactory
(
std
::
shared_ptr
<
factory
::
IFileSystem
>
fsFactory
)
override
;
virtual
void
setFsFactory
(
std
::
shared_ptr
<
factory
::
IFileSystem
>
fsFactory
)
override
;
virtual
std
::
vector
<
FilePtr
>
files
()
override
;
virtual
std
::
vector
<
FilePtr
>
files
()
override
;
virtual
std
::
vector
<
FilePtr
>
audioFiles
()
override
;
virtual
std
::
vector
<
FilePtr
>
videoFiles
()
override
;
virtual
FilePtr
file
(
const
std
::
string
&
path
)
override
;
virtual
FilePtr
file
(
const
std
::
string
&
path
)
override
;
virtual
FilePtr
addFile
(
const
std
::
string
&
path
)
override
;
virtual
FilePtr
addFile
(
const
std
::
string
&
path
)
override
;
virtual
bool
deleteFile
(
const
std
::
string
&
mrl
)
override
;
virtual
bool
deleteFile
(
const
std
::
string
&
mrl
)
override
;
...
...
Write
Preview
Markdown
is supported
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