-
Notifications
You must be signed in to change notification settings - Fork 48
Description
I am trying to play some media with inputstream.ffmpegdirect on Kodi 21.1 on MACOS
I need to pass some headers as well as the stream info to get the URL
headers = {
"X-Plex-Token" : token,
"X-Forwarded-For" : "173.166.164.121",
"user-agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0"
}
The stream URL looks like https://epg.provider.plex.tv/library/parts/5e20b730f2f8d5003d739db7-646fab0e43d6d6838db81a6a?X-Plex-Token=nHD9WHxxk3uwKwL7VWhG
I am adding the headers to the URL with this bit of python
x = ""
for key in headers:
x += u'{0}={1}&'.format(key, urllib.parse.quote(u'{}'.format(headers[key]).encode('utf8')))
And then putting it all together
liz = xbmcgui.ListItem(path=url + '|' + x)
liz.setProperty('inputstream', 'inputstream.ffmpegdirect')
liz.setProperty('IsPlayable', 'true')
liz.setProperty('inputstream.ffmpegdirect.stream_mode', 'timeshift')
liz.setProperty('inputstream.ffmpegdirect.is_realtime_stream', 'true')
liz.setProperty('inputstream.ffmpegdirect.manifest_type', 'hls')
xbmcplugin.setResolvedUrl(handle, True, liz)
looking at the log, it seems the initial curl works
CCurlFile::GetMimeType - <https://epg.provider.plex.tv/library/parts/5e20b730f2f8d5003d739db7-646fab0e43d6d6838db81a6a?X-Plex-Token=nHD9WHxxk3uwKwL7VWhG|X-Plex-Token=nHD9WHxxk3uwKwL7VWhG&X-Forwarded-For=173.166.164.121&user-agent=Mozilla/5.0%20%28Macintosh%3B%20Intel%20Mac%20OS%20X%2010_15_7%29%20AppleWebKit/537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome/131.0.0.0%20Safari/537.36%20Edg/131.0.0.0&> -> application/x-mpegurl
But, the headers are ignored / changed later on
2025-01-07 16:03:30.260 T:332467 debug : AddOnLog: inputstream.ffmpegdirect: CDVDDemuxFFmpeg::GetFFMpegOptionsFromInput() adding ffmpeg option 'user_agent: 0'
2025-01-07 16:03:30.260 T:332467 debug : AddOnLog: inputstream.ffmpegdirect: CDVDDemuxFFmpeg::GetFFMpegOptionsFromInput() adding custom header option 'X-Forwarded-For: 0'
2025-01-07 16:03:30.260 T:332467 debug : AddOnLog: inputstream.ffmpegdirect: CDVDDemuxFFmpeg::GetFFMpegOptionsFromInput() ignoring header option 'X-Plex-Token'
2025-01-07 16:03:30.260 T:332467 debug : AddOnLog: inputstream.ffmpegdirect: CDVDDemuxFFmpeg::GetFFMpegOptionsFromInput() adding ffmpeg option 'user_agent: 0'
i have attached the full log file
kodi.log.txt
any pointers/help would be greatly appreciated!