playlist resume

I wrote about this a little bit a while back, wrt mplayer-resume, that I wanted to work on a way to resume playback from a playlist as well using MPlayer. Well, I finally sat down and figured it out last week. For some reason it took me a good while to figure out the logistics of how to do it rather than the coding. I dunno why. Anyway.

I wanted to wait to bump mplayer-resume until after I added something else, and this is gonna be it. Just gotta clean up the code and package it now, and it’ll be ready to go.

Here’s how it works though: the script, like mplayer-resume, acts as a wrapper to mplayer. In fact, everything is pretty much the same except that it saves both the filename along with the position in the playlist.

The problem I was having a hard time figuring out was that I wanted to easily make two options available: resume playback in the current file I’m in (old mplayer-resume functionality), and resume playback in the position in the playlist I’m in. I just finally mapped two keys on my remote, exit and stop, to take care of both of them.

Hitting Exit on my remote will save the playback of the current file and write that to the playlist position file. Then it also saves the seek time where I left off. Hitting Stop will kill the old entry and just add a line to the playlist saved position file that says what the *next* file should be on playback.

Pretty simple when you consider it, but it took me some time to figure out, mostly so that it seemed intuitive. I figured I’d have a hard time getting used to it, and hit stop accidentally and losing my place where I wanted to be, but so far it’s worked out fine. I’m happy with it.

I’m using it for playback of my TV shows, which is pretty much 95% of what I’ve got ripped on my media setup. I have a few movies, but no AC3 output, so I prefer to just stick those in my DVD player. It is the only way I can watch my Region 2 or 4 DVDs though. For TV, it works great, since I generally want to watch them in general succession of episode order. And if I don’t feel like watching a certain episode, you just hit stop and it’ll skip to the next one. Very nice. I suppose I could map a button to go *back* in the playlist if I screw things up accidentally, but I’m kinda running out of buttons to map on my remote. Besides, vague mappings that I’m supposed to remember usually hurt more than help.

Advertisements

pimp my mythvideo: another navigation patch

I’ve been working on a bug all night I noticed the other day that really annoys me in Myth, and I stayed up poking at the code trying to find a way around it. Actually, it’s a little weird how I “discovered” it, since I always perceived in the back of my mind that there was something annoying, but never pinpointed it specifically what it was doing until this week.

The bug is this: when you are using gallery view in MythVideo and you enter a folder, when you exit back to the main root menu, it repositions that folder at the top, regardless of where it was when you entered the folder.

Some pictures will probably make more sense.

Here is a screenshot of what my folder display looks like when I enter MythVideo’s gallery for the first time, and browsing for a folder to select:

 

Now, when I select that directory, I’ll see the files in there. But when I hit Escape or select the previous folder icon, it will return me back to the root menu. However, the folder layout has changed, and the row that the folder is on, originally the bottom, is now at the top.

 

 

Moving around the position of the folder layout throws my brain for a loop every time it happens, because I’m expecting to see the same display as when I was just in there, and since it’s different I have to rescan the layout visually and reprocess where I am and where I want to navigate.

This patch fixes that, and keeps the layout the same when you return to the root window.

I went ahead and added a new ebuild in my personal overlay which will install it for you if you don’t want to patch it manually. The ebuild is mythvideo-0.20.2_p15087-r2.ebuild and it also includes my original navigation patch.

Now then, there’s one small bug in it that I’d like to fix, but I don’t know any Qt or C++, and it’s a miracle in itself that I managed to even get this far on my own. In fact, I’m quite proud of myself actually that I even figured this one out all by myself, go me. :)

I originally patched it so that it would just reposition the parent view around the last folder row you were in … that is, I was doing the same thing, but not specifically for the root menu, just any folder you went into. That worked fine, provided your tree didn’t have more than one level. The second you went into a third directory Home -> Foo -> Bar, the 2nd variable would overwrite the first one so when you returned to the parent it would be whacked. If that makes any sense. Anyway, for someone with Qt knowledge, it shouldn’t be hard to fix so that it always does that no matter which folder you are in, and at what depth level. I have no idea how, though.

It’s actually kinda interesting how I figured this one out. There were two things I noticed from poking around in the code. One, to get videogallery to dump out variables to stdout, I would add this to the code:

VERBOSE(VB_GENERAL, QString(“Some text.”));

VERBOSE(VB_GENERAL, QString(“Some variable: %1”).arg(someVar));

Yah, brilliant hacking on my part, I know, but I managed to kludge my way through it and figure it out.

The second thing I realized was that if I wanted to find out if I was on the parent tree or not, I would have to create a new instance of GenericTree and check to see if getParent() returned the main root or not.

