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
994c490d
Commit
994c490d
authored
Dec 29, 2015
by
Hugo Beauzée-Luyssen
Browse files
Remove MediaLibrary::folder
parent
24c4b431
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/MediaLibrary.cpp
View file @
994c490d
...
...
@@ -228,11 +228,6 @@ std::shared_ptr<Media> MediaLibrary::addFile( const std::string& path, Folder* p
return
fptr
;
}
std
::
shared_ptr
<
Folder
>
MediaLibrary
::
folder
(
const
std
::
string
&
path
)
{
return
Folder
::
fromPath
(
m_dbConnection
.
get
(),
path
);
}
bool
MediaLibrary
::
deleteFile
(
const
Media
*
file
)
{
return
Media
::
destroy
(
m_dbConnection
.
get
(),
file
->
id
()
);
...
...
src/MediaLibrary.h
View file @
994c490d
...
...
@@ -56,7 +56,6 @@ class MediaLibrary : public IMediaLibrary
std
::
shared_ptr
<
Media
>
addFile
(
const
std
::
string
&
path
,
Folder
*
parentFolder
,
fs
::
IDirectory
*
parentFolderFs
);
virtual
bool
deleteFile
(
const
Media
*
file
);
std
::
shared_ptr
<
Folder
>
folder
(
const
std
::
string
&
path
);
bool
deleteFolder
(
const
Folder
*
folder
);
std
::
shared_ptr
<
Device
>
device
(
const
std
::
string
&
uuid
);
std
::
shared_ptr
<
Device
>
addDevice
(
const
std
::
string
&
uuid
,
bool
isRemovable
);
...
...
test/unittest/Tests.cpp
View file @
994c490d
...
...
@@ -30,6 +30,7 @@
#include
"discoverer/FsDiscoverer.h"
#include
"mocks/FileSystem.h"
#include
"Media.h"
#include
"Folder.h"
class
TestEnv
:
public
::
testing
::
Environment
{
...
...
@@ -88,3 +89,16 @@ MediaPtr MediaLibraryTester::media( const std::string& path )
}
return
nullptr
;
}
std
::
shared_ptr
<
Folder
>
MediaLibraryTester
::
folder
(
const
std
::
string
&
path
)
{
static
const
std
::
string
req
=
"SELECT * FROM "
+
policy
::
FolderTable
::
Name
+
" WHERE is_blacklisted IS NULL AND is_present = 1"
;
auto
folders
=
Folder
::
DatabaseHelpers
::
fetchAll
<
Folder
>
(
m_dbConnection
.
get
(),
req
);
for
(
auto
&
f
:
folders
)
{
if
(
f
->
path
()
==
path
)
return
f
;
}
return
nullptr
;
}
test/unittest/Tests.h
View file @
994c490d
...
...
@@ -30,6 +30,7 @@ class MediaLibraryTester : public MediaLibrary
public:
std
::
shared_ptr
<
Media
>
media
(
unsigned
int
id
);
MediaPtr
media
(
const
std
::
string
&
path
);
std
::
shared_ptr
<
Folder
>
folder
(
const
std
::
string
&
path
);
};
class
MediaLibraryWithoutParser
:
public
MediaLibraryTester
...
...
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