|
|
@ -95,7 +95,6 @@ MpvPart::MpvPart(TQWidget* parentWidget, const char* widgetName, TQObject* paren
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_logoPath = locate( "data", "kaffeine/logo" );
|
|
|
|
m_logoPath = locate( "data", "kaffeine/logo" );
|
|
|
|
kdDebug() << "libmpvpart: Found logo animation: " << m_logoPath << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
closeURL(); // displays logo
|
|
|
|
closeURL(); // displays logo
|
|
|
|
emit setStatusBarText(i18n("Ready"));
|
|
|
|
emit setStatusBarText(i18n("Ready"));
|
|
|
@ -347,7 +346,6 @@ bool MpvPart::openURL(const MRL& mrl) {
|
|
|
|
|| (m_mrl.mime() == "audio/x-scpls") || (m_mrl.mime() == "audio/x-mpegurl") || (m_mrl.mime() == "audio/mpegurl")
|
|
|
|
|| (m_mrl.mime() == "audio/x-scpls") || (m_mrl.mime() == "audio/x-mpegurl") || (m_mrl.mime() == "audio/mpegurl")
|
|
|
|
|| (ext == "asx") || (ext == "asf") || (ext == "wvx") || (ext == "wax") ) /* windows meta files */
|
|
|
|
|| (ext == "asx") || (ext == "asf") || (ext == "wvx") || (ext == "wax") ) /* windows meta files */
|
|
|
|
{
|
|
|
|
{
|
|
|
|
kdDebug() << "libmpvpart: Check for kaffeine/noatun/m3u/pls/asx playlist\n";
|
|
|
|
|
|
|
|
TQString localFile;
|
|
|
|
TQString localFile;
|
|
|
|
if ( TDEIO::NetAccess::download(m_mrl.kurl(), localFile, widget()) ) {
|
|
|
|
if ( TDEIO::NetAccess::download(m_mrl.kurl(), localFile, widget()) ) {
|
|
|
|
TQFile file( localFile );
|
|
|
|
TQFile file( localFile );
|
|
|
@ -358,23 +356,18 @@ bool MpvPart::openURL(const MRL& mrl) {
|
|
|
|
file.close();
|
|
|
|
file.close();
|
|
|
|
|
|
|
|
|
|
|
|
if ( secondLine.contains("kaffeine", false) ) {
|
|
|
|
if ( secondLine.contains("kaffeine", false) ) {
|
|
|
|
kdDebug() << "libmpvpart: Try loading kaffeine playlist\n";
|
|
|
|
|
|
|
|
playlist = PlaylistImport::kaffeine( localFile, m_playlist );
|
|
|
|
playlist = PlaylistImport::kaffeine( localFile, m_playlist );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( secondLine.contains("noatun", false) ) {
|
|
|
|
if ( secondLine.contains("noatun", false) ) {
|
|
|
|
kdDebug() << "libmpvpart: Try loading noatun playlist\n";
|
|
|
|
|
|
|
|
playlist = PlaylistImport::noatun( localFile, m_playlist);
|
|
|
|
playlist = PlaylistImport::noatun( localFile, m_playlist);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( firstLine.contains("asx", false) ) {
|
|
|
|
if ( firstLine.contains("asx", false) ) {
|
|
|
|
kdDebug() << "libmpvpart: Try loading asx playlist\n";
|
|
|
|
|
|
|
|
playlist = PlaylistImport::asx( localFile, m_playlist );
|
|
|
|
playlist = PlaylistImport::asx( localFile, m_playlist );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( firstLine.contains("[playlist]", false) ) {
|
|
|
|
if ( firstLine.contains("[playlist]", false) ) {
|
|
|
|
kdDebug() << "libmpvpart: Try loading pls playlist\n";
|
|
|
|
|
|
|
|
playlist = PlaylistImport::pls( localFile, m_playlist );
|
|
|
|
playlist = PlaylistImport::pls( localFile, m_playlist );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ext == "m3u" || ext == "m3u8") { //indentify by extension
|
|
|
|
if (ext == "m3u" || ext == "m3u8") { //indentify by extension
|
|
|
|
kdDebug() << "libmpvpart: Try loading m3u playlist\n";
|
|
|
|
|
|
|
|
playlist = PlaylistImport::m3u( localFile, m_playlist );
|
|
|
|
playlist = PlaylistImport::m3u( localFile, m_playlist );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -383,13 +376,11 @@ bool MpvPart::openURL(const MRL& mrl) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// check for ram playlist
|
|
|
|
// check for ram playlist
|
|
|
|
if ( (ext == "ra") || (ext == "rm") || (ext == "ram") || (ext == "lsc") || (ext == "pl") ) {
|
|
|
|
if ( (ext == "ra") || (ext == "rm") || (ext == "ram") || (ext == "lsc") || (ext == "pl") ) {
|
|
|
|
kdDebug() << "libmpvpart: Try loading ram playlist\n";
|
|
|
|
|
|
|
|
playlist = PlaylistImport::ram( m_mrl, m_playlist, widget() );
|
|
|
|
playlist = PlaylistImport::ram( m_mrl, m_playlist, widget() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!playlist)
|
|
|
|
if (!playlist)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
kdDebug() << "libmpvpart: Got single track" << endl;
|
|
|
|
|
|
|
|
m_playlist.append( m_mrl );
|
|
|
|
m_playlist.append( m_mrl );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -608,10 +599,7 @@ void MpvPart::slotReloadSubtitles() {
|
|
|
|
const char *rm_args[] = {"sub-remove", nullptr};
|
|
|
|
const char *rm_args[] = {"sub-remove", nullptr};
|
|
|
|
mpv_command(m_mpv, rm_args);
|
|
|
|
mpv_command(m_mpv, rm_args);
|
|
|
|
|
|
|
|
|
|
|
|
if ((!subtitles.isEmpty()) && (subId > -1)) {
|
|
|
|
if ((!subtitles.isEmpty()) && (subId > -1)) { // Add requested subtitles
|
|
|
|
kdDebug() << "adding subtitle file " << subtitles[subId] << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add requested subtitles
|
|
|
|
|
|
|
|
const char *add_args[] = {"sub-add", subtitles[subId].local8Bit(), nullptr};
|
|
|
|
const char *add_args[] = {"sub-add", subtitles[subId].local8Bit(), nullptr};
|
|
|
|
mpv_command_async(m_mpv, 0, add_args);
|
|
|
|
mpv_command_async(m_mpv, 0, add_args);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -686,9 +674,6 @@ void MpvPart::slotAddSubtitles() {
|
|
|
|
i18n("*.smi *.srt *.sub *.txt *.ssa *.asc|Subtitle Files\n*.*|All Files"),
|
|
|
|
i18n("*.smi *.srt *.sub *.txt *.ssa *.asc|Subtitle Files\n*.*|All Files"),
|
|
|
|
0, i18n("Select Subtitle File")).path();
|
|
|
|
0, i18n("Select Subtitle File")).path();
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug()<<"slotAddSubtitles: "<<subtitleURL<<endl;
|
|
|
|
|
|
|
|
kdDebug()<<" exists: "<<TQFile::exists(subtitleURL)<<endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (subtitleURL.isEmpty() || !TQFile::exists(subtitleURL)) {
|
|
|
|
if (subtitleURL.isEmpty() || !TQFile::exists(subtitleURL)) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -706,8 +691,6 @@ void MpvPart::slotContextSetSubtitles(int choice) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug() << "switching to subtitle: " << subId
|
|
|
|
|
|
|
|
<< " (" << m_subs->text(choice) << ")" << endl;
|
|
|
|
|
|
|
|
m_mrl.setCurrentSubtitle(subId);
|
|
|
|
m_mrl.setCurrentSubtitle(subId);
|
|
|
|
emit signalNewMeta(m_mrl);
|
|
|
|
emit signalNewMeta(m_mrl);
|
|
|
|
slotReloadSubtitles();
|
|
|
|
slotReloadSubtitles();
|
|
|
@ -777,8 +760,6 @@ void MpvPart::hideContextMenu() {
|
|
|
|
void MpvPart::updateMetadata() {
|
|
|
|
void MpvPart::updateMetadata() {
|
|
|
|
if (!m_mpv) return;
|
|
|
|
if (!m_mpv) return;
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug() << "update metadata" << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Errors reading metadata are not fatal, as this is not something that
|
|
|
|
// Errors reading metadata are not fatal, as this is not something that
|
|
|
|
// the user explicitly requests
|
|
|
|
// the user explicitly requests
|
|
|
|
mpv_node result;
|
|
|
|
mpv_node result;
|
|
|
@ -818,7 +799,6 @@ void MpvPart::updateMetadata() {
|
|
|
|
else if (key == "comment" || key == "icy-description") {
|
|
|
|
else if (key == "comment" || key == "icy-description") {
|
|
|
|
m_mrl.setComment(value);
|
|
|
|
m_mrl.setComment(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
kdDebug() << "e " << map->keys[i] << ": " << map->values[i].u.string << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
mpv_free_node_contents(&result);
|
|
|
|
mpv_free_node_contents(&result);
|
|
|
@ -879,9 +859,10 @@ data = result.u.list->values[4].u.ba;
|
|
|
|
#undef CHECK_ARG
|
|
|
|
#undef CHECK_ARG
|
|
|
|
|
|
|
|
|
|
|
|
// Validate image format (we can handle only bgr0, which is the default anyway)
|
|
|
|
// Validate image format (we can handle only bgr0, which is the default anyway)
|
|
|
|
kdDebug() << "mpv: screenshot-raw image format: " << format << endl;
|
|
|
|
|
|
|
|
if (qstrcmp(format, "bgr0") != 0) {
|
|
|
|
if (qstrcmp(format, "bgr0") != 0) {
|
|
|
|
THROW_ERROR_FREE("Internal error", "mpv: screenshot-raw returned image format other than bgr0")
|
|
|
|
THROW_ERROR_FREE("Internal error",
|
|
|
|
|
|
|
|
TQString("mpv: screenshot-raw returned image format other than bgr0 (%1)")
|
|
|
|
|
|
|
|
.arg(format))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|