plugin.video.iptv.recorder icon indicating copy to clipboard operation
plugin.video.iptv.recorder copied to clipboard

Error Plugin - Ubuntu18 Kodi18

Open jamesarbrown opened this issue 6 years ago • 10 comments

Can you help with this error I can see in kodi.log NOTICE: [xbmcswift2] Request for "/record_once/170635/blah/blah" matches rule for function "record_once" 08:59:21.017 T:140090508642048 ERROR: GetDirectory - Error getting plugin://plugin.video.iptv.recorder/record_once/170635/blah/blah

jamesarbrown avatar Jul 29 '18 08:07 jamesarbrown

Can you "Play Channel" reliably from the addon? Did "Record Once" make a python job file in userdata\addon_data\plugin.video.iptv.recorder\jobs ?

primaeval avatar Jul 29 '18 08:07 primaeval

This is stderr in folder you advised. At a quick glance it looks like an escaping error. I have removed some sensitive stuff

root@tvconserv:/home/jamesarbrown/.kodi/userdata/addon_data/plugin.video.iptv.recorder/jobs# more .stderr ffmpeg version 3.4.2-2 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu2) configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --ena ble-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-li brsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorb is --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable- omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enab le-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, mpegts, from 'http://server. * removed * /30215.ts': Duration: N/A, start: 16395.456000, bitrate: N/A Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 704x576 [SAR 16:11 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:10x101: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 128 kb/s /storage/Other/removed programme name and channel 2018-07-29 09-50.ts: No such file or directory

jamesarbrown avatar Jul 29 '18 09:07 jamesarbrown

And the py script

-- coding: utf-8 --

import os, subprocess, time import xbmcgui xbmcgui.Dialog().notification("Recording: removed", "removed removed", sound=True) cmd = ['/usr/bin/ffmpeg', '-i', u'http://removed0/live/jremoved/30215.ts', '-reconnect', '1', '-reconn ect_at_eof', '1', '-reconnect_streamed', '1', '-reconnect_delay_max', '300', '-y', '-t', '420', '-c', 'copy', '/storage/Other/removed 2018-07-29 09-50.ts'] stdout = open(r'/home/jamesarbrown/.kodi/userdata/addon_data/plugin.video.iptv.recorder/jobs/d179dc60-9309-11e8-931d-485b399516b5.py.stdout.txt','w+' ) stderr = open(r'/home/jamesarbrown/.kodi/userdata/addon_data/plugin.video.iptv.recorder/jobs/d179dc60-9309-11e8-931d-485b399516b5.py.stderr.txt','w+' ) p = subprocess.Popen(cmd, stdout=stdout, stderr=stderr, shell=False) f = open(r'/home/jamesarbrown/.kodi/userdata/addon_data/plugin.video.iptv.recorder/jobs/d179dc60-9309-11e8-931d-485b399516b5.py.pid', 'w+') f.write(repr(p.pid)) f.close() p.wait() stderr.close() stdout.close() xbmcgui.Dialog().notification("Recording finished: removed", "removed removed", sound=True)

jamesarbrown avatar Jul 29 '18 09:07 jamesarbrown

That looks like it is almost working. ffmpeg runs and it can work out the stream type. The output folder and file are incorrect though. /storage/Other/removed programme name and channel 2018-07-29 09-50.ts: No such file or directory

The ts file path needs to be accessible to ffmpeg as a normal shell path. As it is a local path, not network, it might be as simple as setting the write permission of the /storage/Other directory to whatever user account Kodi is running under.

primaeval avatar Jul 29 '18 09:07 primaeval

Your password might be in the py file on the 4th line. You should delete it if it is.

primaeval avatar Jul 29 '18 09:07 primaeval

Think have removed... I will check permissions, I know kodi user is set, but maybe ffmpeg is not running as kodi user

jamesarbrown avatar Jul 29 '18 10:07 jamesarbrown

Check if you can run ffmpeg on the command line if you join the cmd = [" " ... ] arguments together.

Are there any non-ascii characters in the ts filename that are getting interpreted as part of the command?

primaeval avatar Jul 29 '18 11:07 primaeval

Ok the problem is that ffmpeg does not create the missing directory, I set to use /storage, but the output path was /storage/Other/filename.ts..... if i manually create the Other directory it works. I presume the "Other" directory is part of the filename creation you made?

And I also think you are missing the quotes in the ffmpeg command, eg -c copy 'filename', but I do not know how Python picks up the string for sure.

So maybe the python script firsts needs to create a directory if not existing?

jamesarbrown avatar Jul 29 '18 14:07 jamesarbrown

That's good that it works.

The subprocess.Popen(cmd...) call properly quotes all the arguments and filenames. It does a good job as far as I've experienced so far.

The "ffmpeg recordings folder" setting isn't required unless ffmpeg uses a different path than Kodi. That usually only means a network path like in the example: "smb://server/path/ = \server\path".

I should make that clearer in the Settings really. I'm not sure how to put it. Any ideas?

When you select the "Kodi recordings folder" that folder has to exist, so I didn't add any code to create the directory.

primaeval avatar Jul 29 '18 15:07 primaeval

I added a couple of labels that might help. https://github.com/primaeval/plugin.video.iptv.recorder/commit/c383c7eae2694fcc60f15adc291a84b4c618c320

The "Other" subfolder does get made but it uses the "Kodi Recordings Folder" setting because it is made within Kodi rather than in the shell with ffmpeg. https://github.com/primaeval/plugin.video.iptv.recorder/blob/e9c81c7eb626f6bdf1845eb4f964d407f455df96/main.py#L603

primaeval avatar Jul 29 '18 15:07 primaeval