Commit 612fdc97 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

VLCMetadataService: Accept tracks without "TrackNumber" meta

parent 8488831e
......@@ -252,21 +252,24 @@ bool VLCMetadataService::handleArtist( std::shared_ptr<Album> album, std::shared
std::shared_ptr<AlbumTrack> VLCMetadataService::handleTrack(std::shared_ptr<Album> album, std::shared_ptr<Media> media, VLC::Media& vlcMedia) const
{
auto trackNbStr = vlcMedia.meta( libvlc_meta_TrackNumber );
if ( trackNbStr.length() == 0 )
{
LOG_WARN( "Failed to get track id" );
return nullptr;
}
auto title = vlcMedia.meta( libvlc_meta_Title );
if ( title.length() == 0 )
if ( title.empty() == true )
{
LOG_WARN( "Failed to get track title" );
title = "Track #";
title += trackNbStr;
if ( trackNbStr.empty() == false )
{
title = "Track #";
title += trackNbStr;
}
}
media->setTitle( title );
unsigned int trackNb = std::stoi( trackNbStr );
if ( title.empty() == false )
media->setTitle( title );
unsigned int trackNb;
if ( trackNbStr.empty() == false )
trackNb = std::stoi( trackNbStr );
else
trackNb = 0;
auto track = std::static_pointer_cast<AlbumTrack>( album->addTrack( media, trackNb ) );
if ( track == nullptr )
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment