Play specific item in m3u playlist !?

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
Galuel
New Cone
New Cone
Posts: 3
Joined: 27 May 2016 09:21

Play specific item in m3u playlist !?

Postby Galuel » 27 May 2016 09:40

I made extensive search about VLC comand line and other stuff, but did not found the solution. I use VLC 2.1.6 in Ubuntu 14.04.

When creating the launcher command of VLC to read a m3u file :

Code: Select all

vlc http://mafreebox.freebox.fr/freeboxtv/playlist.m3u
vlc plays the first item of the list. Since this list is made by a provider, it would be nice not to re-organise the m3u to make another one at each launch, but to be able to play directly the item we would like to play by default.

The solution I found, was to open directly the URL of the channel I want to read with the command line :

Code: Select all

vlc http://mafreebox.freebox.fr/freeboxtv/playlist.m3u --open=rtsp://mafreebox.freebox.fr/fbxtv_pub/stream?namespace=1&service=203&flavour=ld
But this is not elegant, since I have a playlist in VLC containing two lines :

rtsp://mafreebox.freebox.fr/fbxtv_pub/stream?namespace=1&service=203&flavour=ld
http://mafreebox.freebox.fr/freeboxtv/playlist.m3u

So I loose the name of the channel, and the m3u is not opened, so to change the channel I need 2 clicks, a first one to expand the m3u playlist, and the second to choose the stream.

A solution could be something like

Code: Select all

vlc http://mafreebox.freebox.fr/freeboxtv/playlist.m3u?PLAYLIST_PLAY=203
Or

Code: Select all

