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.
IPTV Recorder

plugin.video.iptv.recorder

https://github.com/primaeval/plugin.video.iptv.recorder

NEW! Record directly from the IPTV Simple Client PVR EPG grid!

NEW! Record and Play to mimic Live Stream Pausing

Kodi addon for recording streams from the IPTV Simple Client pvr plugin or xmltv/m3u files.

Adding recording from the IPTV Simple Client is possible and has been done but it is too hard for most people to build for their devices.
This addon is an easily extensible python addon that should work with any device.

You will need a version of ffmpeg for your device. https://ffmpeg.org/
Android builds are here:
NEW
https://github.com/vot/ffbinaries-prebui...s/tag/v4.1
or
https://github.com/Khang-NT/ffmpeg-binary-android
or
https://github.com/WritingMinds/ffmpeg-a...ses/latest
On Android this addon will copy ffmpeg to the /data/data folder so it can run.

Quick Start
  • Install this addon via my repo. https://github.com/primaeval/repository....-0.0.2.zip
  • Download ffmpeg for your device
  • Point to the ffmpeg exe in Settings.
  • Set a Recordings folder that you can write to. (press backspace to get out of temp)
  • Make sure IPTV Simple Client is enabled and works or set your xmltv/m3u data sources.
  • Turn on the Web Server in Kodi and enable Remote Control. (this addon uses jsonrpc)
  • Go into the addon \ Channel Groups and find a program to Record Once.
Recomendations
  • Use Show Items on Two Lines mode to see Now and Next programs clearly.
  • Use Arial-Based fonts for unicode characters and better display in multiline mode.
  • Use the Windows Scheduler if possible in case Kodi crashes or shuts down.
  • Use an external player if your streams go through a python addon as a redirect server.
  • Krypton Estuary doesn't display channel icons in Wide List mode. Try Leia or a different skin.
  • Add a margin of time to recordings so they have time to stabilise.
  • Turn on the Debug menus to Nuke the database (delete it and start again).
  • Change the Login delay if your IPTV Simple Client downloads the xmltv file first.
  • Set the Service schedule time to the middle of the night, preferably after the xmltv is updated.
TODO
  • cron jobs on Linux.
  • Repeat Timers.
  • Watch Timers.
  • More robust ffmpeg process handling.
  • More meta nfo.
  • Pull in xmltv and m3u directly.
WARNING
Make sure you have legal permission in your country to record streams.
Do not discuss anything that might get you, me or Kodi into legal trouble.

Image

Image

Image

Image

Image
Pastebin

Using v18
Getting an error when selecting a channel group.
(2018-03-23, 04:56)locoguano Wrote: [ -> ]Pastebin

Using v18
Getting an error when selecting a channel group.
 You haven't turned on the Kodi Web Server service. https://kodi.wiki/view/Webserver
Code:
Error Contents: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /jsonrpc?request=%7B%22jsonrpc%22%3A%222.0%22%2C%22method%22%3A%22PVR.GetChannelGroups%22%2C%22id%22%3A1%2C%22params%22%3A%7B%22channeltype%22%3A%22tv%22%7D%7D

Quick Start
  • Turn on the Web Server in Kodi and enable Remote Control. (this addon uses jsonrpc)
(2018-03-23, 09:53)primaeval Wrote: [ -> ]
(2018-03-23, 04:56)locoguano Wrote: [ -> ]Pastebin

Using v18
Getting an error when selecting a channel group.
 You haven't turned on the Kodi Web Server service. https://kodi.wiki/view/Webserver
Code:
Error Contents: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /jsonrpc?request=%7B%22jsonrpc%22%3A%222.0%22%2C%22method%22%3A%22PVR.GetChannelGroups%22%2C%22id%22%3A1%2C%22params%22%3A%7B%22channeltype%22%3A%22tv%22%7D%7D
Quick Start
  • Turn on the Web Server in Kodi and enable Remote Control. (this addon uses jsonrpc)
 
