Kodi Community Forum
Python and MythTV (a MythTV Front-End) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Python and MythTV (a MythTV Front-End) (/showthread.php?tid=2349)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39


- madtw - 2005-06-24

i haven't tested it with myth tv 0.17 so i can't say for sure if you'll have problems. i try to maintain compatibility with older versions by leaving in old code if i notice that something has changed with a newer version. unfortunately, the new stuff that i built was using a myth tv 0.18 database so i don't know what it looked like for 0.17.

fyi, i have been running myth tv since version 0.12 or so... i haven't lost any of my settings or recordings when upgrading. my only rule for upgrading is to stick with the official releases as opposed to running builds from cvs. so far it has paid off...


- kruuth - 2005-06-27

thanks guys. i just put that script in. i should be able to put it to use later today. was that script it?


- kruuth - 2005-06-27

oh, is there a way to go back and have it transcode all the ones i already have?


- us1111 - 2005-06-27

(kruuth @ june 27 2005,19:31 Wrote:oh, is there a way to go back and have it transcode all the ones i already have?
hmm.. figured out that thumbs cannot be created from mp4 files.. so a small refinement to my original script (wget to initiate thumbs)..

Quote:#!/bin/bash
videodir=/mnt/disk3/video/tv/

echo -e "\n\n===============================" >>/tmp/mythtranscode.out

echo "mythtranscode $*" >>/tmp/mythtranscode.out

sql () {
mysql -u root mythconverg -e "$*" >>/tmp/mythtranscode.out 2>&1
echo "$*" >>/tmp/mythtranscode.out
}

partfile=`echo $6|tr -cd "1234567890"`
channel=`echo $4`
starttime=`echo $6|tr "t" " "`

echo "partfile=$partfile" >>/tmp/mythtranscode.out
cd $videodir

name="`ls $channel\_$partfile*.nuv`"
echo "name: $name" >>/tmp/mythtranscode.out

sql "update jobqueue set status=4 where chanid=$channel and starttime='$starttime'"

nice -n +20 mencoder $name -ovc xvid -oac mp3lame -lameopts br=128 \
-vf scale=480:480 -o $name.tmp -xvidencopts bitrate=1000\
>/tmp/mencoder.out 2>>/tmp/mythtranscode.out
if [ $? -eq 0 ]; then
if [ ! -f $name.tmp ]; then
sql "update jobqueue set status=8 where chanid=$channel and starttime='$starttime'"
echo "failed!" >>/tmp/mythtranscode.out
return 99
else
sql "update jobqueue set status=5 where chanid=$channel and starttime='$starttime'"
echo "success!" >>/tmp/mythtranscode.out
# load the page to initiate building thumbs from mpg instead of mp4
wget http://localhost/mythweb/recorded_programs.php -o /dev/null
sleep 5
# mythtv takes care of removing the mpg and replacing the converted mp4
return 0
fi
else
# mythtv takes care of removing the mpg and replacing the converted mp4 but converting failed...
rm -rf $name.tmp
sql "update jobqueue set status=8 where chanid=$channel and starttime='$starttime'"
echo "failed!" >>/tmp/mythtranscode.out
return 99
fi

and it is possible to re-transcode original recordings.. but you'll have to do it in mysql. the ready for transcoding status is 1 if i remember correctly.

Quote:enum jobstatus {
job_queued = 0x0001, job_pending = 0x0002, job_starting = 0x0003, job_running = 0x0004,
job_stopping = 0x0005, job_paused = 0x0006, job_retry = 0x0007, job_erroring = 0x0008,
job_aborting = 0x0009, job_done = 0x0100, job_finished = 0x0110, job_aborted = 0x0120,
job_errored = 0x0130, job_unknown = 0x0000
}

to re-encode a file, do this:

Quote:[root@server01 tmp]# mysql -u root mythconverg
reading table information for completion of table and column names
you can turn off this feature to get a quicker startup with -a

welcome to the mysql monitor. commands end with; or \g.
your mysql connection id is 1180 to server version: 3.23.58

type 'help;' or '\h' for help. type '\c' to clear the buffer.

mysql> select * from jobqueue
->;
+-----+--------+---------------------+---------------------+------+------+-------+--------
+----------------+----------+------+-----------------------------+
| id | chanid | starttime | inserttime | type | cmds | flags | status | statustime | hostname | args | comment |
+-----+--------+---------------------+---------------------+------+------+-------+--------
+----------------+----------+------+-----------------------------+
| 209 | 1 | 2005-06-25 22:04:00 | 2005-06-25 23:43:01 | 1 | 0 | 0 | 272 | 20050626054342 | server01 | | |
| 212 | 9 | 2005-06-27 19:28:00 | 2005-06-27 20:03:00 | 1 | 0 | 0 | 272 | 20050627214938 | server01 | | |
| 213 | 8 | 2005-06-27 19:49:00 | 2005-06-27 20:33:01 | 1 | 0 | 0 | 4 | 20050627215019 | server01 | | |
| 107 | 9 | 2005-06-01 19:34:00 | 2005-06-01 20:06:02 | 2 | 4 | 0 | 5 | 20050601221721 | server01 | | finished, 0 break(s) found. |
| 181 | 9 | 2005-06-20 19:28:00 | 2005-06-20 20:00:04 | 1 | 0 | 0 | 8 | 20050620230920 | server01 | | |
| 102 | 1 | 2005-06-01 17:59:00 | 2005-06-01 18:01:00 | 1 | 4 | 0 | 4 | 20050601190217 | server01 | | |
| 98 | 3 | 2005-06-01 17:01:00 | 2005-06-01 17:08:00 | 1 | 4 | 0 | 5 | 20050601173409 | server01 | | |
| 59 | 3 | 2005-05-25 12:43:00 | 2005-05-25 12:46:00 | 1 | 4 | 0 | 9 | 20050525125056 | server01 | | |
| 109 | 8 | 2005-06-01 19:49:00 | 2005-06-01 20:31:01 | 2 | 4 | 0 | 5 | 20050601224617 | server01 | | finished, 2 break(s) found. |
| 210 | 9 | 2005-06-26 23:04:00 | 2005-06-27 00:03:01 | 1 | 0 | 0 | 272 | 20050627030605 | server01 | | |
| 211 | 4 | 2005-06-27 17:04:00 | 2005-06-27 17:33:01 | 1 | 0 | 0 | 272 | 20050627185316 | server01 | | |
| 208 | 8 | 2005-06-25 19:00:00 | 2005-06-25 19:38:01 | 1 | 0 | 0 | 272 | 20050626001611 | server01 | | |
| 206 | 6 | 2005-06-25 16:24:00 | 2005-06-25 16:58:01 | 1 | 0 | 0 | 272 | 20050625184611 | server01 | | |
| 207 | 8 | 2005-06-25 17:59:00 | 2005-06-25 19:00:04 | 1 | 0 | 0 | 272 | 20050625221726 | server01 | | |
+-----+--------+---------------------+---------------------+------+------+-------+--------
+----------------+----------+------+-----------------------------+
14 rows in set (0.00 sec)

mysql> update jobqueue set type=1 where id=207;

the file 8_20050625175900_20050625190000.nuv will be re-encoded. because "2005-06-25 17:59:00" = "20050625175900" and the channel is 8 (second collumn, after id).


- kruuth - 2005-06-28

say, i did that script. right now there's a couple of red "errored" transcode jobs. is this how its supposed to work? i had to change the directory where it was looking for the videos.


- erazmus - 2005-06-28

hello all,
i have the latest (as of yesterday) python scripts on xbmc out of cvs a few days ago talking to a mythtv backend running the latest cvs. i've found two places in the code that need to be slightly modified to allow the scripts to connect and acquire guide data, etc. everything appears to be working, except i can;t actually view any video. the shows are being recorded in mpeg4 format with mp3 audio. i've heard rumors that i might need to recompile mplayer inside xbmc in order to view the myth recordings. is this actually true, or am i doing something wrong? any pointers would be greatly appreciated. thanks.


- kruuth - 2005-06-30

wierd. i tried your script. i can play the vids in windows but not on xbmc. they appear as .nuv files, but when i open them with gspot it reports that no codecs are installed, even though they play.


- us1111 - 2005-06-30

(kruuth @ june 30 2005,06:31 Wrote:wierd. i tried your script. i can play the vids in windows but not on xbmc. they appear as .nuv files, but when i open them with gspot it reports that no codecs are installed, even though they play.
do you play the files with xbmcmythtv? the extention is off course wrong.. i depend on a proper media player to recognise the real content of the file. mplayer doesn't look at extensions so that's why this construction works with the xbox.

maybe you could try copyin one of the nuv files localy and rename it to avi. gspot should detect the format.


- kruuth - 2005-06-30

i tried that. media player classic will play it on the pc w/o a problem as avi of nuv. the xbmc player won't play it though.


- us1111 - 2005-07-02

(kruuth @ june 30 2005,16:31 Wrote:i tried that. media player classic will play it on the pc w/o a problem as avi of nuv. the xbmc player won't play it though.
do you see thumbnails when selecting a recording? maybe there's something in your mythbackend.log which could explain things. also try playing the nuv file directly from the xbox, without xmbc (through the smb share).


- kruuth - 2005-07-03

oddly enough, i do see the thumbnails. the video just doesn't play.


- kruuth - 2005-07-06

anyone got any ideas?


- henk - 2005-07-07

recorded shows and xbmcmythtv hangs the whole console if i go over a record which contains a description that has more than, i guess, 256 characters. i've had this problem for a long time, but forgot to mention it here. workaround is to delete the description in mysql directly... :nuts:


- stilger - 2005-07-07

(madtw @ june 24 2005,01:22 Wrote:i haven't tested it with myth tv 0.17 so i can't say for sure if you'll have problems. i try to maintain compatibility with older versions by leaving in old code if i notice that something has changed with a newer version. unfortunately, the new stuff that i built was using a myth tv 0.18 database so i don't know what it looked like for 0.17.

fyi, i have been running myth tv since version 0.12 or so... i haven't lost any of my settings or recordings when upgrading. my only rule for upgrading is to stick with the official releases as opposed to running builds from cvs. so far it has paid off...
just to let you know i tried the latest cvs with my myth tv 0.17 and it did not work. i will have to get my myth tv upgraded before i can take advantage of these new features.


- stilger - 2005-07-09

(stilger @ july 07 2005,16:26 Wrote:just to let you know i tried the latest cvs with my myth tv 0.17 and it did not work. i will have to get my myth tv upgraded before i can take advantage of these new features.
hi, i have updated my mythtv to 18.1 and the new xbmcmythtv seems to be working great now. (thanks to the auto-upgrade function in knoppmyth everything updated fine).