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

MediaLibrary: Extension check is now case insensitive

parent 87984070
...@@ -205,13 +205,18 @@ std::shared_ptr<Media> MediaLibrary::addFile( const std::string& path, FolderPtr ...@@ -205,13 +205,18 @@ std::shared_ptr<Media> MediaLibrary::addFile( const std::string& path, FolderPtr
} }
auto type = IMedia::Type::UnknownType; auto type = IMedia::Type::UnknownType;
if ( std::find( begin( supportedVideoExtensions ), end( supportedVideoExtensions ), auto ext = file->extension();
file->extension() ) != end( supportedVideoExtensions ) ) auto predicate = [ext](const std::string& v) {
return strcasecmp(v.c_str(), ext.c_str()) == 0;
};
if ( std::find_if( begin( supportedVideoExtensions ), end( supportedVideoExtensions ),
predicate ) != end( supportedVideoExtensions ) )
{ {
type = IMedia::Type::VideoType; type = IMedia::Type::VideoType;
} }
else if ( std::find( begin( supportedAudioExtensions ), end( supportedAudioExtensions ), else if ( std::find_if( begin( supportedAudioExtensions ), end( supportedAudioExtensions ),
file->extension() ) != end( supportedAudioExtensions ) ) predicate ) != end( supportedAudioExtensions ) )
{ {
type = IMedia::Type::AudioType; type = IMedia::Type::AudioType;
} }
......
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