GenericTree *lparent = where_we_are->getParent();

Then, if lparent != video_tree_root you would know you’re not at the top yet.

Anyway, yah, my awesome debugging skillz at work there, but hey — it took a lot of patience and more than a few rebuilds, but it worked, and I’m happy. Woots.

One last thing — the patch will also apply cleanly against current SVN (r18336 as of this writing) since it hasn’t changed in a good while, so you don’t have to use my ebuild if you don’t want, or you could just rename it to the latest snapshot in portage and it’ll still apply.

pimp my mythvideo: navigation patch

Even though I can’t code in C++, or anything more hardcore than bash (and even that’s pretty sketchy), with a push in the right direction from a noble soul in #mythtv, I managed to mangle a patch together for MythVideo that fixes some annoyances that I’ve had for a very long time. They are:

  • Filenames won’t display underscores, but folders would
  • Getting rid of the “cover image” screen in the gallery
  • No page up, page down support with your remote

The patch is here, which should apply cleanly to media-plugins/mythvideo-0.20.2_p15087. Or you could just try and use my overlay directly. If you look at what I’ve changed, it should be really simple to make the same changes to the most recent version for SVN, since I don’t think the file has changed much between releases. Creating patches is also not my favorite thing to do, and in fact actually took me longer to create the actual diff and apply it correctly then it did to hack the code.

Here’s a complete list of what I changed, if you don’t want to go digging around the code and determining what’s happened for yourself:

First, the issue of page up / page down. Sure it’s nice that you can do that with a keyboard, but if you are using a remote, it’s painful scrolling when you have a lot of folders to look through. I remapped 1 and 7 to emulate Home and End, and 3 and 9 to emulate Page Up and Page Down.

Second, for the display of folder names, if it has an underscore in the title, that is replaced with a space. This is consistent with the naming scheme for the actual files.

Third, and always most annoying to me, is that I got rid of the information screen that displays all the metadata about a movie after you select it in gallery mode. I always thought that was pretty useless, because I already know what I want to watch, and didn’t like having to hit enter twice to start playback. There was a shortcut already, you could just hit the Play button and it would skip the screen, but I think this is more effective and natural.

Finally, I disabled the Menu, Filter and Info options by commenting them out, for the only reason that I never used them and sometimes they would pop up when I was debugging stuff with mplayer and my remote.

Needless to say, I’m much happier now with my user experience, since MythVideo is all I’m using right now. I have a really low tolerance for small tweaks that bug me, and I’m glad I finally got these taken care of. Besides, it’s forced me to start learning some C++ (again) so I don’t have to keep relying on people to help me get started.

Now I can go back to watching Roger Ramjet and Knight Rider in navigation harmony. It’s great. :)

mplayer-resume-1.5

A bug in MythVideo inspired me to work on fixing mplayer-resume tonight, so that it can properly handle movies with filenames.  I don’t know why I didn’t think about this before, but it’s simple if the file is properly escaped or quoted.  And so, mplayer-resume v1.5 is released, with support for spaces in filenames, finally, and also one other cool little thing: it works with playlists now, to a degree.

The playlists thing is kind of hard to explain, and it’d be easier to point you to the documentation that I’ve already written.  Instead, I’ll just describe what it is I’m going to use it for.

One thing I’ve been wanting to add to my MythVideo setup is some playlists so that I can randomly play something.  I have a lot of cartoons and videos and movies, and sometimes I don’t feel like picking something myself — one of the nice things about TV in general is you are genuinely surprised when you’re channel surfing and something cool just happens to crop up.  That’s kinda what I like, and what I wanted to do.  But, I wanted to take it a step further.  If I started playing $random_episode, then if I quit, I want to be able to resume playback of that same show.  Up until now, mplayer-resume wouldn’t work that way, since if you’re randomly picking something from a playlist file, there’s no real way to seek back to the same one.

That’s fixed now.  The script will read the filename of the movie you are playing when you exit (once you setup .lircrc correctly), and checks to see if that’s the same file you started playing.  So if I play random.pls and it plays Tarzan.mkv, and I exit, then when I go back to watch Tarzan, it will resume in the same place.  Basically, it saves the file position for Tarzan instead of the playlist file.  Pretty cool. :)

So, there you go.  I’ll put it in portage shortly as well.  Enjoy. :D

comcast cable tv upgrade, part two

