Closed cjaone closed 1 year ago
Thanks for the contribution. It's a good idea but I'm getting errors:
on Python 2 and 3 if no file is selected (as we're using URI) and upon submit it fails with:
Traceback (most recent call last):
File "C:\coding\TSR\tvstreamrecord\bottle.py", line 868, in _handle
return route.call(**args)
File "C:\coding\TSR\tvstreamrecord\bottle.py", line 1748, in wrapper
rv = callback(*a, **ka)
File "C:\coding\TSR\tvstreamrecord\tvstreamrecord.py", line 433, in upload_p
if not upfile.filename == "empty":
AttributeError: 'str' object has no attribute 'filename'
to prevent it I'd suggest
if upfile != "" and not upfile.filename == "empty":
even after this fix on Python 2 it fails with:
'module' object has no attribute 'Request'
it's somehow my fault, I've imported different modules with the same name:
in tvstreamrecord: and in xmltv:
here an extra import is necessary
Sorry, I don't have much time now to make changes/test myself, busy weeks ahead, but as soon as I get some time I'll incorporate your changes.
Hello Pavion, thanks for the Python 2 hint. (Time does not matter at all, just take your time, no pressure. ;-)
Regarding the "has no attribute 'filename'" error
I was able to reproduce it with Linux and Python 2 (message is slighty different, with "unicode" instead of "str"):
AttributeError: 'unicode' object has no attribute 'filename'
I found out that it occurs on older bottle versions < 0.12.21 (current stable seems to be 0.12.25). Starting from bottle version 0.12.21 I don't get the error with Python 2 anymore so your bottle version must be older I guess. It would be interesting to know which version is used by the Synology boxes.
Anyway, your fix works for me, so this can be used. :-)
I did some additional testing with Python 2 and Python 3 on Linux to verify it:
Python 2.7.18
Tested with both bottle 0.12.1 and 0.12.25:
Python 3.10.10
Tested with both 0.12.19 and 0.12.25:
Same as above. Plus the HTTP download of the M3U file works, so no issue for me with Python 3. ✓
I've made some changes now: https://github.com/Pavion/tvstreamrecord/pull/63/files (Please note that you too can add further commits to PRs already open) To avoid library conflict and unnecessary imports I've moved your function to xmltv.py (where you've copied it from), added discussed check so it should be waterproof now. Please review those changes and I'll gladly merge this PR.
For me it works, great! You also improved the labels. 🙂
I tested it on Linux with Python 3.10 and Python 2.7. 👍
Added feature to upload a channel list not only from local file but also from HTTP URL.