Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 100a3604 authored by Allan Sandfeld Jensen's avatar Allan Sandfeld Jensen

Recognize FLAC files and metadata

svn path=/trunk/kdemultimedia/juk/; revision=259363
parent e3a6a5da
......@@ -24,9 +24,10 @@
namespace MediaFiles {
QStringList mimeTypes();
static const char mp3Type[] = "audio/x-mp3";
static const char oggType[] = "application/ogg";
static const char m3uType[] = "audio/x-mpegurl";
static const char mp3Type[] = "audio/x-mp3";
static const char oggType[] = "application/ogg";
static const char flacType[] = "audio/x-flac";
static const char m3uType[] = "audio/x-mpegurl";
static const char playlistExtension[] = ".m3u";
}
......@@ -62,7 +63,7 @@ bool MediaFiles::isMediaFile(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName, 0, true);
return result->is(mp3Type) || result->is(oggType);
return result->is(mp3Type) || result->is(oggType) || result->is(flacType);
}
bool MediaFiles::isPlaylistFile(const QString &fileName)
......@@ -83,11 +84,17 @@ bool MediaFiles::isOgg(const QString &fileName)
return result->is(oggType);
}
bool MediaFiles::isFLAC(const QString &fileName)
{
KMimeType::Ptr result = KMimeType::findByPath(fileName, 0, true);
return result->is(flacType);
}
QStringList MediaFiles::mimeTypes()
{
QStringList l;
l << mp3Type << oggType << m3uType;
l << mp3Type << oggType << flacType << m3uType;
return l;
}
......@@ -56,6 +56,11 @@ namespace MediaFiles
* Returns true if fileName is an Ogg file.
*/
bool isOgg(const QString &fileName);
/**
* Returns true if fileName is an FLAC file.
*/
bool isFLAC(const QString &fileName);
}
#endif
......@@ -47,6 +47,9 @@ Tag *Tag::createTag(const QString &fileName, bool ignoreCache)
if(MediaFiles::isOgg(fileName))
return new OggTag(fileName);
if(MediaFiles::isFLAC(fileName))
return new OggTag(fileName);
kdError() << "Couldn't resolve the mime type of \"" << fileName << "\" -- this shouldn't happen." << endl;
return 0;
......@@ -90,7 +93,7 @@ int Tag::readSeconds(const KFileMetaInfo &metaInfo)
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it)
total = 60 * total + (*it).toInt();
return total;
}
......
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