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
ca54535f
Commit
ca54535f
authored
Dec 20, 2016
by
Hugo Beauzée-Luyssen
Browse files
IMedia: Remove Type suffix from IMedia::Type members
parent
85bbf654
Changes
5
Hide whitespace changes
Inline
Side-by-side
include/medialibrary/IMedia.h
View file @
ca54535f
...
...
@@ -39,9 +39,9 @@ class IMedia
public:
enum
class
Type
:
uint8_t
{
Unknown
Type
,
Video
Type
,
Audio
Type
,
Unknown
,
Video
,
Audio
,
};
enum
class
SubType
:
uint8_t
{
...
...
src/MediaLibrary.cpp
View file @
ca54535f
...
...
@@ -305,17 +305,17 @@ MediaPtr MediaLibrary::media( const std::string& mrl ) const
std
::
vector
<
MediaPtr
>
MediaLibrary
::
audioFiles
(
SortingCriteria
sort
,
bool
desc
)
const
{
return
Media
::
listAll
(
this
,
IMedia
::
Type
::
Audio
Type
,
sort
,
desc
);
return
Media
::
listAll
(
this
,
IMedia
::
Type
::
Audio
,
sort
,
desc
);
}
std
::
vector
<
MediaPtr
>
MediaLibrary
::
videoFiles
(
SortingCriteria
sort
,
bool
desc
)
const
{
return
Media
::
listAll
(
this
,
IMedia
::
Type
::
Video
Type
,
sort
,
desc
);
return
Media
::
listAll
(
this
,
IMedia
::
Type
::
Video
,
sort
,
desc
);
}
std
::
shared_ptr
<
Media
>
MediaLibrary
::
addFile
(
const
fs
::
IFile
&
fileFs
,
Folder
&
parentFolder
,
fs
::
IDirectory
&
parentFolderFs
)
{
auto
type
=
IMedia
::
Type
::
Unknown
Type
;
auto
type
=
IMedia
::
Type
::
Unknown
;
auto
ext
=
fileFs
.
extension
();
auto
predicate
=
[
ext
](
const
std
::
string
&
v
)
{
return
strcasecmp
(
v
.
c_str
(),
ext
.
c_str
())
==
0
;
...
...
src/metadata_services/MetadataParser.cpp
View file @
ca54535f
...
...
@@ -79,7 +79,7 @@ parser::Task::Status MetadataParser::run( parser::Task& task )
if
(
tracks
.
empty
()
==
true
)
{
// However, if the file is not unknown anymore, it means the thumbnailer has already processed it
if
(
task
.
media
->
type
()
==
Media
::
Type
::
Unknown
Type
)
if
(
task
.
media
->
type
()
==
Media
::
Type
::
Unknown
)
return
parser
::
Task
::
Status
::
Success
;
// In that case, stop trying to do something with this file.
return
parser
::
Task
::
Status
::
Fatal
;
...
...
@@ -139,7 +139,7 @@ parser::Task::Status MetadataParser::run( parser::Task& task )
bool
MetadataParser
::
parseVideoFile
(
parser
::
Task
&
task
)
const
{
auto
media
=
task
.
media
.
get
();
media
->
setType
(
IMedia
::
Type
::
Video
Type
);
media
->
setType
(
IMedia
::
Type
::
Video
);
const
auto
&
title
=
task
.
vlcMedia
.
meta
(
libvlc_meta_Title
);
if
(
title
.
length
()
==
0
)
return
true
;
...
...
@@ -172,7 +172,7 @@ bool MetadataParser::parseVideoFile( parser::Task& task ) const
bool
MetadataParser
::
parseAudioFile
(
parser
::
Task
&
task
)
const
{
task
.
media
->
setType
(
IMedia
::
Type
::
Audio
Type
);
task
.
media
->
setType
(
IMedia
::
Type
::
Audio
);
const
auto
artworkMrl
=
task
.
vlcMedia
.
meta
(
libvlc_meta_ArtworkURL
);
if
(
artworkMrl
.
empty
()
==
false
)
...
...
src/metadata_services/vlc/VLCThumbnailer.cpp
View file @
ca54535f
...
...
@@ -73,7 +73,7 @@ parser::Task::Status VLCThumbnailer::run( parser::Task& task )
auto
media
=
task
.
media
;
auto
file
=
task
.
file
;
if
(
media
->
type
()
==
IMedia
::
Type
::
Audio
Type
)
if
(
media
->
type
()
==
IMedia
::
Type
::
Audio
)
{
// There's no point in generating a thumbnail for a non-video media.
task
.
file
->
markStepCompleted
(
File
::
ParserStep
::
Thumbnailer
);
...
...
@@ -112,7 +112,7 @@ parser::Task::Status VLCThumbnailer::run( parser::Task& task )
if
(
res
!=
parser
::
Task
::
Status
::
Success
)
{
// If the media became an audio file, it's not an error
if
(
task
.
media
->
type
()
==
Media
::
Type
::
Audio
Type
)
if
(
task
.
media
->
type
()
==
Media
::
Type
::
Audio
)
{
task
.
file
->
markStepCompleted
(
File
::
ParserStep
::
Thumbnailer
);
task
.
file
->
saveParserStep
();
...
...
@@ -179,9 +179,9 @@ parser::Task::Status VLCThumbnailer::startPlayback( parser::Task& task, VLC::Med
return
parser
::
Task
::
Status
::
Fatal
;
// We are now in the case of a timeout: No failure, but no video track either.
// The file might be an audio file we haven't detected yet:
if
(
task
.
media
->
type
()
==
Media
::
Type
::
Unknown
Type
)
if
(
task
.
media
->
type
()
==
Media
::
Type
::
Unknown
)
{
task
.
media
->
setType
(
Media
::
Type
::
Audio
Type
);
task
.
media
->
setType
(
Media
::
Type
::
Audio
);
if
(
task
.
media
->
save
()
==
false
)
return
parser
::
Task
::
Status
::
Fatal
;
// We still return an error since we don't want to attempt the thumbnail generation for a
...
...
test/unittest/MediaTests.cpp
View file @
ca54535f
...
...
@@ -346,17 +346,17 @@ TEST_F( Medias, SortByAlpha )
{
auto
m1
=
ml
->
addFile
(
"media1.mp3"
);
m1
->
setTitle
(
"Abcd"
);
m1
->
setType
(
Media
::
Type
::
Audio
Type
);
m1
->
setType
(
Media
::
Type
::
Audio
);
m1
->
save
();
auto
m2
=
ml
->
addFile
(
"media2.mp3"
);
m2
->
setTitle
(
"Zyxw"
);
m2
->
setType
(
Media
::
Type
::
Audio
Type
);
m2
->
setType
(
Media
::
Type
::
Audio
);
m2
->
save
();
auto
m3
=
ml
->
addFile
(
"media3.mp3"
);
m3
->
setTitle
(
"afterA-beforeZ"
);
m3
->
setType
(
Media
::
Type
::
Audio
Type
);
m3
->
setType
(
Media
::
Type
::
Audio
);
m3
->
save
();
auto
media
=
ml
->
audioFiles
(
SortingCriteria
::
Alpha
,
false
);
...
...
@@ -377,13 +377,13 @@ TEST_F( Medias, SortByLastModifDate )
auto
file1
=
std
::
make_shared
<
mock
::
NoopFile
>
(
"media.mkv"
);
file1
->
setLastModificationDate
(
666
);
auto
m1
=
ml
->
addFile
(
*
file1
);
m1
->
setType
(
Media
::
Type
::
Video
Type
);
m1
->
setType
(
Media
::
Type
::
Video
);
m1
->
save
();
auto
file2
=
std
::
make_shared
<
mock
::
NoopFile
>
(
"media2.mkv"
);
file2
->
setLastModificationDate
(
111
);
auto
m2
=
ml
->
addFile
(
*
file2
);
m2
->
setType
(
Media
::
Type
::
Video
Type
);
m2
->
setType
(
Media
::
Type
::
Video
);
m2
->
save
();
auto
media
=
ml
->
videoFiles
(
SortingCriteria
::
LastModificationDate
,
false
);
...
...
@@ -402,13 +402,13 @@ TEST_F( Medias, SortByFileSize )
auto
file1
=
std
::
make_shared
<
mock
::
NoopFile
>
(
"media.mkv"
);
file1
->
setSize
(
666
);
auto
m1
=
ml
->
addFile
(
*
file1
);
m1
->
setType
(
Media
::
Type
::
Video
Type
);
m1
->
setType
(
Media
::
Type
::
Video
);
m1
->
save
();
auto
file2
=
std
::
make_shared
<
mock
::
NoopFile
>
(
"media2.mkv"
);
file2
->
setSize
(
111
);
auto
m2
=
ml
->
addFile
(
*
file2
);
m2
->
setType
(
Media
::
Type
::
Video
Type
);
m2
->
setType
(
Media
::
Type
::
Video
);
m2
->
save
();
auto
media
=
ml
->
videoFiles
(
SortingCriteria
::
FileSize
,
false
);
...
...
@@ -425,17 +425,17 @@ TEST_F( Medias, SortByFileSize )
TEST_F
(
Medias
,
SetType
)
{
auto
m1
=
ml
->
addFile
(
"media1.mp3"
);
ASSERT_EQ
(
IMedia
::
Type
::
Unknown
Type
,
m1
->
type
()
);
ASSERT_EQ
(
IMedia
::
Type
::
Unknown
,
m1
->
type
()
);
m1
->
setType
(
IMedia
::
Type
::
Video
Type
);
m1
->
setType
(
IMedia
::
Type
::
Video
);
m1
->
save
();
ASSERT_EQ
(
IMedia
::
Type
::
Video
Type
,
m1
->
type
()
);
ASSERT_EQ
(
IMedia
::
Type
::
Video
,
m1
->
type
()
);
Reload
();
auto
m2
=
ml
->
media
(
m1
->
id
()
);
ASSERT_EQ
(
IMedia
::
Type
::
Video
Type
,
m2
->
type
()
);
ASSERT_EQ
(
IMedia
::
Type
::
Video
,
m2
->
type
()
);
}
class
FetchMedia
:
public
Tests
...
...
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