Funny thing is that it was turned on... I didn't change anything on my PC and it worked this morning. Go figure. I have had several json issues with v18.
(2018-03-23, 14:18)locoguano Wrote: [ -> ]
(2018-03-23, 09:53)primaeval Wrote: [ -> ]
(2018-03-23, 04:56)locoguano Wrote: [ -> ]Pastebin

Using v18
Getting an error when selecting a channel group.
 You haven't turned on the Kodi Web Server service. https://kodi.wiki/view/Webserver
Code:
Error Contents: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /jsonrpc?request=%7B%22jsonrpc%22%3A%222.0%22%2C%22method%22%3A%22PVR.GetChannelGroups%22%2C%22id%22%3A1%2C%22params%22%3A%7B%22channeltype%22%3A%22tv%22%7D%7D
Quick Start
  • Turn on the Web Server in Kodi and enable Remote Control. (this addon uses jsonrpc)
 
Funny thing is that it was turned on... I didn't change anything on my PC and it worked this morning. Go figure. I have had several json issues with v18.   
 
8080 is a commonly used port so I wouldn't be surprised if another program on your PC was already using it.
Even Skype steals port 80 and port 445 if you don't turn it off, or at least it used to.

This is useful to see ports being used. https://www.nirsoft.net/utils/cports.html
version 0.0.2
- full service
- daily timers
- channel/name timers

Timer rules for daily recording if the time and title match, and simple title matching on the same channel.

If anyone has any need for special timer types or stream wrangling code let me know.
(2018-03-23, 14:23)primaeval Wrote: [ -> ]8080 is a commonly used port so I wouldn't be surprised if another program on your PC was already using it.

FYI, some of us were made aware yesterday that some commands that rely on Json RPC may not work on Kodi 18. See JSON-RPC no longer accepts many of the commands via HTTP

I haven't tested your addon myself, but I'm interested. I'm exclusively on Kodi 18 latest Alpha(it has proven, at least to me, to be working way better than Kodi 17.6).
(2018-03-23, 17:43)coremailrx8 Wrote: [ -> ]
(2018-03-23, 14:23)primaeval Wrote: [ -> ]8080 is a commonly used port so I wouldn't be surprised if another program on your PC was already using it.

FYI, some of us were made aware yesterday that some commands that rely on Json RPC may not work on Kodi 18. See JSON-RPC no longer accepts many of the commands via HTTP

I haven't tested your addon myself, but I'm interested. I'm exclusively on Kodi 18 latest Alpha(it has proven, at least to me, to be working way better than Kodi 17.6). 
 Thanks. I ran into some of that the other day. You just have to make sure you use POST instead of GET for anything that modifies Kodi.
They've removed the ability to get straight to the pvr stream url which is a bit of a pain but makes sense with the VideoStream changes.
Code:
version 0.0.3
- title search rule
- plot search rule
- ffmpeg headers eg http ://server.com/stream.m3u|user-agent=Mozilla&something=other
so, i did everything as instructed, finally got to channel groups, but when trying to select record once i get an error
Code:
17:51:13.958 T:7292  NOTICE: [xbmcswift2] Request for "/record_once/HRT+1/Daj+pet%28ak%29/2018-03-23+17%3A09%3A00/2018-03-23+17%3A58%3A00" matches rule for function "record_once"
17:51:13.960 T:7292   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.AttributeError'>
                                            Error Contents: 'NoneType' object has no attribute 'split'
                                            Traceback (most recent call last):
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\plugin.video.iptv.recorder\main.py", line 961, in <module>
                                                plugin.run()
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\plugin.py", line 332, in run
                                                items = self._dispatch(self.request.path)
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\plugin.py", line 306, in _dispatch
                                                listitems = view_func(**items)
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\plugin.video.iptv.recorder\main.py", line 331, in record_once
                                                url,sheaders = url.split('|',1)
                                            AttributeError: 'NoneType' object has no attribute 'split'
                                            -->End of Python script error report<--
