Sometimes some of the most entertaining TV you’ll see can come from your local news - especially if you live in Arkansas it seems. And so was the case last Tuesday night. But more about that later. First let’s talk about getting the recorded program off of the DVR so we share it with the world, as was my mission this morning weekend. After much Googling and forum reading, this is what I found out. We have a Motorola DCT6412 III that we rent from the Cox cartel. After alot of reading on the forums at http://www.avsforums.com (especially this thread), it looked like I was out of luck on getting the recorded news clip off of the DVR and onto my Mac. Then I found this thread which laid out the plan that eventually worked. I’m putting everything I gleaned from the AVS Forums here so maybe someone else can use it and so I can remember just how I did it in the first place. Here’s what you need:

  1. The Apple FireWire SDK for OSX (version 26 as of this writing), a quick and easy install - FREE.
  2. VLC Viewer to view the stream and transcode it to another more usable format (such as MPEG-4) if you want - FREE.
  3. A FireWire 400 cable to connect your Mac to the DVR - NOT FREE, but I had one lying around.

And here are some other things you may need:

  1. HandBrake (which you should have anyway, regardless of  your platform - it’s great for ripping movies from DVD to mpeg-4 - FREE.
  2. IMovie HD - I had to use this to ultimately clip out just the part of the newscast that I wanted - comes with your Mac.

First, connect the FireWire cable to your Mac (I had both the Mac and DVR powered up, others talked about powering then down first). Fire up AVCVideoCap.app in the FireWire SDK at /Developer/FireWireSDK26/Applications and get it set and ready to record, but don’t start the recording yet. From your DVR, bring up the previously recorded program, and if you can, rewind to a minute or so before where you want to transfer, then pause the DVR. Now plug the FireWire cable into your DVR, and the program should start back up on your TV. Now start recording in AVCVideoCap, which will apparently “pause” the playback on your TV. Hit the play button on your DVR remote, which will “unpause” the playback on the DVR and output both video and audio to the .m2t filestream in AVCVideoCap. Note that when you hit play, it will not unpause what you see, just what gets output, so your TV is essentially unwatchable while transferring the video.

AVCVideoCap captures the video from the DVR to a .m2t filestream, which is basically MPEG-2. Out of the box QuickTime and IMovie don’t like m2t streams, but VLC Player does. VLC will play the m2t and you can export to mp4 (MPEG-4), which pretty much any video player will like. However, I had lots of problems in VLC just trying to go directly from the m2t stream to a mp4 - the video and audio were all jacked up when I tried that direct export in VLC. I read somewhere to try HandBrake, but it also did not like my m2t stream. After many attempts at different exports, this worked in VLC:

  • Video codec: H.264 / Bitrate: 2048
  • Audio codec:  MPEG Audio / Bitrate 192
  • Encapsulation format: MPEG TS (.ts)

This gave me a .ts stream which HandBrake would now open and convert to a mp4, which I imported into IMovie HD and clipped out just the news story I wanted. I exported from IMovie at Full Quality to mp4, and got a fairly good quality mp4 that I could then upload to YouTube or put on my Ipod. Now, this raises the question, especially with my wife, of “Is all that work, really worth it?” Maybe not. But it got to the point where I knew this could be done and just had to figure it out. Plus I have this little gem now:

Yes, there are still 365 days in a year.

I finally got done sorting my 2008 photos this morning so I can start putting Christmas gifts together with them and needed to upload about 280 pictures to Shutterfly, where I have been getting prints since about 1999. Of course I could do this with their uploader, but that would be quite lame now, wouldn’t it, considering I could use Python to do it. Using the code below, the IPTCInfo module and Jeremy Slater’s very cool shutterfly module he wrote for the GNOME Conduit Project , I can iterate through my entire 2008 photo directory, look for my photos tagged for upload, and upload them to a specific album on Shutterfly. Sweet!

  1. from IPTC import IPTCInfo
  2. import sys, os, shutterfly
  3.  
  4. class ShutterflyUploadr:
  5.  
  6. def __init__(self):
  7. pass
  8.  
  9. def grab_new_images( self ):
  10. """ Recurses thru directories and looks for images to upload. I only want to upload my ‘5-star’ images, so we scan the IPTC tags for ‘r5′, my way of tagging my pics I really like (usually get prints of r5s) """
  11. images = []
  12. for dirpath, dirnames, filenames in os.walk(‘/users/chad/pictures/2008′):
  13. for f in filenames :
  14. # Grab IPTC keywords
  15. info = IPTCInfo(os.path.join(dirpath, f))
  16. # Is it a 5-star photo?
  17. if ‘r5′ in info.keywords:
  18. ext = f.lower().split(".")[-1]
  19. if ( ext == "jpg" ):
  20. images.append( os.path.normpath( dirpath + "/" + f ) )
  21. images.sort()
  22. return images
  23.  
  24. def upload( self ):
  25. """ Upload images to Shutterfly """
  26. user = ‘your_user_name’
  27. pwd = ‘your_password’
  28. sfly = shutterfly.Shutterfly(user,pwd)
  29. # Get an existing album
  30. album = sfly.getAlbums()[‘Album_Name’]
  31. image_list = self.grab_new_images()
  32. for image in image_list:
  33. album.uploadPhoto(image, ‘image/jpeg’, os.path.basename(image))
  34.  
  35. if __name__ == ‘__main__’:
  36.  
  37. sfu = ShutterflyUploadr()
  38. sfu.upload()

This is a presentation I gave last February at the ESRI Petroleum User Group conference in Houston, TX. I just discovered SlideShare the other day.

pyArkansas 2008 a huge success

I’m way behind on posting this, but here goes.

The first annual pyArkansas Python conference was held by pyar^2, the Python Artists of Arkansas , on October 4th on the campus of the University of Central Arkansas in Conway. We were very graciously hosted by the Department of Computer Science in their very fine facilities. To our surprise, 57 people attended. Honestly, when Greg Lindstrom and myself starting planning this conference earlier this year, I think we would’ve been shocked to have 25 attend. Our registration numbers actually went above 70 folks, but the weather turned bad that morning, so that might have held some people away. We had a nice mix of beginner and experienced Pythonistas. People came from Branson, MO, Dallas, TX, and all over the state of Arkansas.

In the morning, we had classes including introductory Python (taught by Dr. Chen of UCA ), intermediate Python (taught of Jeff Rush ), and Python for systems administration (taught by Noah Gift ). These classes were very well received. The afternoon consisted of talks on pyGame, text/file processing, One Laptop Per Child (OLPC), Python eggs, the Python standard library, and Python with Eclipse. Elegant Stitches was on hand selling their great assortment of officially-licensed Python shirts and gear (thanks again for the shirt, Janet!). I highly recommend the Python logo long-sleeved easy-care oxford - go order one today.

We had great sponsorship for this event. Major monetary sponsors included the Conway Area Chamber of Commerce , Southwestern Energy Company , Novasys Health , and the Python Software Foundation . Wingware graciously provided THREE 3-OS Wingware IDE Professional seats for us to give as prizes - many thanks for those. O’Reilly publishing gave us a box of about 15 books to give away. Python Magazine and ESRI’s ArcUser both pitched in free issues of magazines for our swag bags.

We have received some pretty good press on the event as well. Overall, I’d have to say that for a first stab and for having 50 people, we pulled it off quite nicely. We are already planning next year’s conference, which will surely be bigger and better than this one was.

Are you kidding me? I’m a major amatuer at anything .NET, and after some Googling and about 15 minutes of coding, this works. How ridiculously easy.

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Data;
  5. using System.Data.SqlClient;
  6.  
  7. namespace ExecuteStoredProcedure
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. SqlConnection conn;
  14. try
  15. {
  16. conn = new SqlConnection("server=server;database=db;Trusted_Connection=yes");
  17. conn.Open();
  18. Console.WriteLine("Connection successful…");
  19. }
  20. catch (Exception ex)
  21. {
  22. Console.WriteLine(ex.Message);
  23. return;
  24. }
  25.  
  26. SqlCommand db_cmd = new SqlCommand("dbo.usp_c_sharp_test",conn);
  27. db_cmd.CommandType = CommandType.StoredProcedure;
  28.  
  29. SqlDataReader data_reader;
  30. data_reader = db_cmd.ExecuteReader();
  31. data_reader.Close();
  32. conn.Close();
  33. }
  34. }
  35. }

