Closed Gregsr closed 4 years ago
Hi there,
I'm not a Windows user myself but you might find this helpful to workout what a file uri needs to look like on Windows:
https://en.wikipedia.org/wiki/File_URI_scheme#Windows
If the wikipedia details there are correct it looks like you might need to switch your file uris to always use forward slashes and add another one forward slash after file://
In other words given what you've supplied, this would be my best guess at working config:
{
"epgurl": "file:///N:/Perso/Kodi/IPTV/EPG/xmltv.xml",
"groups": "FRANCE FHD | TV",
"log_enabled": true,
"m3uurl": "file:///N:/Perso/Kodi/IPTV/200723_tv_channels_plus.m3u",
"outdirectory": "file:///N:/Perso/Kodi/IPTV/EPG/Test/",
"outfilename": "mini",
"range": 12
}
..or something like that :)
Feel free to add another comment if you get it working or otherwise.
It does not work. Here are the logs for "forward slash" and for "backslash":
Forward slash
2020-07-30T11:01:56.971600 file:///N:/Perso/Kodi/IPTV/EPG/Test does not exist in your filesystem
2020-07-30T11:01:56.972600 saving to log: file:///N:/Perso/Kodi/IPTV/EPG/Test\process.log
2020-07-30T11:01:56.974600 Traceback (most recent call last):
File "m3u-epg-editor-py3.py", line 977, in <module>
main()
File "m3u-epg-editor-py3.py", line 221, in main
args = validate_args()
File "m3u-epg-editor-py3.py", line 314, in validate_args
abort_process(out_directory + ' does not exist in your filesystem', 1, args)
File "m3u-epg-editor-py3.py", line 444, in abort_process
save_log(args)
File "m3u-epg-editor-py3.py", line 477, in save_log
with io.open(log_target, "w", encoding="utf-8") as log_file:
OSError: [Errno 22] Invalid argument: 'file:///N:/Perso/Kodi/IPTV/EPG/Test\\process.log'
2020-07-30T11:01:56.976600 process terminated early due to an exception
2020-07-30T11:01:56.980600 saving to log: D:\Users\source\repos\m3u-epg-editor\process.log
2020-07-30T11:01:56.986600 script runtime: 0 minutes 0 seconds
2020-07-30T11:01:56.987600 process completed
Backslash
2020-07-30T11:17:37.232600 file:///N:\Perso\Kodi\IPTV\EPG\Test does not exist in your filesystem
2020-07-30T11:17:37.232600 saving to log: file:///N:\Perso\Kodi\IPTV\EPG\Test\process.log
2020-07-30T11:17:37.239600 Traceback (most recent call last):
File "m3u-epg-editor-py3.py", line 977, in <module>
main()
File "m3u-epg-editor-py3.py", line 221, in main
args = validate_args()
File "m3u-epg-editor-py3.py", line 314, in validate_args
abort_process(out_directory + ' does not exist in your filesystem', 1, args)
File "m3u-epg-editor-py3.py", line 444, in abort_process
save_log(args)
File "m3u-epg-editor-py3.py", line 477, in save_log
with io.open(log_target, "w", encoding="utf-8") as log_file:
OSError: [Errno 22] Invalid argument: 'file:///N:\\Perso\\Kodi\\IPTV\\EPG\\Test\\process.log'
2020-07-30T11:17:37.241600 process terminated early due to an exception
2020-07-30T11:17:37.245600 saving to log: D:\Users\source\repos\m3u-epg-editor\process.log
2020-07-30T11:17:37.252600 script runtime: 0 minutes 0 seconds
2020-07-30T11:17:37.252600 process completed
And when I remove the protocol file://
:
2020-07-30T11:31:11.013600 m3u-epg-editor-py3.py process started with Python v3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)]
2020-07-30T11:31:11.013600 performing HTTP GET request to N:\Perso\Kodi\IPTV\200723_tv_channels_plus.m3u
2020-07-30T11:31:11.047600 Traceback (most recent call last):
File "m3u-epg-editor-py3.py", line 977, in <module>
main()
File "m3u-epg-editor-py3.py", line 224, in main
m3u_entries = load_m3u(args)
File "m3u-epg-editor-py3.py", line 498, in load_m3u
m3u_response = get_m3u(args.m3uurl)
File "m3u-epg-editor-py3.py", line 519, in get_m3u
response = requests.get(m3u_url)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\requests\api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\requests\sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\requests\sessions.py", line 637, in send
adapter = self.get_adapter(url=request.url)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\requests\sessions.py", line 730, in get_adapter
raise InvalidSchema("No connection adapters were found for {!r}".format(url))
requests.exceptions.InvalidSchema: No connection adapters were found for 'N:\\Perso\\Kodi\\IPTV\\200723_tv_channels_plus.m3u'
2020-07-30T11:31:11.051600 process terminated early due to an exception
2020-07-30T11:31:11.056600 saving to log: D:\Users\source\repos\m3u-epg-editor\process.log
2020-07-30T11:31:11.063600 script runtime: 0 minutes 0 seconds
2020-07-30T11:31:11.063600 process completed
Tested working as expected on Windows 10 Enterprise version 1709 build 16299.1565 running in VirtualBox inside Linux Mint v18.3:
test_file_uri.json input configuration file contents:
{
"m3uurl": "file:///C:/m3u-epg-editor/minimal.m3u8",
"groups" : ["UK Movies"],
"groupmode": "discard",
"xml_sort_type": "alpha",
"range": 12000000,
"no_tvg_id": false,
"no_epg": true,
"no_sort": false,
"http_for_images": true,
"outdirectory": "C:/m3u-epg-editor/",
"outfilename": "mini",
"log_enabled": true
}
CLI python script runtime output:
c:\m3u-epg-editor>python ./m3u-epg-editor-py3.py -j="C:\m3u-epg-editor\test_file_uri.json"
2020-07-30T18:55:08.747532 m3u-epg-editor-py3.py process started with Python v3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)]
2020-07-30T18:55:08.765811 performing HTTP GET request to file:///C:/m3u-epg-editor/minimal.m3u8
2020-07-30T18:55:08.765811 saving retrieved m3u file: C:/m3u-epg-editor/original.m3u8
2020-07-30T18:55:08.765811 parsing m3u into a list of objects
2020-07-30T18:55:08.784569 m3u contains 2 items
2020-07-30T18:55:08.784569 discarding channel groups in this list ['UK Movies']
2020-07-30T18:55:08.784569 filtered m3u contains 2 items
2020-07-30T18:55:08.784569 sorting filtered items alphabetically by group and channel name
2020-07-30T18:55:08.784569 saving new m3u file: C:/m3u-epg-editor/mini.m3u8
2020-07-30T18:55:08.784569 saving to log: C:/m3u-epg-editor/process.log
2020-07-30T18:55:08.784569 script runtime: 0 minutes 0 seconds
2020-07-30T18:55:08.784569 process completed
This works as expected using a file uri in the format that I suggested in my prior comment. If this doesn't work for you then perhaps:
N:\
that python can't resolve with your current setup and local network arrangement ORPlease try again.
I made a mistake by encoding the protocol file://
in this argument:
"outdirectory": "file:///N:\\Perso\\Kodi\\IPTV\\EPG\\Test\\",
Now, it works.
Thanks
I am unable to use the script. Could you help me please? Here are the command line and the result:
`D:\Users\source\repos\m3u-epg-editor>"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe" m3u-epg-editor-py3.py -j="D:\Users\source\repos\m3u-epg-editor\config.json" 2020-07-29T15:06:10.645200 file://N:\Perso\Kodi\IPTV\EPG\Test\ does not exist in your filesystem 2020-07-29T15:06:10.645200 saving to log: file://N:\Perso\Kodi\IPTV\EPG\Test\process.log 2020-07-29T15:06:10.651200 Traceback (most recent call last): File "m3u-epg-editor-py3.py", line 977, in main()
File "m3u-epg-editor-py3.py", line 221, in main args = validate_args()
File "m3u-epg-editor-py3.py", line 314, in validate_args abort_process(out_directory + ' does not exist in your filesystem', 1, args)
File "m3u-epg-editor-py3.py", line 444, in abort_process save_log(args) File "m3u-epg-editor-py3.py", line 477, in save_log with io.open(log_target, "w", encoding="utf-8") as log_file: OSError: [Errno 22] Invalid argument: 'file://N:\Perso\Kodi\IPTV\EPG\Test\process.log'
2020-07-29T15:06:10.653200 process terminated early due to an exception 2020-07-29T15:06:10.657200 saving to log: D:\Users\source\repos\m3u-epg-editor\process.log 2020-07-29T15:06:10.663200 script runtime: 0 minutes 0 seconds 2020-07-29T15:06:10.665200 process completed`
And the json file:
{ "epgurl": "file://N:\\Perso\\Kodi\\IPTV\\EPG\\xmltv.xml", "groups": "FRANCE FHD | TV", "log_enabled": true, "m3uurl": "file://N:\\Perso\\Kodi\\IPTV\\200723_tv_channels_plus.m3u", "outdirectory": "file://N:\\Perso\\Kodi\\IPTV\\EPG\\Test\\", "outfilename": "mini", "range": 12 }
Thank you