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
0d4e4bad
Commit
0d4e4bad
authored
Jan 05, 2016
by
Hugo Beauzée-Luyssen
Browse files
VLCMetadataService: Use the track artist for AlbumTracks
Or fallback to the album artist/unknown artist
parent
5f37e683
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/metadata_services/vlc/VLCMetadataService.cpp
View file @
0d4e4bad
...
...
@@ -190,7 +190,7 @@ bool VLCMetadataService::parseAudioFile( std::shared_ptr<Media> media, VLC::Medi
media
->
setThumbnail
(
cover
);
auto
artists
=
handleArtists
(
media
,
vlcMedia
);
auto
album
=
handleAlbum
(
media
,
vlcMedia
,
artists
.
first
.
get
()
,
artists
.
second
);
auto
album
=
handleAlbum
(
media
,
vlcMedia
,
artists
.
first
,
artists
.
second
);
if
(
album
==
nullptr
)
{
LOG_WARN
(
"Failed to get/create associated album"
);
...
...
@@ -293,13 +293,25 @@ std::shared_ptr<Album> VLCMetadataService::findAlbum( Media* media, VLC::Media&
return
std
::
static_pointer_cast
<
Album
>
(
albums
[
0
]
);
}
std
::
shared_ptr
<
Album
>
VLCMetadataService
::
handleAlbum
(
std
::
shared_ptr
<
Media
>
media
,
VLC
::
Media
&
vlcMedia
,
Artist
*
albumArtist
,
std
::
shared_ptr
<
Artist
>
a
rtist
)
const
std
::
shared_ptr
<
Album
>
VLCMetadataService
::
handleAlbum
(
std
::
shared_ptr
<
Media
>
media
,
VLC
::
Media
&
vlcMedia
,
std
::
shared_ptr
<
Artist
>
albumArtist
,
std
::
shared_ptr
<
Artist
>
trackA
rtist
)
const
{
auto
albumTitle
=
vlcMedia
.
meta
(
libvlc_meta_Album
);
std
::
shared_ptr
<
Album
>
album
;
std
::
shared_ptr
<
Artist
>
artist
=
albumArtist
;
if
(
artist
==
nullptr
)
{
if
(
trackArtist
!=
nullptr
)
artist
=
trackArtist
;
else
{
//FIXME: We might fetch the unknown artist twice while parsing the same file, that sucks.
artist
=
Artist
::
fetch
(
m_dbConn
,
medialibrary
::
UnknownArtistID
);
}
}
if
(
albumTitle
.
length
()
>
0
)
{
album
=
findAlbum
(
media
.
get
(),
vlcMedia
,
albumTitle
,
albumArtist
);
album
=
findAlbum
(
media
.
get
(),
vlcMedia
,
albumTitle
,
albumArtist
.
get
()
);
if
(
album
==
nullptr
)
{
...
...
@@ -313,21 +325,12 @@ std::shared_ptr<Album> VLCMetadataService::handleAlbum( std::shared_ptr<Media> m
}
}
else
{
if
(
albumArtist
!=
nullptr
)
album
=
albumArtist
->
unknownAlbum
();
else
if
(
artist
!=
nullptr
)
album
=
artist
->
unknownAlbum
();
else
{
//FIXME: We might fetch the unknown artist twice while parsing the same file, that sucks.
auto
unknownArtist
=
Artist
::
fetch
(
m_dbConn
,
medialibrary
::
UnknownArtistID
);
album
=
unknownArtist
->
unknownAlbum
();
}
}
album
=
artist
->
unknownAlbum
();
if
(
album
==
nullptr
)
return
nullptr
;
auto
track
=
handleTrack
(
album
,
media
,
vlcMedia
,
artist
);
// If we know a track artist, specify it, otherwise, fallback to the album/unknown artist
auto
track
=
handleTrack
(
album
,
media
,
vlcMedia
,
trackArtist
?
trackArtist
:
artist
);
if
(
track
!=
nullptr
)
media
->
setAlbumTrack
(
track
);
return
album
;
...
...
src/metadata_services/vlc/VLCMetadataService.h
View file @
0d4e4bad
...
...
@@ -58,7 +58,7 @@ private:
std
::
pair
<
std
::
shared_ptr
<
Artist
>
,
std
::
shared_ptr
<
Artist
>>
handleArtists
(
std
::
shared_ptr
<
Media
>
media
,
VLC
::
Media
&
vlcMedia
)
const
;
std
::
shared_ptr
<
AlbumTrack
>
handleTrack
(
std
::
shared_ptr
<
Album
>
album
,
std
::
shared_ptr
<
Media
>
media
,
VLC
::
Media
&
vlcMedia
,
std
::
shared_ptr
<
Artist
>
artist
)
const
;
bool
link
(
std
::
shared_ptr
<
Media
>
media
,
std
::
shared_ptr
<
Album
>
album
,
std
::
shared_ptr
<
Artist
>
albumArtist
,
std
::
shared_ptr
<
Artist
>
artist
)
const
;
std
::
shared_ptr
<
Album
>
handleAlbum
(
std
::
shared_ptr
<
Media
>
media
,
VLC
::
Media
&
vlcMedia
,
Artist
*
albumArtist
,
std
::
shared_ptr
<
Artist
>
artist
)
const
;
std
::
shared_ptr
<
Album
>
handleAlbum
(
std
::
shared_ptr
<
Media
>
media
,
VLC
::
Media
&
vlcMedia
,
std
::
shared_ptr
<
Artist
>
albumArtist
,
std
::
shared_ptr
<
Artist
>
artist
)
const
;
VLC
::
Instance
m_instance
;
IMetadataServiceCb
*
m_cb
;
...
...
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