Networked Media Tank
MythTV integration? - Printable Version

+- Networked Media Tank (http://www.networkedmediatank.com)
+-- Forum: Community Jukebox, Themes, & UserApps Section (/forumdisplay.php?fid=106)
+--- Forum: Other HTTP or UPNP Server Software (/forumdisplay.php?fid=22)
+--- Thread: MythTV integration? (/showthread.php?tid=3226)



MythTV integration? - n8gray - 04-23-2008 10:11 AM

My PCH is doing a pretty good job at streaming random files from my server, but I would *love* for it to integrate with my MythTV server. It does detect the mythtv UPnP server but hangs if I navigate to the level of seeing actual files:

Recordings > By Title > The Office > ---HANG---

By "hang" I mean the spinny progress doodad just spins and spins forever with no way to interrupt it. Has anybody tried this? Succeeded?

If this worked my wife would be so thrilled...

Thanks!


- jaydonoghue - 04-23-2008 01:46 PM

I can confirm that I see the same thing. I havent dug into it any further though.. I dont know if the problem is on the Myth of PCH side.

You can interrupt the spinning thing by pressing Stop then Return. It will bring you back to the previous screen.

I created a few PHP scripts that do the linking to the MythTV recordings and videos. Its a bit of a hack (it uses straight SQL calls instead of Myth's API), but it allows everyone to browse and watch shows. I can provide them if it would help... but as usual YMMV


my workaround - linuxworks - 04-23-2008 08:11 PM

is to just 'see' the files directly on my myth box, via samba or nfs.

the one thing that I do beyond regular myth is to rename them with useful names. I have a driver script that does this. first the calling script:

#!/bin/csh
cd /myth/tv
/do_rename > /tmp/a
source /tmp/a >& /dev/null
rm -f *png >& /dev/null
rm -f /tmp/a
chmod ugo+rw *
echo "rename done@ `date`"


the real part is the /do_rename script:

echo "select starttime, title, subtitle, basename from recorded where filesize != 0 order by starttime" \
| mysql mythconverg \
| sed "s/'//g" \
| sed 's/ /_/g' \
| sed 's/\t/__/1' \
| sed 's/\t/__/1' \
| sed "s/,//g" \
| sed "s/?//g" \
| sed "s/\///g" \
| sed "s/;//g" \
| sed "s/:/\./g" \
| sed "s/\&//g" \
| sed "s/\%//g" \
| sed "s/\$//g" \
| sed "s/=//g" \
| sed "s/*//g" \
| sed "s/@//g" \
| sed "s/+//g" \
| sed "s/!//g" \
| sed "s/\[//g" \
| sed "s/\]//g" \
| sed "s/(//g" \
| sed "s/)//g" \
| sed "s/\.00//g" \
| awk '{printf"mv %s %s.mpg\n", $2, $1}' \
| grep -v 'starttime__title' \
| sed "s/__\./\./g"


yeah, its ugly and has way too many sed pipes in it Wink

I wanted to remove 'bad chars' from filenames just to make it more unix friendly. you can omit all the sed parts if you want.

what I end up with is:

before:

2092_20080420143000.mpg

after:

2008-04-20_14.30__Ciao_Italia__Patate._Potatoes.mpg

(yes, I like to save cooking shows, LOL) Wink

I like to have the shows named in date sorting order and then the program name and other info, separated by underscores.

this script is something I run every time that a show is done recording on myth.

hope its of use, one way or another...


Re: my workaround - jaydonoghue - 04-23-2008 09:34 PM

linuxworks Wrote:is to just 'see' the files directly on my myth box, via samba or nfs.

the one thing that I do beyond regular myth is to rename them with useful names. I have a driver script that does this. first the calling script:

There is a much easier way to do this Tongue

MythTV comes with a script called "mythrename.pl" that does the renaming to a friendly name for you. Its in the "contrib" directory of the source tree. http://www.mythtv.org/wiki/index.php/Mythrename.pl

Also, you can minimize your sed pipes by putting all possibilities in [] characters... like
sed "s/[?;\/+!]//g"


- linuxworks - 04-23-2008 09:48 PM

I'm a REALLY bad shell programmer Wink

(my c code is much better though)

I didn't realize there was a friendly renamer already in the distro! thanks for the tip.

at any rate, I don't play 'thru' myth since I don't see the point in it, really. even when files are open for write, you can still watch them (but I don't think the PCH is smart enough to keep 'stat'ing the file to see if its growing and then updating its 'file end' size so that you can continue to view, pause and resume play from a file open for write by another process).

sure would be nice if PCH would 'know' that files can grow (if they are open for write) and if they checked the filesize every few seconds, that would be a nice work-around to having to stream or play 'thru' myth. I much prefer to just use the filesystem, directly and not IPC thru myth at all for streaming.


- n8gray - 04-24-2008 01:01 AM

Ok, so you're all using the same hacks I'm using. Too bad. :roll:

Thanks anyway!


Re: my workaround - ajr - 04-24-2008 11:34 PM

jaydonoghue Wrote:Also, you can minimize your sed pipes by putting all possibilities in [] characters... like
sed "s/[?;\/+!]//g"
And where that's not possible, '-e' can be used multiple times:
Code:
sed -e 's/abc/xyz/g' -e 's/def/uvw/g'



- linuxworks - 04-25-2008 03:39 PM

curious, is there an easy way to exclude ALL puct, other than dots (or maybe even exclude them, if needed) ?

I really hate unix filenames that have anything other than typical aphanumerics and underscores. seeing single quotes, double quotes, spaces - blech! I just don't personally believe those should EVER appear in a proper -interoperable- filename.

so, is there any really simple way to weed out those bad chars in a simple sed (or perl) script?

(while we're on this subject, might as well make it useful...) Wink


- jaydonoghue - 04-25-2008 04:02 PM

linuxworks Wrote:curious, is there an easy way to exclude ALL puct, other than dots (or maybe even exclude them, if needed) ?

Try echo | sed -e "s/[^A-Z|0-9|_-\.]//ig" .. that should work. It will get rid of anything not alpha-numeric or the chars . - _


- n8gray - 04-29-2008 05:16 AM

UPnP update: One thing I've noticed is that if I browse to Recordings > All Recordings then I can actually see the list of recordings and play them just fine. It looks like things go sideways if the PCH browses to deeply into the directory structure.


MythtvFS - Taskinen - 05-05-2008 01:20 PM

jaydonoghue Wrote:There is a much easier way to do this Tongue

MythTV comes with a script called "mythrename.pl" that does the renaming to a friendly name for you. Its in the "contrib" directory of the source tree. http://www.mythtv.org/wiki/index.php/Mythrename.pl

Why do so much (probably even cause more damage) work when you can use user space file system called MythtvFS?

In my humble opinion renaming the recording files itself is a bad idea, even if they are being updated to the database properly. The filenames itself in the file system should be separate from the user's interface.


Re: MythtvFS - jaydonoghue - 05-06-2008 04:36 PM

Taskinen Wrote:
jaydonoghue Wrote:There is a much easier way to do this Tongue

MythTV comes with a script called "mythrename.pl" that does the renaming to a friendly name for you. Its in the "contrib" directory of the source tree. http://www.mythtv.org/wiki/index.php/Mythrename.pl

Why do so much (probably even cause more damage) work when you can use user space file system called MythtvFS?

In my humble opinion renaming the recording files itself is a bad idea, even if they are being updated to the database properly. The filenames itself in the file system should be separate from the user's interface.

I had not heard of MythTVFS - thanks for the pointer. To each his own, I can understand why renaming files is easier (I do this for file browsing on my mvpmc currently). I may take a look at this as an alternate approach


RE: MythTV integration? - cavehamster - 10-09-2008 03:42 AM

I'm having the same issue on my borrowed PCH. I'd certainly buy one if I could get the sub-menu lockup resolved.

It works fine to surf to as many sub menus as you want under the 'Videos' setting, it's just under the 'Recordings' menu any sub menu locks up the box. You can hit stop to recover or wait for the timeout, but then the PCH can't see the Myth UPNP server until you hard-reboot it or wait about 20 minutes.

Anyone have any pointers for debugging? Is there a way to see what the PCH is up to, some sort of debug output? The problem may well be with the MythTV box (although other UPNP clients work like a champ), but I don't even know where to start.