vlc http://mafreebox.freebox.fr/freeboxtv/playlist.m3u --playlist_play=203
Or perhaps there is a solution, but I did not find anyone (I found the possibility to create a specific shell with something like "activate VLC DBUS", but did not understand how to do that, and it seemed complicated for such a simple feature.

Rémi Denis-Courmont
Developer
Developer
Posts: 15321
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Play specific item in m3u playlist !?

Postby Rémi Denis-Courmont » 28 May 2016 15:22

VLC cannot know which item you want to play. The provider is likely to change the order, or add or remove items sooner rather than later, so using an offset won't work.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

kmf31
Cone that earned his stripes
Cone that earned his stripes
Posts: 308
Joined: 11 Mar 2007 21:47

Re: Play specific item in m3u playlist !?

Postby kmf31 » 28 May 2016 16:49

I have recently written a (Linux) script "FB_VIEW.sh" just for the Free playlist (for the rtsp TV channels of the Adsl provider "Free" in France) which works with the grep command and the playlist names to start viewing a channel with vlc.

You simply do:

FB_VIEW.sh pattern1 pattern2 ... patternX

to find the first channel in the list containing the patterns (not case-sensitive) and to start the appropriate rtsp flux with vlc. (There is also a "-dummy" option which only displays the first matched channel without actually starting vlc).


For example to start Paramount Channel you can do:

FB_VIEW.sh paramou

(incomplete subpatterns are already sufficient if the search result is unique)

but if you want to be sure to start the HD version you do:

FB_VIEW.sh paramou HD

(otherwise the script might find the "bas debit" version of Paramount channel if it is first in the playlist).

One can also use channel numbers for pattern:

FB_VIEW.sh 14 HD

for HD-Adsl version of France 4 (which is number "14" in French TV) or

FB_VIEW.sh 14 TNT

for the TNT version of France 4 (obtained by antenna and not by Adsl from the Freebox).

If somebody is interested I can provide this script here. There is also a version of the script to program records (with at daemon) of such channels and using vlc.

For the moment the script requires the playlist to be stored at some place as file but it would be easy to modify it such that the playlist is read everytime from the Freebox (using wget and which would of course provide some overhead).


The only thing I would like to do as well and for which I did not find a simple solution yet is to search letters with french accents using a pattern not having the accent, e. g. the word "cherie" should also match "Chérie" (channel 25) in the playlist. The difference between "c" and "C" is not a problem (already implemented in the script) but the difference between "e" and "é" is not yet implemented in my script (if somebody has a nice idea on this ...).

Galuel
New Cone
New Cone
Posts: 3
Joined: 27 May 2016 09:21

Re: Play specific item in m3u playlist !?

Postby Galuel » 29 May 2016 11:05

VLC cannot know which item you want to play. The provider is likely to change the order, or add or remove items sooner rather than later, so using an offset won't work.
But VLC starts with 1st item. So it could start with 10th or 40th one, there is no reason to give the 1st item a priority.
If somebody is interested I can provide this script here. There is also a version of the script to program records (with at daemon) of such channels and using vlc.
Yes, please do it ! It seems a good solution.
For the moment the script requires the playlist to be stored at some place as file but it would be easy to modify it such that the playlist is read everytime from the Freebox (using wget and which would of course provide some overhead).
It's ok, I'll try to do so.
The only thing I would like to do as well and for which I did not find a simple solution yet is to search letters with french accents using a pattern not having the accent, e. g. the word "cherie" should also match "Chérie" (channel 25) in the playlist. The difference between "c" and "C" is not a problem (already implemented in the script) but the difference between "e" and "é" is not yet implemented in my script (if somebody has a nice idea on this ...).
It seems not so important to me, but I understand the feature.

kmf31
Cone that earned his stripes
Cone that earned his stripes
Posts: 308
Joined: 11 Mar 2007 21:47

Re: Play specific item in m3u playlist !?

Postby kmf31 » 29 May 2016 12:15

If somebody is interested I can provide this script here. There is also a version of the script to program records (with at daemon) of such channels and using vlc.
Yes, please do it ! It seems a good solution.
Here is the script:

Code: Select all

if [[ "$1" == "" ]] ; then exit 1 fi DUMMY="" # location of playlist PLAYLIST=/tmp/playlist.m3u ### the playlist is only updated from the Freebox if the playlist file does ### not exist ### simply remove the playlist file given by the location $PLAYLIST ### to force an update the next time the script is called if [[ ! -f $PLAYLIST ]] ; then RAWPLAYLIST=`mktemp` echo "recovering Playlist" wget -q http://mafreebox.freebox.fr/freeboxtv/playlist.m3u -O $RAWPLAYLIST ### the following trick is found from: ### http://stackoverflow.com/questions/10207354/how-to-remove-all-of-the-diacritics-from-a-file ### and allows to replace accent characters by non-accent characters iconv -f utf8 -t ascii//TRANSLIT $RAWPLAYLIST > $PLAYLIST \rm $RAWPLAYLIST fi COMMAND="grep -v rtsp $PLAYLIST | grep -v EXTM3U " for i in $@ ; do if [[ $i == "-dummy" ]] ; then DUMMY=dummy else COMMAND=$COMMAND" | grep -i "$i fi done COMMAND=$COMMAND" | head -1" FLINE=`mktemp` eval $COMMAND > $FLINE LINE=`cat $FLINE` N=`grep -xn -f $FLINE $PLAYLIST | cut -d : -f 1` \rm $FLINE N=$((N + 1)) LINK=`head -n $N $PLAYLIST | tail -1` if [[ "$LINE" == "" ]] ; then echo "No matching channel found" exit 1 fi echo "Opening vlc for: $LINE" echo $LINK if [[ "$DUMMY" == "" ]] ; then vlc "$LINK" --network-caching=1500 --no-loop fi
You save it in a place in your PATH (maybe in your private bin folder: "~/bin/" if this is in your PATH ) for example as "FB_VIEW.sh", you make it executable by "chmod +x FB_VIEW.sh".
Then the simple use is:

Code: Select all

FB_VIEW.sh "list of patterns"
to start the first channel in the playlist that contains these patterns (order is not important between subpatterns separated by a space). The pattern list may contain the word "-dummy" in which case only the found channel and rtsp link is shown but vlc is not actually started. The pattern match is not case sensitive. You may also use the programm number of channel as pattern but on the Freebox you may have different fluxes (Adsl, TNT, HD, standard, bas-debit) for the same number and you may need to add a second pattern such as HD or TNT to select the right TV flux.

In this version the first time you start the script it will download the playlist from the Freebox (using wget), replace the accented characters by non-accented characters and store it in the default location /tmp/playlist.m3u (I found the trick for this yesterday). When you want later to force an update of the playlist you simply remove the existing file and the update will be done the next time the script is called (this takes about 1-2 seconds). Note that Free applies regularly certain (typically modest) changes on the playlist.
You can easily modify the name/default location of the playlist and also remove the "update-part" (if you don't like it) in which case you have to provide the playlist manually in the appropriate location.

Do you want to record Freebox TV on the PC using a similar script ?

Galuel
New Cone
New Cone
Posts: 3
Joined: 27 May 2016 09:21

Re: Play specific item in m3u playlist !?

Postby Galuel » 29 May 2016 12:32

Do you want to record Freebox TV on the PC using a similar script ?
No, I don't.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 27 guests

cron