17:51:14.069 T:5824   ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://plugin.video.iptv.recorder/record_once/HRT+1/Daj+pet%28ak%29/2018-03-23+17%3A09%3A00/2018-03-23+17%3A58%3A00
17:51:14.069 T:5824   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.iptv.recorder/record_once/HRT+1/Daj+pet%28ak%29/2018-03-23+17%3A09%3A00/2018-03-23+17%3A58%3A00) failed
17:51:14.380 T:9528  NOTICE: [xbmcswift2] Request for "/broadcast/1190/HRT+1/Daj+pet%28ak%29/2018-03-23+17%3A09%3A00/2018-03-23+17%3A58%3A00" matches rule for function "broadcast"
17:51:14.381 T:9528 WARNING: [xbmcswift2] No converter provided, unicode should be used, but returning str value
(2018-03-23, 18:56)ray2301 Wrote: [ -> ] 
  
My fault. I'll fix it right now.
  
Try 0.0.4. That will teach me to rush out a release while the kids are trying to get me to make pizza.
Cleared everything, started from scratch. Now I have this on start
Code:
00:26:24.999 T:11456   ERROR: [plugin.video.iptv.recorder] service started...
00:26:26.444 T:4772  NOTICE: [xbmcswift2] Request for "/start" matches rule for function "start"
00:26:26.446 T:4760  NOTICE: [xbmcswift2] Request for "/service" matches rule for function "service"
00:26:26.447 T:4772 WARNING: [xbmcswift2] No converter provided, unicode should be used, but returning str value
00:26:26.506 T:4772 WARNING: Previous line repeats 3 times.
00:26:26.506 T:4772   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IOError'>
                                            Error Contents: [Errno 2] No such file or directory: 'C:\\Users\\raych\\AppData\\Roaming\\Kodi\\userdata\\addon_data\\plugin.video.iptv.recorder\\.storage\\channel_urls.tmp'
                                            Traceback (most recent call last):
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\plugin.video.iptv.recorder\main.py", line 966, in <module>
                                                plugin.run()
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\plugin.py", line 332, in run
                                                items = self._dispatch(self.request.path)
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\plugin.py", line 306, in _dispatch
                                                listitems = view_func(**items)
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\plugin.video.iptv.recorder\main.py", line 815, in start
                                                m3u()
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\plugin.video.iptv.recorder\main.py", line 689, in m3u
                                                channel_urls.clear()
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\storage.py", line 148, in clear
                                                self.sync()
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\storage.py", line 63, in sync
                                                shutil.move(tempname, self.filename)    # atomic commit
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\shutil.py", line 302, in move
                                                copy2(src, real_dst)
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\shutil.py", line 130, in copy2
                                                copyfile(src, dst)
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\shutil.py", line 82, in copyfile
                                                with open(src, 'rb') as fsrc:
                                            IOError: [Errno 2] No such file or directory: 'C:\\Users\\raych\\AppData\\Roaming\\Kodi\\userdata\\addon_data\\plugin.video.iptv.recorder\\.storage\\channel_urls.tmp'
                                            -->End of Python script error report<--
                                            
                                            
                                            
                                            
