Here’s something I haven’t written about in a long time — bend, my custom written CLI PHP5 scripts to rip and encode TV shows.
I actually rewrote the entire thing over Labor Day weekend. What’s amazing is it took so long to write the original one, but so short a time to completely revamp it. It’s something I’ve been wanting to do for a long time, and I’m glad I finally got to it. The code on the old one was so horrible, and was such a frustrating experience to patch, debug or add features. The new one is already 20 times better.
The first one was just plagued by scope creep, though — I started off just mostly coding it around the way that I thought DVDs *should* work and how they ought to be authored, only to be constantly slapped in the face by so many exceptions that I’d have to go back and hack it to work around the new found realities.
One example is that either lsdvd or libdvdread is buggy in how it outputs chapter information. Actually, my whole experience with chapters have been that if there are any oddities, then the players will just freak out. You wouldn’t believe the cases I ran into. Anyway, here’s a small example. On one DVD, lsdvd will report in original output that one track has 30 chapters on it. But when you go to display the chapters, it will only say that there are two. Most of the time, what happens, is that it will choke anytime there is a chapter between others that is zero length. In this case, lsdvd just chokes and stops counting them. MPlayer (at least, the ancient version I’m using) will do a couple of things depending on its mood — sometimes freeze, sometimes skip over it, sometimes act like its not even there. It’s very odd. I’ve found a lot of interesting little bugs in the dvd libraries and tools. I’d love to poke and the source and fix them up … when I have time.
The code is online in my svn repo, and the new one is called ‘drip’ for dvd ripper. Original, I know, but eventually it will replace bend completely once I add in all the features the old one had plus all the new stuff I want. I would throw in a link to trac which has prettier display output for viewing SVN files, but my installation is broken (again) and I have no idea why, and it’s always a royal pain trying to figure out what went wrong, so I’ll just fix it later. I love trac, but its not easy debugging the setup.
Oh yah, also I’ve been working on my mythvideo setup, tweaking it even more. One really thing that dawned on me, which I’ll write in more detail once I actually have a script ready, is that you can use it to execute shell scripts using the File Types admin menu. Just tell it to execute .sh files in your folders with /bin/bash and away you can go.
Another thing I learned is that MythVideo will only pass two variables to any external scripts, the default player (%d) and the video file (%s), or more accurately, the file you’ve selected to run. So if you wanted to see what you’re executing, you would add this to the file type for .sh files: /bin/bash %s %s
Then, say you had test.sh, this would be the contents:
I’m getting ahead of myself, though .. I’ll write more about that when I’ve got something to show. I’m actually working on a shell script similar to mplayer-resume to resume playback of a playlist you’re in. It’s a bit trickier than I thought it would (or rather, not nearly as simple as I had hoped), so I’m still scoping it out in my head.
Speaking of mplayer-resume, I fixed a bug I kept running into with it for a while now. The script will now catch the exit code of mplayer, and if it’s not successful (zero), then it won’t overwrite or delete the old position. I used to hit it all the time because I used to run mplayer -hardframedrop when playing my videos, which would crash the playback about 10% of the time and of course kill the file that had the playback position. I need to repackage it and push it live, but there’s a few more small fixes I want to make to it first … I might finish the playlist resume script first and add it to there. Plus I want to get trac working, because that’s where it’s homepage is.
But, I moved my mini-itx to the living room and hooked it up to my HDTV. It was sitting in my bedroom just collecting dust, and I figured I might as well move it to see if it gets any more usage. Actually, I remember now, I moved it was because the LED lights were really bright in my bedroom at night, and I have to sleep in total darkness to get a good night’s rest. Anyway, it’s worked out well so far. My TV has a VGA port so it’s super simple to plug it in, not to mention I like the fact that it doesn’t use up an HDMI port. I love my TV. 🙂 Once I have this series playlist resume script finished, I think I’ll be pretty much “done” with having the setup that I’ve wanted so long. Well, aside from the fact that I need about 12 more terabytes of harddrive space.
Good times, I tell you what. I’m gonna go watch some Star Trek TNG.