Open DunklerPhoenix opened 4 years ago
Okay quick and dirty fix: https://github.com/burnnat/hdhr/compare/master...DunklerPhoenix:master
The Problem: I'm living in switzerland and our channelnames have spaces and special signs like ê é
Channellist (after removing non-ascii):
1068: 849 RTL Radio F
1069: 785 hr2
1301: 701 Radio SRF 1
1302: 709 Radio SRF 2 Kul
1303: 710 Radio SRF 3
1304: 711 Radio SRF 4 New
1305: 712 Radio SRF Musik
1306: 713 Radio SRF Virus
1307: 714 Swiss Pop
1308: 715 Swiss Classic
1309: 716 Swiss Jazz
1310: 717 Radio RTR
1443: 768 BR-KLASSIK
1453: 772 SWR4 BW
1483: 787 RTL Radio
1600: 901 RSI Rete uno
1601: 902 RSI Rete due
1602: 903 RSI Rete tre
1603: 911 Rai Radio 1
1604: 912 Rai Radio 2
1605: 913 Rai Radio 3
1607: 915 Rai Radio 3 Cla
1613: 923 Radio 24 ore
1615: 909 RSI Rete uno GR
1620: 917 RDS
1621: 919 Radio Italia An
1622: 920 Virgin Radio It
1623: 921 RTL 102.5
1624: 922 Radio 101
1630: 935 Radio Maria
1631: 761 Radio Maria Sch
1632: 924 Radio Monte Car
1634: 927 Radio Studio St
1636: 929 Otto FM Italy
1638: 928 RTO
1640: 926 Radio Capital
1642: 925 DEEJAY
1644: 930 Otto FM
1700: 801 RTS la 1 re
1701: 802 RTS Espace 2
1702: 803 RTS Couleur 3
1703: 804 RTS Option Musi
1803: 884 Kral FM
1807: 887 HRT-HR1
1824: 931 Radio Sportiva
9038: 1 SRF 1 HD
9039: 2 SRF zwei HD
9040: 301 RTS 1 HD
tsid=0x000F
onid=0x0001
Raw-Channellist (before removing ascii):
raw = b'1068: 849 RTL Radio F\n1069: 785 hr2\n1301: 701 Radio SRF 1\n1302: 709 Radio SRF 2 Kul\n1303: 710 Radio SRF 3\n1304: 711 Radio SRF 4 New\n1305: 712 Radio SRF Musik\n1306: 713 Radio SRF Virus\n1307: 714 Swiss Pop\n1308: 715 Swiss Classic\n1309: 716 Swiss Jazz\n1310: 717 Radio RTR\n1443: 768 BR-KLASSIK\n1453: 772 SWR4 BW\n1483: 787 RTL Radio\n1600: 901 RSI Rete uno\n1601: 902 RSI Rete due\n1602: 903 RSI Rete tre\n1603: 911 Rai Radio 1\n1604: 912 Rai Radio 2\n1605: 913 Rai Radio 3\n1607: 915 Rai Radio 3 Cla\n1613: 923 Radio 24 ore\n1615: 909 RSI Rete uno GR\n1620: 917 RDS\n1621: 919 Radio Italia An\n1622: 920 Virgin Radio It\n1623: 921 RTL 102.5\n1624: 922 Radio 101\n1630: 935 Radio Maria\n1631: 761 Radio Maria Sch\n1632: 924 Radio Monte Car\n1634: 927 Radio Studio St\n1636: 929 Otto FM Italy\n1638: 928 RTO\n1640: 926 Radio Capital\n1642: 925 DEEJAY\n1644: 930 Otto FM\n1700: 801 RTS la 1 \xc3\xa8re\n1701: 802 RTS Espace 2\n1702: 803 RTS Couleur 3\n1703: 804 RTS Option Musi\n1803: 884 Kral FM\n1807: 887 HRT-HR1\n1824: 931 Radio Sportiva\n9038: 1 SRF 1 HD\n9039: 2 SRF zwei HD\n9040: 301 RTS 1 HD\ntsid=0x000F\nonid=0x0001\n'
Because of the Channel 1700: 801 occured the decoding error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 860: ordinal not in range(128)
To fix this I remove all non-ascii chars in function ascii_str(value)
The second problem is that the regex does not support channelnames with multiple spaces like "1302: 709 Radio SRF 2 Kul" +
This one would not be matched.
To fix this I changed the "name"-part of the regex like this:
r'^(?P<program>\d+): (?P<vchannel>\d+(?:\.\d+)?)(?: (?P<name>\S+))??(?: \((?P<flags>.+)\))?$',
https://regex101.com/r/LTXWbz/1
to
r'^(?P<program>\d+): (?P<vchannel>\d+(?:\.\d+)?)(?: (?P<name>.+))??(?: \((?P<flags>.+)\))?$',
https://regex101.com/r/NSYMIM/1
this will break the flag-support, but I didn't see any flags in any channellist, but multiple channels with () like: "305 | France 3 (Alsac"
So I think it's okay.
Thanks @Crypto90 for the help
Heho I have the the HDHR Expand and getting the following error from HomeAssistant. The connection to HDHR works even with command line tools. Is there something to fix this?
Screenshot from Home-Assistant
EDIT: Updated issue