I’m published in ArcUser!

My (hopefully first of many) article on GIS and Python has been published in the Spring 2008 edition of ESRI’s ArcUser magazine. You can get the pdf here , and the code listings here .

flickruploadr.py now in svn

I finally got around to getting a Subversion repository setup, so the latest development version of my flickuploadr.py can be checked out:

svn co http://svn.super-cooper.com/flickruploadr/trunk

or you can just get it at:

http://svn.super-cooper.com/flickruploadr/trunk

I ate it

I just turned the corner from the kitchen to the dining room, and met up with our three year old son, and he hit me with this:

Son:
There was a booger in my nose.
Me:
And…what did you do with it?
Son:
I ate it.

Oh, the brutal honesty that is childhood.

I finally got around to getting Conversation Viewer into the WordPress plugins SVN repository. Been meaning to do that for a while. Version 1.0.0 can be had from the trunk at:

http://svn.wp-plugins.org/conversation-viewer/trunk/

The writeup and instructions/examples of usage can be found here .

I’ve attempted to use the Flickr Uploadr for the last few years, and it never has impressed me. It always fails, usually after only about 10 pictures, which really sucks when you are trying to upload hundreds of pictures, which I usually do. So last night, I had over 300 shots to upload, and after several attempts, the Flickr Uploadr just kept on failing to upload for me. I’ve been working on my own upload script (most of which is hacked from other peoples code, I must admit) for months now off and on, so I decided to give it a shot - and of course, it uploaded over 100 pics in one shot, without a single blip. As soon as I get a Subversion repository setup on my host server, I’ll get the code in there.