4

I am trying to make a program in python to open a VLC "Browsing File window" on Ubuntu

global process
import io,sys,os
import subprocess

myprocess = subprocess.call(['vlc','/home/tansen'])

but the code above just opens the 'VLC Player' not the file opening window Can you please guide me on how to get the required result I am adding the vlc filing opening image as wellenter image description here

Thank you

2 Answers 2

2

according to the documentation, the correct syntax should be

vlc -vvv video.mp4

and the python code that you can use is

subprocess.POPEN(['vlc', '-vvv', '/path/to/video.mp4'])

You can also add the PIPE to dump the output from vlc as well.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your answer> but i just want to file browsing window, not the actual file.
ahh.. sorry i thought that you have the file that you want to play
0

What OS platform?

On Linux: If you run qdbusviewer you'll see the dbus methods available. I don't see one for showing the file dialog, but there is one for opening a URL:

qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri test.mp3

So from Python:

import subprocess
subprocess.call(["qdbus", "org.mpris.MediaPlayer2.vlc", "/org/mpris/MediaPlayer2", "org.mpris.MediaPlayer2.Player.OpenUri", "file:///home/john/test.mp3"])'

Or:

import gobject
gobject.threads_init()
from dbus import glib
glib.init_threads()
import dbus
bus = dbus.SessionBus()
obj = bus.get_object("org.mpris.MediaPlayer2.vlc", "/org/mpris/MediaPlayer2")
iface = dbus.Interface(obj, "org.mpris.MediaPlayer2.Player")
iface.OpenUri("file:///home/john/test.mp3")

On Windows: Try COM?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.