when i get to the programme and select record once nothing really happens on kodi (screen refreshes)
Code:
00:30:53.154 T:12520  NOTICE: [xbmcswift2] Request for "/" matches rule for function "index"
00:30:53.155 T:12520 WARNING: [xbmcswift2] No converter provided, unicode should be used, but returning str value
00:31:14.152 T:6328 WARNING: Previous line repeats 7 times.
00:31:14.152 T:6328  NOTICE: [xbmcswift2] Request for "/groups" matches rule for function "groups"
00:31:16.322 T:9664  NOTICE: [xbmcswift2] Request for "/group/1" matches rule for function "group"
00:31:32.130 T:5912  NOTICE: [xbmcswift2] Request for "/channel/HRT+1/1190" matches rule for function "channel"
00:31:50.452 T:11824  NOTICE: [xbmcswift2] Request for "/broadcast/1190/HRT+1/A.D.+The+Bible+Continues+%282015%29/2018-03-24+00%3A09%3A00/2018-03-24+00%3A51%3A00" matches rule for function "broadcast"
00:31:50.453 T:11824 WARNING: [xbmcswift2] No converter provided, unicode should be used, but returning str value
00:32:02.167 T:9528 WARNING: Previous line repeats 2 times.
00:32:02.167 T:9528  NOTICE: [xbmcswift2] Request for "/record_once/HRT+1/A.D.+The+Bible+Continues+%282015%29/2018-03-24+00%3A09%3A00/2018-03-24+00%3A51%3A00" matches rule for function "record_once"
00:32:02.169 T:9528   ERROR: No url for HRT 1
00:32:02.170 T:1404   ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://plugin.video.iptv.recorder/record_once/HRT+1/A.D.+The+Bible+Continues+%282015%29/2018-03-24+00%3A09%3A00/2018-03-24+00%3A51%3A00
00:32:02.171 T:1404   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.iptv.recorder/record_once/HRT+1/A.D.+The+Bible+Continues+%282015%29/2018-03-24+00%3A09%3A00/2018-03-24+00%3A51%3A00) failed
00:32:02.987 T:3420  NOTICE: [xbmcswift2] Request for "/broadcast/1190/HRT+1/A.D.+The+Bible+Continues+%282015%29/2018-03-24+00%3A09%3A00/2018-03-24+00%3A51%3A00" matches rule for function "broadcast"
00:32:02.989 T:3420 WARNING: [xbmcswift2] No converter provided, unicode should be used, but returning str value
00:32:10.853 T:11412 WARNING: Previous line repeats 2 times.
00:32:10.853 T:11412  NOTICE: [xbmcswift2] Request for "/channel/HRT+1/1190" matches rule for function "channel"
00:32:15.415 T:6428  NOTICE: [xbmcswift2] Request for "/groups" matches rule for function "groups"
00:32:18.973 T:7572  NOTICE: [xbmcswift2] Request for "/jobs" matches rule for function "jobs"
(2018-03-24, 01:41)ray2301 Wrote: [ -> ]Cleared everything, started from scratch. Now I have this on start
Code:
00:26:24.999 T:11456   ERROR: [plugin.video.iptv.recorder] service started...
00:26:26.444 T:4772  NOTICE: [xbmcswift2] Request for "/start" matches rule for function "start"
00:26:26.446 T:4760  NOTICE: [xbmcswift2] Request for "/service" matches rule for function "service"
00:26:26.447 T:4772 WARNING: [xbmcswift2] No converter provided, unicode should be used, but returning str value
00:26:26.506 T:4772 WARNING: Previous line repeats 3 times.
00:26:26.506 T:4772   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IOError'>
                                            Error Contents: [Errno 2] No such file or directory: 'C:\\Users\\raych\\AppData\\Roaming\\Kodi\\userdata\\addon_data\\plugin.video.iptv.recorder\\.storage\\channel_urls.tmp'
                                            Traceback (most recent call last):
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\plugin.video.iptv.recorder\main.py", line 966, in <module>
                                                plugin.run()
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\plugin.py", line 332, in run
                                                items = self._dispatch(self.request.path)
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\plugin.py", line 306, in _dispatch
                                                listitems = view_func(**items)
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\plugin.video.iptv.recorder\main.py", line 815, in start
                                                m3u()
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\plugin.video.iptv.recorder\main.py", line 689, in m3u
                                                channel_urls.clear()
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\storage.py", line 148, in clear
                                                self.sync()
                                              File "C:\Users\raych\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\storage.py", line 63, in sync
                                                shutil.move(tempname, self.filename)    # atomic commit
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\shutil.py", line 302, in move
                                                copy2(src, real_dst)
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\shutil.py", line 130, in copy2
                                                copyfile(src, dst)
                                              File "C:\Program Files (x86)\Kodi\system\python\Lib\shutil.py", line 82, in copyfile
                                                with open(src, 'rb') as fsrc:
                                            IOError: [Errno 2] No such file or directory: 'C:\\Users\\raych\\AppData\\Roaming\\Kodi\\userdata\\addon_data\\plugin.video.iptv.recorder\\.storage\\channel_urls.tmp'
                                            -->End of Python script error report<--
                                            
                                            
                                            
                                            
