Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
51739bdb
Commit
51739bdb
authored
May 20, 2014
by
Hugo Beauzée-Luyssen
Browse files
MediaLibrary: Allow file deletion
parent
d3ea2310
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/IMediaLibrary.h
View file @
51739bdb
...
...
@@ -18,6 +18,8 @@ class IMediaLibrary
virtual
bool
initialize
(
const
std
::
string
&
dbPath
)
=
0
;
virtual
FilePtr
addFile
(
const
std
::
string
&
path
)
=
0
;
virtual
FilePtr
file
(
const
std
::
string
&
path
)
=
0
;
virtual
bool
deleteFile
(
const
std
::
string
&
mrl
)
=
0
;
virtual
bool
deleteFile
(
FilePtr
file
)
=
0
;
virtual
LabelPtr
createLabel
(
const
std
::
string
&
label
)
=
0
;
virtual
bool
deleteLabel
(
const
std
::
string
&
label
)
=
0
;
virtual
bool
deleteLabel
(
LabelPtr
label
)
=
0
;
...
...
src/MediaLibrary.cpp
View file @
51739bdb
...
...
@@ -48,6 +48,16 @@ FilePtr MediaLibrary::addFile( const std::string& path )
return
f
;
}
bool
MediaLibrary
::
deleteFile
(
const
std
::
string
&
mrl
)
{
return
File
::
destroy
(
m_dbConnection
,
mrl
);
}
bool
MediaLibrary
::
deleteFile
(
FilePtr
file
)
{
return
File
::
destroy
(
m_dbConnection
,
std
::
static_pointer_cast
<
File
>
(
file
)
);
}
LabelPtr
MediaLibrary
::
createLabel
(
const
std
::
string
&
label
)
{
auto
l
=
Label
::
create
(
label
);
...
...
src/MediaLibrary.h
View file @
51739bdb
...
...
@@ -13,6 +13,8 @@ class MediaLibrary : public IMediaLibrary
virtual
bool
files
(
std
::
vector
<
FilePtr
>&
res
);
virtual
FilePtr
file
(
const
std
::
string
&
path
);
virtual
FilePtr
addFile
(
const
std
::
string
&
path
);
virtual
bool
deleteFile
(
const
std
::
string
&
mrl
);
virtual
bool
deleteFile
(
FilePtr
file
);
virtual
LabelPtr
createLabel
(
const
std
::
string
&
label
);
virtual
bool
deleteLabel
(
const
std
::
string
&
text
);
virtual
bool
deleteLabel
(
LabelPtr
label
);
...
...
test/Tests.cpp
View file @
51739bdb
...
...
@@ -56,6 +56,18 @@ TEST_F( MLTest, FetchFile )
ASSERT_EQ
(
f
,
f2
);
}
TEST_F
(
MLTest
,
DeleteFile
)
{
auto
f
=
ml
->
addFile
(
"/dev/loutre"
);
auto
f2
=
ml
->
file
(
"/dev/loutre"
);
ASSERT_EQ
(
f
,
f2
);
ml
->
deleteFile
(
f
);
f2
=
ml
->
file
(
"/dev/loutre"
);
ASSERT_EQ
(
f2
,
nullptr
);
}
TEST_F
(
MLTest
,
AddLabel
)
{
auto
f
=
ml
->
addFile
(
"/dev/null"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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