KPilot Fixes and New Years Resolution

Haven’t been very good at all lately on keeping my blog up to date. *sigh* Well, for that matter, I haven’t been very good at all lately on keeping up with much of anything. But I digress…

After a friendly post from Pablo Yepes about some address book goofiness, I removed the ugly kludge that had been in KPilot for quite a while now:

r754992 | vanrijn | 2007-12-30 21:49:50 -0500 (Sun, 30 Dec 2007) | 10 lines
Changed paths:
M /branches/KDE/3.5/kdepim/kpilot/ChangeLog
M /branches/KDE/3.5/kdepim/kpilot/conduits/abbrowserconduit/abbrowser-conduit.cc
M /branches/KDE/3.5/kdepim/kpilot/conduits/abbrowserconduit/kabcRecord.cc
M /branches/KDE/3.5/kdepim/kpilot/lib/options.h

* Fixing bug reported by Pablo Yepes on kdepim-users mailing list. We did
severe goofiness with middle names… The Palm can’t handle them, so we
blindly tacked firstname + ” ” + lastname and stuck it into the Palm’s
firstname field. The problem is that whenever a copy from palm->pc is
done, the kludged first name is transferred to kabc (”firstname middle”).
And, it’s compounded by every change in either direction. It’s an ugly
hack and I’ve removed it. The only way to work around it would be to add
an additional check for !firstname.endsWith(abEntry.additionalName()),
but that’s even sillier. Stop the insanity!

I’ve also forward-ported the fix to trunk (KDE4), so as soon as I can get around to re-enabling the addressbook conduit in trunk, at least this problem won’t be there…  =;)

Speaking of KDE4….  I keep finding myself with zero time to hack on KPilot for KDE4, but if ever I do, I think I need to approach it more different and more betterer than I have in the past. Bertjan has put a lot of work into unit tests for the new base conduit and keyring code, and I absolutely love it. Haven’t taken the time to understand it completely, but I LOVE it. I think that the goal going forward should be that everything in KPilot is unit-test-driven. I need to be able to test all code and code changes without having to physically connect a Palm device to test it with. We’ll call that a New Year’s resolution.

Oh, also, rumor on the streets all over Americana is that the world-famous Adriaan may just possibly be coming to our little KDE4 launch party in January! Oh, that would but rock.  =:D

Fix for Tab Mix Plus and iFox Theme

Blef! Finally found a fix for the awesome Tab Mix Plus Firefox extension and the iFox (and associated) themes! Sheesh. Can’t believe I tried to ignore that for so long!!

Follow these steps to fix the problem:

- Open a new tab
- Type about:config
- Create a boolean (Right click >> New >> Boolean)
- Name it: extensions.tabmix.useGreyCloseButton
- Set it as false

And your problem should be fixed.

Opera is Cool Again; PSP Comparison

Okay, well, I mean, it’s always been cool.  I’ve been using it for a few days instead of Firefox and it’s nice to see some of the new things in the Opera camp since I had last used it.  I like the widgets idea, although I can’t find any widgets that will let me post to my blog.  And I miss the del.icio.us buttons/extension that is available for Firefox.  I definitely like the feel and organization of Opera.  It just feels better and more solid.  Like the theme and appearance management.  Seriously… having to reboot your web browser to just change a theme or add in an extension… seems… really… silly.

Then again, Opera seems to have some quirks with Gmail (”#” doesn’t delete always??  keybindings stop working
until I click on the page often? textareas don’t linewrap sometimes? in fact, Wordpress’s textarea editor is now
not linewrapping, grr…).  *sigh*

Anyway, it’s nice to have a little variety every once in a while.  =:)

Oh, and I found a nice little technical comparison of the PSP and the new PSP slim at pspzine.  Verdict: seems like there’s no good technical reason for me to be lusting after a new PSP slim, so why am I jonesing for one so badly?  =:/

KPilot Insomniatic Progress

