Kodi Community Forum

Full Version: IPTV Recorder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm currently on the release branch, I don't see the "utc2local" fix on the db branch

The dates on my xmltv file are local dates (+0200), in the previous case :

<programme start="20180325112000 +0200" stop="20180325122500 +0200" showview="" channel="channel_id">

I will try to create some file to see if it's correctly executed
I had automatic updates turned on and a kodi restart wiped out that utc fix. It should be in the db branch now.

Is the xml date the actual local time or does the +0200 need to be added on?
I had a lot of problems with that in TV Guide Fullscreen.
People interpret what it should mean differently.
I installed the DB version (from zip), but I have an error about missing table (streams), did I miss something ?

About the date, it's correct "20180325112000 +0200" meaning "20180325092000 +0000", 11:20 CET, 09:20 UTC

For the command, it looks executed, there is the call and arguments :

Code:

RunScript(special://profile/addon_data/plugin.video.iptv.recorder/jobs/407cd60f-301a-11e8-8491-95f3908215f0.py)
['/data/data/org.xbmc.kodi/ffmpeg', '-i', 'http://path_to_ts.ts\r', '-y', '-t', '1562', '-c', 'copy', 'smb://path_to_storage/Channel+-+Program%5BCR%5D%5BCOLOR+grey%5D2018-03-25+12%3A25%3A00+-+2018-03-25+13%3A10%3A00%5B%2FCOLOR%5D.ts']

Are the "\r" and tags on the path valid ?

Code:
Channel - Program[CR][COLOR grey]2018-03-25 12:25:00 - 2018-03-25 13:10:00[/COLOR].ts
The streams table should get made from the m3u file in the xmltv file.
https://github.com/primaeval/plugin.vide...in.py#L907
Use something like this to have a look in the xmltv.db file.
http://sqlitebrowser.org/

The date is in the confusing format where the timezone shouldn't be added to the date.
Some people do it as a utc date and the timezone needs adding on.
This code has added it.
https://github.com/primaeval/plugin.vide...in.py#L852
Maybe it needs a settings switch to say which method to use.

The \r shouldn't be in there. I just assumed \n.
It needs a strip() function to clean them up.
In fact that might be ending the command to ffmpeg so it only gets
Code:
/data/data/org.xbmc.kodi/ffmpeg', '-i', 'http://path_to_ts.ts
The xmltv.db file is empty (0B)

I reloaded all channels and EPG, same error and empty file

Maybe the "xmltv" method is not called if I use PVR's files ?
You need to make sure Service at Login is turned on in the settings.
I've changed the default from off to on.

Follow the service.py service routine.
https://github.com/primaeval/plugin.vide...ver.py#L34
There are some log statements in there already.
I haven't defined log() in that file.

That runs the full_service() function in main.py which runs xmltv().
Make sure both of them are getting called with some more log() calls.
The delay is now seconds. Not minutes.
Make sure you give it enough time for IPTV Simple Client to download any xmltv/m3u files if that is what it does.
The xmltv method wasn't called, fixed with the configuration changes

Unfortunatly, followed by another error Sad

Code:

15:09:42.691 T:18446744073027115312   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'sqlite3.ProgrammingError'>
                                            Error Contents: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.
                                            Traceback (most recent call last):
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.iptv.recorder/main.py", line 1319, in <module>
                                                plugin.run()
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.module.xbmcswift2/lib/xbmcswift2/plugin.py", line 332, in run
                                                items = self._dispatch(self.request.path)
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.module.xbmcswift2/lib/xbmcswift2/plugin.py", line 306, in _dispatch
                                                listitems = view_func(**items)
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.iptv.recorder/main.py", line 930, in full_service
                                                xmltv()
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.iptv.recorder/main.py", line 1124, in xmltv
                                                conn.execute("INSERT OR IGNORE INTO channels(id, name, icon) VALUES(?, ?, ?)", [id, name, icon])
                                            ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.
                                            -->End of Python script error report<--

I fixed that by using ".decode('utf8')" on strings that can contain special characters (name, title, sub_title...), I can create a PR for that is that method OK for you

But after the import, my channel list is empty in the addon, the database contains channels & programs, might be an issue with linking LiveTV channels ?
Thanks. I've had endless *fun* with python and utf8.
A pull request would be good.
Encoding issue are a pain Sad

Unfortunatly, there are a lot of special characters in my language, but on the other hand it's easier to find the encoding errors
Thanks for your help. It has always been a pain to go from xml to python to sql to http and back again and deal with all the encoding schemes and unicode.

Could you have a look at the new code to show Now and Next playing programs.
https://github.com/primaeval/plugin.vide...d1935dR885
It works for the UTC dates in my location but I haven't worked out if it will work in others.
If the timezone of xml is specified as a string instead of an offset we need to use pytz conversion but I'm not sure how exactly. It makes my head hurt.
I made some tests without special characters, recording still doesn't work

I have multiple ffmpeg task, all of them are in a "do_exit" state / zombie

Code:

u0_a64    9887  9726  0      0        do_exit 00000000 Z ffmpeg
u0_a64    9988  9726  0      0        do_exit 00000000 Z ffmpeg
u0_a64    10191 9726  0      0        do_exit 00000000 Z ffmpeg
u0_a64    10344 9726  0      0        do_exit 00000000 Z ffmpeg
u0_a64    10417 9726  0      0        do_exit 00000000 Z ffmpeg

There is the launch command :

['/data/data/org.xbmc.kodi/ffmpeg', '-i', u'http://path_to_ts.ts', '-y', '-t', '1056', '-c', 'copy', 'smb://path_to_record/Channel+-+Prog%5BCR%5D%5BCOLOR+grey%5D2018-03-25+17%3A35%3A00+-+2018-03-25+18%3A30%3A00%5B%2FCOLOR%5D.ts']

Everthing looks good, if it's the "u" prepending the path to stream

On the UI side, everything is OK, there is "just" no recorded file

By the way, I had an error on record startup as there is a "refresh" parameters and a call to a "refresh" function (same name), had to rename the parameter to something like "refreshAfter"
It might be the smb path.
ffmpeg doesn't know how to translate the smb path into something it can write to.
It is more of a shortcut in Kodi.
I ran into that once.
Try a local folder first then mount the smb share somewhere ffmpeg has write permission to.

You'll probably have to experiment on a rooted Android device to find the path that ffmpeg can cope with or at least use adb to get a shell.
It was that, it's working with local record
So I need to figure a way to mount network (and make it work on reboot), I don't have a sufficent local storage to allow local recording

There is a way to play the .ts file before the record is finished ? Mainly to avoid having 2 streaming source (which can be difficult with some network like mine)

I found that about ffmepg : https://ffmpeg.org/ffmpeg-protocols.html#libsmbclient
It's shouldnt' be able to use smb path ?
It might just need the user:password adding to the url. Kodi keeps its own smb credentials in a file somewhere in the userdata folder.
Try modifying the path. You can just try a dummy test path to see if that is the problem.
https://github.com/primaeval/plugin.vide...in.py#L377
We can add settings for user and password if necessary.

I think I tried things like using NFS servers on Windows and even SFTP ones.
The most reliable way is to get a big usb drive or at least one big enough to store a few programs.