# HG changeset patch # User Chris Cannam # Date 1588752486 -3600 # Node ID f36fef97ac8183ef06566e882434e6bde52e32dc # Parent a454c7477b4f77c3f1a7d69666285eb6327202ce Add isSupported diff -r a454c7477b4f -r f36fef97ac81 data/fileio/PlaylistFileReader.cpp --- a/data/fileio/PlaylistFileReader.cpp Thu Apr 30 14:46:07 2020 +0100 +++ b/data/fileio/PlaylistFileReader.cpp Wed May 06 09:08:06 2020 +0100 @@ -154,3 +154,12 @@ { extensions.insert("m3u"); } + +bool +PlaylistFileReader::isSupported(FileSource source) +{ + std::set supported; + getSupportedExtensions(supported); + QString ext = source.getExtension(); + return (supported.find(ext) != supported.end()); +} diff -r a454c7477b4f -r f36fef97ac81 data/fileio/PlaylistFileReader.h --- a/data/fileio/PlaylistFileReader.h Thu Apr 30 14:46:07 2020 +0100 +++ b/data/fileio/PlaylistFileReader.h Wed May 06 09:08:06 2020 +0100 @@ -38,8 +38,15 @@ virtual QString getError() const; virtual Playlist load() const; + // Return the set of file extensions that are expected to + // represent parseable playlists. static void getSupportedExtensions(std::set &extensions); + // Return true if the given source has a file extension that is + // one of the supported extensions. Does not look at the content + // of the file. + static bool isSupported(FileSource source); + protected: void init();