Page 1 of 1

[Python] Using playlists

Posted: 09 Apr 2015 11:39
by Nepho
Hi.

How do I handle playlists?
First of all, the insert_media() method will randomly cause an access violation, so this sucks.
But I can skip this part anyway by creating the playlist by hand. Anyway.
Now that I have my playlist, how the hell do I tell VLC to play it with a shuffle? There is absolutely nothing about this in the documentation. It's a basic feature, why can't I do it?
Next, how the hell do I get the title/filename of the currently played video? The only thing that comes close to it is the get_title() method of the MediaPlayer class (this method is not included in the MediaListPlayer class for some reason), and this get_title() doesn't even get me the title, it ""[returns] title number currently playing, or -1". In my case, it always returns 00, I don't really see what I can do with that.

Anyway, someone to help me? Or should I just switch to another media player?

Thanks.

Re: [Python] Using playlists

Posted: 14 Apr 2015 21:36
by Jean-Baptiste Kempf
MediaList are to be used for playlists.

Re: [Python] Using playlists

Posted: 14 Apr 2015 22:56
by Nepho
Hello Jean-Baptiste,

Thank you for your answer.

I have several problems with the MediaList class (and its associated MediaListPlayer).

Firstly, when I add Medias to a MediaList, it will sometimes raise an access violation exception.
I sent a ticket to the dev team about this, I hope it will get fixed soon. But I can get around this bug
by manually creating a playlist before using my script.

Secondly, I can't get any information about the media being played while using a MediaListPlayer.
As described in my first post, the only thing that could help me is only a method of the MediaPlayer class,
and it's called get_title(). Now, it's surprising, but get_title() doesn't return me a string with the file name,
but only an integer (which is always 0, in my case). So... I don't really understand how all of this must be used.

Some help would be greatly appreciated, since using the MediaListPlayer would fix most of my issues.

Thanks in advance.

Re: [Python] Using playlists

Posted: 14 Apr 2015 23:08
by Jean-Baptiste Kempf
I don't know enough the Python bindings for this.

Re: [Python] Using playlists

Posted: 15 Apr 2015 17:49
by Nepho
Alright, thanks for the help anyway.

Since nobody has been able to help me for now a whole month,
I'll just assume that that either the documentation is not complete,
or the Python bindings are just not fully working/complete.

Do you know any other media player that has a Python API I could use?

Thanks in advance!

Re: [Python] Using playlists

Posted: 11 May 2015 23:55
by OlivierAubert
Regarding your question about getting the currently playing item, the libvlc API (from libvlc_media_list_player.h) does not provide such a function. Hence the python bindings cannot provide it either. If you need more control, you should manage the playlist by yourself (and this is not a limitation of the python bindings).