when i get to the programme and select record once nothing really happens on kodi (screen refreshes)
Code:
00:30:53.154 T:12520  NOTICE: [xbmcswift2] Request for "/" matches rule for function "index"
00:30:53.155 T:12520 WARNING: [xbmcswift2] No converter provided, unicode should be used, but returning str value
00:31:14.152 T:6328 WARNING: Previous line repeats 7 times.
00:31:14.152 T:6328  NOTICE: [xbmcswift2] Request for "/groups" matches rule for function "groups"
00:31:16.322 T:9664  NOTICE: [xbmcswift2] Request for "/group/1" matches rule for function "group"
00:31:32.130 T:5912  NOTICE: [xbmcswift2] Request for "/channel/HRT+1/1190" matches rule for function "channel"
00:31:50.452 T:11824  NOTICE: [xbmcswift2] Request for "/broadcast/1190/HRT+1/A.D.+The+Bible+Continues+%282015%29/2018-03-24+00%3A09%3A00/2018-03-24+00%3A51%3A00" matches rule for function "broadcast"
00:31:50.453 T:11824 WARNING: [xbmcswift2] No converter provided, unicode should be used, but returning str value
00:32:02.167 T:9528 WARNING: Previous line repeats 2 times.
00:32:02.167 T:9528  NOTICE: [xbmcswift2] Request for "/record_once/HRT+1/A.D.+The+Bible+Continues+%282015%29/2018-03-24+00%3A09%3A00/2018-03-24+00%3A51%3A00" matches rule for function "record_once"
00:32:02.169 T:9528   ERROR: No url for HRT 1
00:32:02.170 T:1404   ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://plugin.video.iptv.recorder/record_once/HRT+1/A.D.+The+Bible+Continues+%282015%29/2018-03-24+00%3A09%3A00/2018-03-24+00%3A51%3A00
00:32:02.171 T:1404   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.iptv.recorder/record_once/HRT+1/A.D.+The+Bible+Continues+%282015%29/2018-03-24+00%3A09%3A00/2018-03-24+00%3A51%3A00) failed
00:32:02.987 T:3420  NOTICE: [xbmcswift2] Request for "/broadcast/1190/HRT+1/A.D.+The+Bible+Continues+%282015%29/2018-03-24+00%3A09%3A00/2018-03-24+00%3A51%3A00" matches rule for function "broadcast"
00:32:02.989 T:3420 WARNING: [xbmcswift2] No converter provided, unicode should be used, but returning str value
00:32:10.853 T:11412 WARNING: Previous line repeats 2 times.
00:32:10.853 T:11412  NOTICE: [xbmcswift2] Request for "/channel/HRT+1/1190" matches rule for function "channel"
00:32:15.415 T:6428  NOTICE: [xbmcswift2] Request for "/groups" matches rule for function "groups"
00:32:18.973 T:7572  NOTICE: [xbmcswift2] Request for "/jobs" matches rule for function "jobs"
 It's not loading up the channels properly from the IPTV Simple Client m3u url.
Have a look in here and see if the "HRT 1" has actually got a url and that it works.
userdata\addon_data\plugin.video.iptv.recorder\channels.m3u
If it does pm me the channels.m3u file and I'll see if it is a unicode bug or similar.
Are you using a url or file for your m3u channels?
If it is a file I'll need to add in a fix.

Right now I'm changing everything to use an sql database.
I'll add that fix in as I do it.
It is a bigger job than I first imagined.