Comcast came out on Friday morning and installed my upgraded cable connection. Strictly speaking, I have no idea which tier I’m actually on right now. I know it’s at least expanded digital cable, and I think I get some HDTV channels. To be honest, I haven’t played with the settop box for more than 5 minutes. The real reason I wanted to get cable was so that I could have the Hallmark Channel again. Unfortunately, it looks like that’s not going to happen. I’ve tried everything, and the only way I can get the channel is by using the settop box. In the meantime, I only added 4 channels that I was interested in watching (Food Network, TLC, HGTV and Animal Planet), and am living with that.

There’s a lot more channels that I like to watch, but I’m taking it slow. Another channel I’m mostly interested in is TNT, since they play Without a Trace and Cold Case regularly. I think. Anyway, I’m actually trying to cut *back* on the number of channels I watch (one of my TVs only has all the PBS channels on it, which is a nice change of pace), but the fact is that some channels on cable have a much better and interesting lineup than the local ones.

Onto the cool stuff though. The settop box is a disaster and a half, or at least the menu is. I’m going to have to take screenshots because it really is unfathomable how much of a UI nightmare this is. Here’s my biggest beef with the whole thing: you can’t setup a custom channel list, or even add / delete channels from your lineup. If you want to go channel surfing, you have to go through *every* *single* *channel*. The only option around that is to add a ‘Favorites’ list, for which the remote has a button that will flip through those, but only going up. It’s incredibly annoying because adding / deleting channels has been a standard option for TVs for decades. Comcast’s settop box does let you setup a list of your favorite channels, but to browse it, you have to go through about 3 or 4 actions on the remote to get there, and even then it only displays the list in a guide. If you go back to hitting channel up or down, it just cycles again through every channel you get. And there are a lot of channels. And of coures it doesn’t ignore the ones that you aren’t signed up for, so you get to muddle through about three dozen that you aren’t authorized for.

I *think* that that the DirecTV and Dish Network boxes let you create lists, and then keep you in those channel lists for when you want to channel surf. I’m not sure, since I’ve never given one a good hard look. I’d switch to one of those just for that, though. In fact, I probably will.

In the meantime, I’m going to screw around with this settop box for a bit more before taking it back to Comcast. From what I’ve been reading, MythTV can add the box as an input device, using a firewire connection to control the channel tuner, and of course record TV. Mine is the HDTV DVR (Motorola DCT3416), and I haven’t yet seen much info about connecting one. The anecdotal evidence so far seems to be along the lines of “plug in the cable, and it works great.” We’ll see. I don’t even have a firewire cable.

So that’s where I’m at right now. I’m not gonna use the settop box unless I can get Myth to play around with it. Even then, I don’t need it, since I can tune into all the channels I wanted anyway with my normal TV tuner cards. I still need to see exactly which channels I get. I actually ripped it out from my HDTV since the picture was so horrible to begin with. Even on component output it looked incredibly crappy, not to mention worse than my original coaxial input connection. I plugged it in briefly using HDMI, but that was just as unimpressive.

I’m toying with the idea of getting a Tivo just to see what my options are (yet another area I don’t know anything about, so who knows), but I’m not too optimistic anything good would come out of it. I’ll probably buy one used somewhere just so I can see if its worth it.

The real good thing is that, despite all these interesting issues, is that I’m perfectly happy with my original cable lineup, so if I rip everything out, I won’t miss it one bit. I’m just curious to see what I can accomplish though. It’s fun. :)

pimp my mythtv

I’ve been having a lot of fun with my mythbox lately. I’ve learned some really cool stuff about Myth, MPlayer, LVM2 and multimedia in general that is really helping to polish my setup. Add to that the fact that I’ve been working on dvd::bend quite a bit lately, and getting some bugs taken care of, and things are really adding up. I also finally took the plunge last week and bought my first 750 GB harddrive. I’m up to 1.6 TB of space in my server now (5 harddrives in one box), and I haven’t even hit 50% capacity yet. I’m sampling a little bit from all my TV series and getting them on there, so I can at least watch something from everything I have. Eventually, somewhere down the road when I have lots more space, I’ll have everything completely archived. For now, I’m still experimenting and getting used to the setup. It’s getting pretty nice.

Here’s some of the cool little stuff I’ve found out recently.

mythtv custom menus

I didn’t know this til just the other week, but the design for the menu layout that Myth uses is all in XML files, and right there in the themes directories (/usr/share/mythtv/themes). That said, you can customize them all you want! Just read the docs, and you’ll be up and running in no time. It’s really simple. It took me just a few minutes to simplify my main menu so I can jump to the TV recordings and MythVideo really easily.

mythvideo gallery view

I’m really having fun with this one. There’s a few things I’d change, but for the most part it works great. Here’s what my layout looks like right now:

mplayer + xvmc + high motion

