[vlc-devel] [PATCH] skin2: fix opening playlist

Pierre Lamot pierre at videolabs.io
Thu Nov 23 09:33:26 CET 2017


---
 modules/gui/qt/dialogs_provider.cpp          |  9 ++++++++-
 modules/gui/skins2/commands/cmd_playlist.cpp | 10 +++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/dialogs_provider.cpp b/modules/gui/qt/dialogs_provider.cpp
index 4f15bee9c0..4f9f2888ca 100644
--- a/modules/gui/qt/dialogs_provider.cpp
+++ b/modules/gui/qt/dialogs_provider.cpp
@@ -616,7 +616,14 @@ void DialogsProvider::openAPlaylist()
                                         EXT_FILTER_PLAYLIST );
     foreach( const QString &url, urls )
     {
-        playlist_Import( THEPL, qtu( url ) );
+        char* psz_path = vlc_uri2path(qtu( url ));
+        if ( !psz_path )
+        {
+            msg_Warn( p_intf, "unable to load playlist '%s'", qtu( url ) );
+            continue;
+        }
+        playlist_Import( THEPL, psz_path );
+        free( psz_path );
     }
 }
 
diff --git a/modules/gui/skins2/commands/cmd_playlist.cpp b/modules/gui/skins2/commands/cmd_playlist.cpp
index dc38840dda..ab5d94c119 100644
--- a/modules/gui/skins2/commands/cmd_playlist.cpp
+++ b/modules/gui/skins2/commands/cmd_playlist.cpp
@@ -24,6 +24,7 @@
 
 #include "cmd_playlist.hpp"
 #include <vlc_playlist.h>
+#include <vlc_url.h>
 #include "../src/vlcproc.hpp"
 #include "../utils/var_bool.hpp"
 
@@ -64,7 +65,14 @@ void CmdPlaylistRepeat::execute()
 
 void CmdPlaylistLoad::execute()
 {
-    playlist_Import( getPL(), m_file.c_str() );
+    char* psz_path = vlc_uri2path( m_file.c_str() );
+    if ( !psz_path )
+    {
+        msg_Err(getIntf(),"unable to load playlist %s", m_file.c_str() );
+        return;
+    }
+    playlist_Import( getPL(), psz_path );
+    free( psz_path );
 }
 
 
-- 
2.14.1



More information about the vlc-devel mailing list