diff options
author | Mateusz Łukasik <mati75@linuxmint.pl> | 2016-07-05 19:43:17 +0200 |
---|---|---|
committer | Mateusz Łukasik <mati75@linuxmint.pl> | 2016-07-05 19:43:17 +0200 |
commit | 7b04f55feb0d50e03d013b2be0ec555d363a40b2 (patch) | |
tree | 589da3860728c7328161810e8893d7dbe6e664a0 /src/core.cpp | |
parent | 42be0eb4f1d7a25dca97e8e2eb4ec4d03b7931fb (diff) |
Imported Upstream version 16.7.0~ds0
Diffstat (limited to 'src/core.cpp')
-rw-r--r-- | src/core.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/core.cpp b/src/core.cpp index aeb2c46..11ef041 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -42,6 +42,7 @@ #include "colorutils.h" #include "discname.h" #include "filters.h" +#include "extensions.h" #ifdef Q_OS_WIN #include <windows.h> // To change app priority @@ -2378,7 +2379,29 @@ void Core::startMplayer( QString file, double seek ) { if (PREF_YT_ENABLED) is_youtube = (file == yt->latestPreferredUrl()); #endif qDebug() << "Core::startMplayer: is_youtube:" << is_youtube; - proc->setOption("enable_streaming_sites_support", !is_youtube); + bool enable_sites = !is_youtube; + + if (!is_youtube) { + // Check if the URL contains a media extension + qDebug() << "Core::startMplayer: file:" << file; + int pos = file.lastIndexOf("."); + if (pos != -1) { + QString extension = file.mid(pos+1).toLower(); + // Check if extension contains a '?' and remove everything after it + pos = extension.lastIndexOf("?"); + if (pos != -1) { + extension = extension.left(pos); + } + qDebug() << "Core::startMplayer: URL extension:" << extension; + Extensions e; + if (e.allPlayable().contains(extension)) { + qDebug() << "Core::startMplayer: extension found in URL"; + enable_sites = false; + } + } + } + qDebug() << "Core::startMplayer: enable_sites:" << enable_sites; + proc->setOption("enable_streaming_sites_support", enable_sites); } else { proc->setOption("enable_streaming_sites_support", pref->streaming_type == Preferences::StreamingYTDL); } |