I have never had insomnia before in my life. Until tonight. I don’t know if it’s the stress of everything that’s going on in our lives right now (um, trying to sell a house in a REALLY bad housing market, trying to figure out how to pack up and move one’s family on a shoestring budget, wanting really badly to do super good on my new job that I absolutely love, etc., etc., etc.).

Or it could be that I drank a small amount of coffee today.

Whatever the reason, I couldn’t fall asleep from midnight until 1:30 a.m., so I got up and started hacking on KPilot’s USB workaround thing that I broke a year+ ago and subsequently couldn’t sync my new Treo 700p.

Well, my little droogies: let all who have funky USB Palm devices (Zire, Treo 700p, and I’m assuming also the Treo 680) rejoice once again. I’ve just successfully synced my 700p 5 times in a row with no funky button pushing, timing issues, or otherwise kludgey workarounds.

W()()T!!

I’m going to look through it again tomorrow with hopefully less-blurry eyes and then I’ll commit it.

[ UPDATE: ] Yah, so insomnia sucks. I’ve committed this. I’d love to get some feedback from any intrepid KPilot/funky USB device users! Just be sure to grab revision 749517 or later from KDE’s main subversion server (/branches/KDE/3.5/kdepim/kpilot).

[ UPDATE2: ] For the aforementioned intrepid folk, please follow the directions on our website for retrieving and building the latest source with cmake.  If you get stuck, please post a message for help on the kdepim users mailing list.  Thanks!!  =:)

KPilot Almost Progress

Blef.  So, I finally got a chance, late tonight, to hit the code, so to speak.  After an encouraging couple of e-mails with a KPilot user (hi Ryan!), and my own discouraging lack of time as of late to touch KPilot code, and the fact that I can’t sync with my Treo 700p (grr), I dug in and started looking at the guilty code.

It’s my fault, really.  I changed the device communications code in the version of KPilot that got released with KDE 3.5.7.  It was some bandaid fixes that pulled the device communications out of the main GUI thread and put it into a worker thread.  This fixed several bugs that were tied to KPilot breaking horribly for users who used libusb (device “usb:”) and bluetooth (device “net:any”).  Pulling blocking, non-UI work out of the main UI thread is goodness.  Yay!

However, it also broke the “USB workaround” feature of previous versions of KPilot that detected a non-hotsync connection from a Palm.  Now, mind you, there were problems with that code as it was, and there’s some improvements that I plan on making to it, but… frustrating….  You fix 3 things and you break 2 others.

The other problem is that there have been so many bandaids to this code (by myself, included) that what it really needs is a good house-cleaning.  So I fought with the code for a few hours tonight and I think that what I need to do next is to step back and look at the logic flows, needed functionality, involved classes, and come up with a clean design for it all.  Blech.  Which means that it’ll take a wee bit longer to have a working, syncing KPilot for my Treo 700p.

But, theoretically, we should have a much-cleaned-up code base for device comm, with fewer bugs, and much more maintainable code for the future.