I just barely discovered this tonight. One of my frontends is a Pentium 4 1.6 gHz, which does plenty well. You really don’t need that much horsepower to play back video. It’s got an older nvidia AGP card in there which works just fine with s-video out. The only problem I have is that there is sometimes a slight stutter on the video with some high-motion scenes. I’ve actually started to get used to it, but then I found out that using the XvMC video out option really makes things much smoother.

At first I was just playing with it to see if I could get the CPU usage down. It was only dropping by about 10%, which wasn’t that great, especially since it was still running high … around 35%. Turns out I had cpufrequtils set to use the powersave governor, so my CPU was only running at 400 mHz. Whoops. I bumped it back up to full speed, and mplayer dropped down to around 10% total.

But, even then, at the lowest speed, the video looked gorgeous. I’ll admit it might have been my imagination, but those motion blur issues seemed to go away. I was so surprised by the results that next I ran it through the Star Trek test (which everything has failed), and played back some Deep Space Nine. Normally I’ll test TNG since I’m extremely picky about the video quality on that one, and I’ve seen them enough that I can notice video artifacts more easily, and this was only the 2nd time I’ve seen this DS9 episode. But, it still looked nice. I could notice some small amounts of blur, but it was pretty minimal. So, who knows, that solution might work well for everything. We’ll see. I’m feeling pretty optimistic about it, and at the very least it works great for my older TV.

mplayer + audio delay

Before that, I was taking a break and watching some A-Team. Great stuff. On one episode, the A/V was off just slightly. This has always plagued me in the past, and it’s one of the reasons I don’t bother with encoding files. Also, this has happened before on another Universal disc (of all the DVDs I have, they have the most problems … they are rare, admittedly, but that studio is still the winner). I remembered reading somewhere about adjusting the audio delay with mplayer, so I checked the man page. You just use + and – keys on the keyboard to adjust it by 1/10th of a second each way, faster or slower. Played around with that, and the A/V was back in perfect sync. So, I mapped my channel up / down keys on my remote to do that in case I ever run into that problem again, and now that’s all fixed too.

matroska saves the day, and disk space

This is another cool one I noticed last week. This is all anecdotal evidence, so YMMV, but I’ve noticed that Matroska files are consistenly smaller than AVIs. About 8% smaller, in fact. I noticed that quite by accident while playing around with some encoding files. At first I figured I had done something wrong, but the results proved the same after quite a few tests. That is a lot of overhead for AVI, sheesh. Just one more reason to love and use Matroska. :)

Seems like there was something else, but I can’t remember now. Ah well. Anyway, I was hoping to get all those random thoughts down sometime, so there you go. Lots of fun playing around with this stuff. I’m pretty blown away by how well it’s working and how polished the whole thing is getting. Once I’m done for good, I’ll be sure to document how to reproduce the entire step in detail. Good times. :D

one htpc, coming right up

So, how long does it take to build an HTPC with Gentoo, from scratch? How about, Gentoo + LVM2 + vesafb + bootsplash + nvidia + LIRC + mplayer + XvMC + IVTV + MythTV? All in all, about eight hours. I think that’s gotta be some sorta record.

Actually, just setting up vesafb plus splashutils took me about three hours. I haven’t played with that stuff in a very long time, and since I’m on amd64, I can’t use vesafb-tng. I did try uvesafb, but didn’t feel like experimenting to see if I could get bootsplash working as well, so just went with plain old vesafb at 800×600 instead. The end result is still really nice. From boot to MythTV’s main screen, the user never sees any text (BIOS is setup to display a VGA image on POST as well).

I mostly set it up again to see if I could do it again. I’ve already got my (original) mythbox in my bedroom, which is just a small Pentium4 with a small 250 GB IDE drive. This new one, though, this is my dual-core Athlon64 with 5 SATA harddrives, totalling 880 GB just for media files. I hadn’t played with LVM2 in a good long while either, and I was cautious since last time I didn’t have much luck. This time, reading the docs, it just clicked and made sense. The thing that always confused me was how the partitioning worked. Once you wrap your brain around the concepts, it starts to work.

I’m also running the latest MythTV that is 0.20, which needs to go real stable here anyway. I’m using 2.6.22 kernel and the 1.0.1 of IVTV which is supposed to have a lotta nice fixes. I’m just glad to see Hans finally got it into the kernel. Good work, man. :) I love the new new MythTV themes in mythtv-themes-extra, too. I’m using a nice widescreen one and it’s gorgeous.

Anyway, I’ve been thinking about it for a while on and off, but I think that this time I’m going to actually write up a good Gentoo doc on how to actually do all the stuff in detail. I still can’t believe I set it all up so fast. I’ll have to post some pictures. :)