phpbg / watchtv

This is a small server that allows you to watch digital television on your computer and your local network.
MIT License
28 stars 5 forks source link

Problem playing channels with a quote mark in the name #8

Closed oliviernes closed 1 year ago

oliviernes commented 1 year ago

Hi Samuel,

My pull request #7 fixed the syntax error when I was clicking on the "Refresh channels" button of the configure page because of the quote mark in the channel "L’Equipe".

The error (from PHP) was : PHP Warning: syntax error, unexpected $end, expecting ']'

The channels can be displayed after adding the INI_SCANNER_RAW option in parse_ini_file().

They can all be played correctly with mpv but not "L’Equipe". Tinkering in your code, I thought I fixed the problem by removing the quote mark in the M3u8.php file because the weird thing is that sometimes it’s possible to play the channel "L’Equipe" (it worked by chance just after I modified the code and I didn’t try enough times). So I thought I fixed the problem before you show me that the M3u8.php file is only generating a m3u8 file.

The error (from bash) playing the channel "L’Equipe" is [warning] sh: 1: Syntax error: Unterminated quoted string

The only solution I found was to add a sed command after the dvbv5-scan like that :

sudo dvbv5-scan -v -o /path/to/channels.conf /path/to/data/dtv-scan-tables/dvb-t/fr-All && sudo sed -i -e "s/'/_/g" /path/to/channels.conf

The sed command replaces all single quotes with an underscore which seems fine as the single quotes should only appear in the channels’ names.

It is also possible to put back the quote mark in the M3u8.php generator as I have done in the pull request →replace("_","’")

As I don’t know PHP, I can’t add the sed command after the dvbv5-scan but it seems it solved the quote mark problem because I can always play the "L’Equipe" channel after replacing the quote mark by _.

What a stupid idea to put a quote mark in a tv channel name! :-)

oliviernes commented 1 year ago

The issue was fixed by adding double quotes mark in the dvbv5-zap command. It should work as long as someone doesn't put a double quote in a TV channel's name :-)