Saturday, September 18, 2010

MediaInfo Command

I demoed MythTV at the Charleston, SC Linux Users Group meeting September 18, 2010. One of the questions was how big are the files. MythTV doesn't show file sizes any where that I can see. You can run ls -l on the recordings directory but that is no fun. So, I combined some MySQL tables with the mediainfo command and created a spreadsheet. The mediainfo command provides all kind of information. See an example in the screen shot below.

Friday, September 17, 2010

Software Freedom Day September 18, 2010

Software Freedom Day (SFD) is a celebration of free and open source software all over the world. Each team has their own separate event with separate organizers. CSCLUG's third year as a participant in the world wide Software Freedom day (!

Place: West Ashley Muddy Waters Coffee House
Time: 1pm
Date: 2010-09-18

Drop by and visit. We will have the following activities and more.

*Announcement of Summer pyGames winners
*Check out an Android Dev Setup
*Myth TV Setup
*Demos of distributions, software programs, and more!

Map for West Ashley Muddy Waters Coffee House

View Larger Map

Saturday, September 11, 2010

Watch a Folder and Upload New Files To Picasa

The bash script below will watch the PicasaWeb folder in your home directory for new files. When a new image is dropped in the folder it is uploaded to Picasa. After the upload is complete the script launches your browser to the direct URL of the uploaded photo. If you want, copy the URL in an email, dent, or tweet.

Updated Dec 4, 2010 - Now checks Google CL version so it will work in Ubuntu 11.04.

# Blog post:
# 1. Watch ~/PicasaWeb folder. 
# 2. Upload new file to Picasa using Google CLI. 
# 3. Launch the browser to the direct Picasa URL. 
googleVersion=$(google --version)
echo $googleVersion
while [ 1 ]
  echo 'Watching directory: '$WATCHED_DIR 'for new files'
  while file=$(inotifywait -q -e create "$WATCHED_DIR" --format "%f")
    echo 'New file to upload to PicasaWeb:' $file
    notify-send -i "gtk-go-up" "Picasa Web Monitor" "Uploading image $file"
    mythtvosd --template=alert --alert_text="Uploading image $file"
    google picasa post --title "Drop Box" "$WATCHED_DIR/$file"
    if [ "$googleVersion" = "google 0.9.5" ]; then
     url=$(google picasa list url-direct --title "Drop Box" | grep "$file" | sed -e "s/$file\,//g")
     url=$(google picasa list --fields url-direct --title "Drop Box" | grep "$file" | sed -e "s/$file\,//g")
    echo 'Picasa url: ' $url
    notify-send -i "gtk-home" "Picasa Web Monitor" "Image uploaded. Starting Gwibber widget."
    mythtvosd --template=alert --alert_text="Image uploaded. Starting Gwibber widget."
    python ~/Ubuntu\ One/scripts/ $url

Prerequisites and Instructions
  • You should be running Linux. I am using Ubuntu
  • You need the command inotifywait. On Ubuntu I installed it via sudo apt-get install inotify-tools
  • You must have a Picasa account
  • Install libnotify-bin for the notify-send command
  • Install Google CLI
  • Create a Picasa web folder called "Drop Box"
  • Create "PicasaWeb" folder in your home directory mkdir ~/PicasaWeb
  • Copy and paste my bash script above into a file. I named mine
  • Make executable chmod +x
  • Start the bash script ./
  • Create some images and save them to the ~/PicasaWeb folder
  • Avoid using spaces and special characters in your picture file names. The Picasa Web direct URL will be encoded and won't match your file name. The grep statement will fail to show you the direct URL.

Let me know if you find any bugs in this script or if there is a better way to do it.