OmerTu/GoogleHomeKodi

Space problem with playtvchannelbyname

lb544 opened this issue · 3 comments

lb544 commented

Hi,
First, thanks a lot for your great work !
But I have a problem with your last release of your docker image
I use an IFTTT webhook to target the node.js server listening on 8099
When I Say in French "Change la télé sur $", IFTTT request : http://xxxxx:8099/playtvchannelbyname?q={{TextField}}
At this time, all is OK

But, with your last release, when I Say "Change la télé sur M6" at Google Assistant, it request http://xxxxx:8099/playtvchannelbyname?q=sur M 6 (with a space)
The space maybe added by Google (Note that also the word "sur" is added by Google because the TextField from IFTTT may don't have this word)

My Kodi/TVHeadend is setup with "M6" channel (no space)

This is the stack in logs :

==== BEGIN === route: /playtvchannelbyname,
Sending command to kodi http://172.17.0.1:18080/jsonrpc:
,
{,
"jsonrpc": "2.0",,
"id": 1,,
"method": "PVR.GetChannels",,
"params": {,
"channelgroupid": "alltv",,
"properties": [,
"uniqueid",,
"channelnumber",
],
},
},
request failed,
route: /playtvchannelbyname,
query: { q: 'sur m 6' },
error: Error: No fuzzy match for 'sur m 6',
at fuzzySearchBestMatch (/home/node/app/helpers.js:156:15),
at /home/node/app/helpers.js:1157:29,
at processTicksAndRejections (internal/process/task_queues.js:97:5),
body: { token: 'KodiHomeWithGH' },�
versions: {,
node: '14.4.0',,
v8: '8.1.307.31-node.33',,
uv: '1.37.0',,
zlib: '1.2.11',,
brotli: '1.0.7',,
ares: '1.16.0',,
modules: '83',,
nghttp2: '1.41.0',,�
napi: '6',,
llhttp: '2.0.4',,
openssl: '1.1.1g',,
cldr: '37.0',,
icu: '67.1',,
tz: '2019c',,
unicode: '13.0',
},
==== END === route: /playtvchannelbyname,

But, an other channel with correct name in Kodi work perfectly :

==== BEGIN === route: /playtvchannelbyname,
Sending command to kodi http://172.17.0.1:18080/jsonrpc:
,
{,
"jsonrpc": "2.0",,
"id": 1,,
"method": "PVR.GetChannels",,
"params": {,
"channelgroupid": "alltv",,
"properties": [,
"uniqueid",,
"channelnumber",
],
},
},
best fuzzy match for 'sur france 2' is: {,�,
{,
channelid: 94,,
channelnumber: 2,,
label: 'France 2',,
uniqueid: 985371888,
},,
refIndex: 1,,
score: 0.4598586132649167,
},
Playing PVR channel France 2 - 2 (94),
Sending command to kodi http://172.17.0.1:18080/jsonrpc:
,
{,
"jsonrpc": "2.0",,
"id": 1,,
"method": "Player.Open",,
"params": {,
"item": {,
"channelid": 94,
},
},
},
==== END === route: /playtvchannelbyname,

The problem is that an older release (around november 2019 I think) with playpvrchannelbyname works perfectly with the space added by Google.

Do you have a solution ?
Thanks

the root problem is the undesired inclusion of sur, this throws the fuzzy-matching-algorithm way off :D
I have seen the same issue with the english language with the word of.
I am now stripping sur statically away from the phrase. I hope this helps more that it makes things worse xD
Please report back if this helped.

lb544 commented

Hi !
Yeah it's working now :) Thanks :)

glad it works for you :)