Yay.  =:(

Mencoder, DVD Rip, Volume Increase, Your PSP, and You!

Holy crap. The time between iterations of testing video encoding is prohibitive to quick progress as well as a (several) good night’s sleep.

After much pain and gnashing of teeth, I present you with the result of the last 3 hours of my life.

time nice mencoder dvd://1 -sws 9 \
-aid 128 -af volume=15:0 \
-vf pullup,softskip,dsize=480:272,scale=0:0,harddup,unsharp=l3×3:0.7 \
-ofps 24000/1001 \
-oac faac -faacopts br=128:mpeg=4:object=2:raw -channels 2 -srate 48000 \
-ovc x264 -x264encopts bitrate=500:global_header:partitions=all:trellis=1:level_idc=30 \
-of lavf -lavfopts format=psp -info name=”Tomb Raider” -o “$HOME/Movies/TombRaider.mp4″

Sincere thanks to forgeflow’s answer to this ubuntu forum post and to his excellent videogeek site.

Other observations:

  • There is far more complexity to audio/video encoding than I’d ever want to understand fully.
  • Anyone who actually understands mencoder fully deserves to be the next US president.
  • No, seriously, I’d vote for him/her.
  • The above incantation of mencoder accomplishes what I need it to, namely:
    • Rips a full DVD for me without having to pull it into an intermediary file.
    • Increases the volume of the ripped/encoded track by 20 decibels in this case. Handbrake doesn’t yet let you do that.
    • Takes advantage of the newer PSP System Software’s ability to handle H264 encoding (which I hear is what all the cool kids are using these days).
  • This same thing (without being able to turn the volume up) is possible in Handbrake with this:

    ~/local/HandBrakeCLI -i /dev/dvd –longest –size 800MB -e x264 -x ref=2:mixed-refs=1:bframes=3:b-rdo=1:bime=1:weightb=1:subme=6:trellis=1:analyse=all:level=3:no-fast-pskip:me=umh –crop 0:0:0:0 -R 48 -b 1024 -w 480 -l 272 –markers -o ~/Movies/TombRaider.mp4

  • Yes, I am not ashamed to admit it: I like Tomb Raider. Angelina and I were married in an alternate dimension, and I can beat Tomb Raider Legends in 2 hours with my eyes closed.
  • One or more of the statements made in the above bullet point may be more the result of sleep-deprivation than actual truth.

Good night, Gracie.

[ Update ] Okay, nuts… apparently this video quality isn’t quite good enough because now I’m seeing weird ghosting on the PSP while watching the resultant movie. Yay, another geekly late night tonight….

[ Update 2008-03-04 ] I’ve  updated the command that I’m using now with mencoder, thanks to some comments and tweaks during the past few months.

Embedded Album Covers, Your PSP, Amarok, and You

Amarok?So… first off, I Googled for Amarok, hoping to find some new sweet pixels and instead I find this. Um… so not the Amarok that I know and love.

Anyway, a couple of years ago, I won a PSP from the LinuxWorld convention. Being that I’m a geek, it was love at first boot jingle. Being that I am married, have 3 kids, work full-time++, and try to hack every once in a while, the brave little PSP spent a lot of alone time. Oh sure, I own several PSP games (go SOCOM2!!), but that’s about it.

Until now.

Since I’m lucky enough to be able to work from home for a bit, I’m not driving back and forth to work every day and as such, I gave my iPod to my darling daughter. So I bought a 4G memory stick (oh, that reminds me, I need to blog about stupid, evil, skanky eBay sellers of fraudulent flash memory, since I wasted my time with one personally…) (but for non-fraudulent and kick-butt flash, I highly recommend SanDisk’s Gaming Pro Duo… it’s uber fast) (and that’s enough parenthetical statements for one sentence). And, having this nice little PSP and 4G of disk space on it now, I’ve been figuring out how to put stuff of interest onto it.

Movies: Totally cool. The PSP has a 480×272 screen. Handbrake does a really nice job of ripping a DVD and creating an mp4 that the PSP can play perfectly. Really, really nice. Oooh, and the new PSP OS has this nifty little auto-generating movie browser thingey that is kind of like a scene selector on a DVD movie… lets you see scene selections for the movie at configurable intervals too… Anyway, the only beef I have with Handbrake thus far is that it doesn’t allow me to increase the volume on the ripped movie. So I’m looking at ffmpeg now to see if it does as good a job as Handbrake. I’m sure I’ll blog more about that later.

Music: Really cool here too. The PSP plays a variety of audio formats and has some really nice eye candy/visualizations/etc. for your music-listening pleasure. However (and this is what actually what prompted this post), it shows album covers per song only if they’re embedded as APIC frames in your mp3’s ID3 tag. Now, I’m new to this, and didn’t know that there were such animals as APIC frames until just yesterday, but I did know that I wanted to put my album art into my little mp3s so that they’d show up all purty-like on my PSP (there, full circle now).

So, I’ve put in the usual geekly late night or two (yes, dear, I’m honestly coming to bed… in a sec…) and learned much about ID3 tags and the various tools that one might employ in one’s attempt to embed album covers in one’s mp3s. I even bugged my good friend Seb, who pointed me to a really cool “EmbedCover” script for amarok that I didn’t know existed. But, along the learning curve, I saw a lot of complaints about Amarok showing distorted embedded album covers. My problem was slightly different in that I couldn’t figure out how to get them embedded in the first place, let alone getting them there and then finding them distorted. Through trial and error (and aforementioned geekly late nights), I think I’ve found a consistent way to get album covers to be embedded and why they might show up distorted in Amarok (and other players too, mind you–it’s not Amarok’s fault).

The first step in getting album cover art embedded in my mp3s was to get a picture into each directory of my music. I organize things like this: “Artist - Album/Artist - Title.mp3″, and in each folder, I want an album cover file. One way to do this is an amarok script called CopyCover. Assuming that you’ve first found all album art for your music via Amarok’s cover manager, CopyCover will, as you are playing your music, copy the album art from Amarok’s cache into the folder for your music and call it “cover.png”. There’s also an offline script that is supposed to do the job all at once instead of you having to do it the song-by-song way, but I couldn’t get it to work for me… I think the database schema changed behind its back. An alternate route (and this is what I did) was to tell Amarok to organize all of my music for me (highlight all tracks in player and right-click, “Manage Files” | “Organize Files”, and then click the “use cover art for folder icons” checkbox. Amarok will put a “.desktop” file in each of your folders and the “Icon” attribute will point to Amarok’s cached album cover. I then wrote this simple function to copy this album art into the folder itself:

function albumcoversfromamarok() {
for f in *
do
count=$(ls –color=never $f | grep mp3| wc -l)
echo “$count : $f”
if [ $count -gt 0 ]
then
icon=$(cat “$f/.directory” 2>/dev/null | egrep “^Icon” | cut -d “=” -f2)
[ -e "$icon" ] && cp “$icon” “$f/cover.png”
fi
done
}

I then wrote 2 more simple functions that will rip through all of my folders and embed the updated album art into my mp3s:

function mp3albumcoverdir() {
if [ -e "cover.png" ]
then
convert -quality 90 -geometry 300×300\> cover.png cover.jpg
else
return
fi
for f in *.mp3
do
echo “Embedding cover in: [$f]”
mp3albumcover “$f” cover.jpg
done
}

function mp3albumcover() {
FILENAME=”$1″
IMAGE=”$2″

# first, remove existing images
# do this for FRONT_COVER and OTHER APIC types and twice just to make sure we’re clean
eyeD3 –add-image=:OTHER “$FILENAME” >/dev/null 2>&1
eyeD3 –add-image=:OTHER “$FILENAME” >/dev/null 2>&1
eyeD3 –add-image=:FRONT_COVER “$FILENAME” >/dev/null 2>&1
eyeD3 –add-image=:FRONT_COVER “$FILENAME” >/dev/null 2>&1

# now, get rid of cruft left behind by previous images
id3v2 –APIC “” “$FILENAME” >/dev/null

# make sure we have a valid id3 tag
eyeD3 –to-v2.3 “$FILENAME” >/dev/null 2>&1
# now embed the image
eyeD3 –add-image=”$IMAGE”:FRONT_COVER “$FILENAME”
}

Then I run it from the top level of my music collection with “for f in *; do; mp3albumcoverdir “$f”; done”.

Now, along the way, whenever I found an incorrect album cover embedded and tried to fix it by removing the previous album art and adding the new one, I started seeing the corrupted images in amarok that I’d been reading about. And it’s not just that amarok wasn’t able to read the images… they were truly corrupt. “eyeD3 –write-images=. $FILE” produced a corrupt image as well. And, every time I cleared the previous image and added a new one with eyeD3, I noticed that my filesize kept getting bigger and bigger. Even when I “removed” all images with eyeD3’s “–add-image=:FRONT_COVER”, the filesize of the mp3 just kept getting bigger. It was then that I tried setting the APIC frame to null (”") with id3v2, and that returned my mp3’s filesize back to where it should be. And after that, if I added the album art to the mp3, it added it cleanly, my filesize looked sane again, and Amarok was able to see the embedded album art again.

So, my theory, which is mine, and belongs to me and I own it, and what it is too, is that people who are seeing album art distortions/corruptions in amarok might possibly have files that either have more than one embedded picture, or have dirty APIC tags. If any of you, dear readers, is seeing embedded album art distortion in Amarok, would you please install id3v2 and eyeD3 onto your little Linux box and try running my mp3albumcover function against that mp3 with a new album image? I’d very much like to see if it fixes the problem for you.

I am a nerd

NerdTests.com says I'm a Slightly Dorky Nerd King.  What are you?  Click here!So, lest there be any confusion about the subject, I’m a nerd. You can blame my wife for making me take the test.  And there goes 5 minutes of my life that I’ll never get back…

Ah, Now I See What You’re Talking About

SlingPlayer_700p_Angled_270x412It’s an extremely difficult thing, trying to support this weird beast, the Palm. Or, more accurately, it’s an extremely difficult thing trying to support the numerous personalities and implementations of the Palm beast. I mean, KDE PIM as a start is about as unsexy as you could want. But genius me, I focus on the ugliest duckling of KDE PIM: KPilot. Don’t get me wrong… I’m a gadget geek, enjoy Palms immensely, and have been for… gosh… 8+ years now?? (Wow, just had to check what year the IIIe came out…). And, there’s a reason that I’m hacking on KPilot, and that’s because I honestly believe it’s the best PIM-synching Palm solution in FLOSS-land.

Anyway, back to my point… The Palm OS and its devices are a moving target, and it’s darned difficult to get it right for all of them. Until just yesterday, I had been using a Treo 650 with KPilot, and it’s been working splendidly for the last couple of years. All the while, mind you, I’ve been hearing grumblings that we don’t play all that nicely with the Treo 680 or 700p. Not having any of those (expensive) devices, I was left looking stupid saying “dunno, fellas… it works purty good fer me!” Well, HAH. As of yesterday, I am now the proud owner of a Treo 700p.

I’ll not go into the details, but suffice it to say that paying $6.95 for the last year’s worth of Sprint’s Total Equipment Protection plan has now proven to be fully worth it and I’m congratulating myself on my wisdom, 1+ years ago when I agreed to partake. The speaker (and thusly the thing that notifies one of an incoming phone call) on my Treo 650 decided to up and die on me and Sprint was extremely good about replacing my Treo because of it. And, not only did they replace it, but they replaced it with a shiny new 700p. The 700p, for those not yet gadget geeks, allows me to use Sprint’s EVDO data network, which is MUCH faster than the previous data access speed I had with my 650. Like 2400-baud compared to a T3, seemingly.

Anyway, as I have a 700p of my very own, I can now appreciate the aforementioned grumblings about KPilot not playing as nicely as it should. Apparently, Palm has done something slightly differently with the 700p than they have in other models that I have and KPilot is hanging onto the port longer than it should, even though nothing is happening on it. Hitting the “reset the device connection” button in KPilot’s GUI (and waiting 30 seconds or so… I’ll need to look at that) seems to help, but something is definitely not kosher in Denmark. I’ll try to look at it this weekend, if time allows, on the 3.5 branch.

Don’t even ask me about the KDE 4 branch…  I’m still suffering from deep depression about the state (or lack thereof) of KPilot in trunk.