<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Tom Moertel's Weblog: How to download photos and movies from the Palm Centro to a Linux desktop</title>
    <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Quality rants on programming theory and stuff geeks like</description>
    <item>
      <title>How to download photos and movies from the Palm Centro to a Linux desktop</title>
      <description>&lt;p&gt;I recently got a Palm Centro smartphone, and so far I love it. Like
most modern cell phones, it has a built-in camera and takes decent
snapshots and even records short movies. It&amp;#8217;s great for
spur-of-the-moment shots when I don&amp;#8217;t have my real camera.  The
trick &amp;#8211; and there&amp;#8217;s always a trick when it comes to cell phones &amp;#8211; is getting
the photos off the camera and onto my computer.&lt;/p&gt;


	&lt;p&gt;To get at my pictures, Sprint would prefer that I sign up for their
ludicrously expensive &amp;#8220;PictureMail&amp;#8221; service.  Leave it to weasely
telecom execs to come up with another way to squeeze money from
teenagers: charge them $5 each month for the &amp;#8220;privilege&amp;#8221; of sharing
their pictures with friends.  This fee, of course, is in addition to the
fee for &amp;#8220;unlimited&amp;#8221; mobile Internet use.  I guess picture bits are
somehow more expensive to move over the air than other kinds of bits.&lt;/p&gt;


	&lt;p&gt;In any case, my next goal after
getting my &lt;a href="http://blog.moertel.com/articles/2007/10/31/how-to-hotsync-the-palm-centro-with-a-fedora-7-linux-desktop-via-usb"&gt;Centro to hotsync with my Linux
workstation&lt;/a&gt; was to figure out how
to download my photos and movies.&lt;/p&gt;


	&lt;p&gt;After a bit of hacking, I figured out that the Centro stores images in
a typical digital-camera-image (DCIM) hierarchy.  For
example, I have a 4-GB microSD card installed in my Centro, and I
store my photos in the &amp;#8220;Palm&amp;#8221; album on it.  This album ends up stored
in the /DCIM/Palm directory on the card.&lt;/p&gt;


	&lt;p&gt;Using the pilot-xfer program
from the &lt;a href="http://www.pilot-link.org/"&gt;pilot-link&lt;/a&gt; project, I was able
to find the directory and its contents.  The trick was to use the
sparsely documented &amp;#8211;D flag to work with the Centro&amp;#8217;s virtual
filesystem.  Here, for example, is how I list the contents of the Palm album:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;$ pilot-xfer -p usb: -D /DCIM/Palm -l

   Listening for incoming connection on usb:... connected!

   Directory of /DCIM/Palm...
        652 Fri Nov  2 08:17:06 2007  Album.db
     292053 Fri Nov  2 09:04:20 2007  Photo_110207_001.jpg
      78493 Fri Nov  2 08:17:06 2007  Video_110207_001.3g2
         20 Wed Oct 31 12:09:20 2007  Thumbnail.db

   Thank you for using pilot-link.
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Here, you can see that I have one photo and one movie in the album.
(Movies are stored in .3g2 files that contain &lt;span class="caps"&gt;MPEG4&lt;/span&gt; video.)&lt;/p&gt;


	&lt;p&gt;To download the files, I again turned to pilot-xfer, this time using the
&amp;#8211;f (fetch) flag to fetch a list of files.
Here, for example, I&amp;#8217;ll fetch the image from the listing above:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;$ pilot-xfer -p usb: -D /DCIM/Palm -f Photo_110207_001.jpg

   Listening for incoming connection on usb:... connected!

   Fetching '/DCIM/Palm' ... (292053 bytes)   285 KiB total.

   Thank you for using pilot-link.
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;So that&amp;#8217;s the process.  It&amp;#8217;s kind of clunky, so I wrote a small Python
program to automate it.  (I&amp;#8217;m learning Python.  If you&amp;#8217;re a Pythonista, please
consider critiquing my code. I would be especially thankful if you
could point out any helpful idioms that I may have overlooked.)&lt;/p&gt;


	&lt;p&gt;Here&amp;#8217;s how to use the program:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;$ get-pilot-photos.py --help
Usage: get-pilot-photos.py [options]

Options:
  -h, --help            show this help message and exit
  -s SRCDIR, --srcdir=SRCDIR
                        VFS dir on Palm device from which to fetch images
  -d DESTDIR, --destdir=DESTDIR
                        Where to save the images on your computer
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Both the &amp;#8212;srcdir and &amp;#8212;dstdir options are optional.  If you
omit the first, the program will download photos and movies from the
/DCIM/Palm album.  If you omit the second, the program will save the
downloads to a new, timestamped directory within your home directory.&lt;/p&gt;


	&lt;p&gt;That&amp;#8217;s it.  The code is below.&lt;/p&gt;&lt;pre&gt;&lt;code style="font-size: smaller"&gt;#!/usr/bin/env python

# get-pilot-photos.py -
# Download photos and movies from my Palm Centro via pilot-link
#
# Tom Moertel &amp;lt;tom@moertel.com&amp;gt;
# 2007-11-01
#
# Copyright 2007 Thomas G. Moertel
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# See &amp;lt;http://www.gnu.org/licenses/&amp;gt; for more.

import os
import optparse
import re
import subprocess
import time

PILOT_XFER = 'pilot-xfer'
DEFAULT_PALM_IMAGE_DIR = '/DCIM/Palm'

class PhotoImporter(object):

    def __init__(self, src_dir, dest_dir=None):
        self.src_dir = src_dir
        self.dest_dir = dest_dir or self.get_image_dir()

    def run(self):
        print 'Finding images in %s on your Palm device.' % self.src_dir
        print 'Begin hotsync now...'
        images = self.get_image_list()
        if len(images) == 0:
            print 'No images were found.  Done.'
            return
        print 'Found %s images' % len(images)
        print 'Waiting for hotsync to complete...'
        time.sleep(10) # give 1st hotsync time to complete
        print 'Begin another hotsync now...'
        self.fetch_images(images)
        print 'Done.  The images were fetched to the following directory:'
        print self.dest_dir

    def get_image_list(self):
        cmdline = [PILOT_XFER, '-p',  'usb:', '-D', self.src_dir, '-l']
        proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
        listing = proc.stdout.read()
        proc.wait()
        return re.findall(r'\b\S+\.(?:jpg|3g2)\b', listing)

    def fetch_images(self, images):
        cmdline = [PILOT_XFER, '-p',  'usb:', '-D', self.src_dir, '-f'] + images
        subprocess.Popen(cmdline, cwd=self.dest_dir).wait()

    def get_image_dir(self):
        root = os.getenv('HOME') or tempfile.mkdtemp()
        now = time.strftime("%Y-%m-%d--%H.%M.%S", time.localtime())
        dir = os.path.join(root, 'images', 'unsorted-pix', now)
        os.makedirs(dir, mode=0771)
        return dir

def main():
    p = optparse.OptionParser()
    p.add_option('--srcdir', '-s', default=DEFAULT_PALM_IMAGE_DIR,
                 help='VFS dir on Palm device from which to fetch images')
    p.add_option('--destdir', '-d',
                 help='Where to save the images on your computer')
    opts, args = p.parse_args()
    PhotoImporter(opts.srcdir, opts.destdir).run()

if __name__ == '__main__':
    main()
&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Fri, 02 Nov 2007 15:32:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:92fcb359-e7e8-41dc-a5b9-86caffcde1f5</guid>
      <author>Tom Moertel</author>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop</link>
      <category>hacks</category>
      <category>movies</category>
      <category>palm</category>
      <category>centro</category>
      <category>hotsync</category>
      <category>images</category>
      <category>download</category>
      <category>python</category>
      <trackback:ping>http://blog.moertel.com/articles/trackback/616</trackback:ping>
    </item>
    <item>
      <title>"How to download photos and movies from the Palm Centro to a Linux desktop" by ISA</title>
      <description>&lt;p&gt;This is awesome, just what I needed.  I just got a Centro and was looking for an easy way to download my pictures and video.  I do in over bluetooth using the setup described at &lt;a href="http://www.newt.com/debian/treo650.html" rel="nofollow"&gt;http://www.newt.com/debian/treo650.html&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 03 Nov 2008 00:13:48 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:6e75513e-ab5d-4693-ac47-310d22af6ac1</guid>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop#comment-837</link>
    </item>
    <item>
      <title>"How to download photos and movies from the Palm Centro to a Linux desktop" by Matt</title>
      <description>&lt;p&gt;Can pilot-xfer put files back onto the Centro, or is it for downloading only?&lt;/p&gt;</description>
      <pubDate>Wed, 15 Oct 2008 11:56:31 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:0c97d8ca-6ce1-4455-8f73-98edc997af2b</guid>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop#comment-833</link>
    </item>
    <item>
      <title>"How to download photos and movies from the Palm Centro to a Linux desktop" by Dan Bodoh</title>
      <description>&lt;p&gt;I&amp;#8217;ve just built a plugin for JPilot that will download pictures, photos, and videos from the Palm Centro.  It will probably also work for the Treo 680, Treo 700p, and Treo 755p, but it hasn&amp;#8217;t yet been tested on those palms.&lt;/p&gt;


	&lt;p&gt;It&amp;#8217;s available in source code form at &lt;a href="http://sourceforge.net/projects/picsnvideos/"&gt;http://sourceforge.net/projects/picsnvideos/&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 13 May 2008 07:44:54 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:600ad194-f7c4-405e-a6d7-5cdb07da15dd</guid>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop#comment-729</link>
    </item>
    <item>
      <title>"How to download photos and movies from the Palm Centro to a Linux desktop" by Dan Bodoh</title>
      <description>&lt;p&gt;Without an SD Card, you need to get the FileZ palm app, and select &amp;#8220;Show Hidden Volumes&amp;#8221; in the prefs.&lt;/p&gt;


	&lt;p&gt;Then, the &amp;#8221;/BUILTIN&amp;#8221; card will be visible to pilot-xfer, and you can transfer photos from &amp;#8221;/BUILTIN/DCIM/Palm&amp;#8221; (ore replace &amp;#8220;Palm&amp;#8221; with any other album name).&lt;/p&gt;


	&lt;p&gt;For more info, see &lt;a href="http://lists.pilot-link.org/pipermail/pilot-link-devel/2008-April/001681.html"&gt;http://lists.pilot-link.org/pipermail/pilot-link-devel/2008-April/001681.html&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve just finished writing a pilot-foto-centro that will work without the need for FileZ, and transfer photos from both the internal memory and the SD card.  I&amp;#8217;ve sent it to the pilot-link maintainer for inclusion into pilot-link.  He will soon post it on pilot-link.org for testing.&lt;/p&gt;


	&lt;p&gt;(email dan.bodoh at the public mail host run by google)&lt;/p&gt;</description>
      <pubDate>Fri, 02 May 2008 13:26:06 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:0275b50c-4bfa-418c-aa55-20f5249106ee</guid>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop#comment-722</link>
    </item>
    <item>
      <title>"How to download photos and movies from the Palm Centro to a Linux desktop" by Tony</title>
      <description>&lt;p&gt;My wife has a Centro and I have a Motorola Q9c.  I can cheat &amp;#8211; all we have to do is send pics/videos, etc. via Bluetooth to my Q9c (which has Windows Mobile 6), and then I can click and drag from my sync-ed Q9c to my PC&amp;#8217;s hard drive.  It&amp;#8217;s nice.&lt;/p&gt;</description>
      <pubDate>Thu, 03 Apr 2008 15:54:53 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:d3237e37-e17f-440a-a165-f711582ce650</guid>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop#comment-712</link>
    </item>
    <item>
      <title>"How to download photos and movies from the Palm Centro to a Linux desktop" by JDS</title>
      <description>&lt;p&gt;So, I have a Centro also. But no MicroSD card. All of the solutions that I have seen for getting pics off the Centro assume one has an SD card installed.&lt;/p&gt;


	&lt;p&gt;How can I get my pics off with no SD card installed??&lt;/p&gt;


	&lt;p&gt;Argh!&lt;/p&gt;


	&lt;p&gt;Thanks, if anyone has a Clue&amp;#8482; for me.&lt;/p&gt;</description>
      <pubDate>Wed, 12 Mar 2008 09:31:08 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:c0c29e1e-ac65-4bae-8660-c93f2fdfbd27</guid>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop#comment-705</link>
    </item>
    <item>
      <title>"How to download photos and movies from the Palm Centro to a Linux desktop" by medazz</title>
      <description>&lt;p&gt;how? what? How?
really i cant download my videos  from the card to my pc.. is thr a program to download to my pc to view or save the videos.. i can downlaod pictures just fine by removing the card .. but i cant view my videos&amp;#8230;.. 
help&lt;/p&gt;</description>
      <pubDate>Wed, 16 Jan 2008 22:44:58 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:3e37d155-fe6e-4e31-ad1b-ead5aa5694db</guid>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop#comment-692</link>
    </item>
    <item>
      <title>"How to download photos and movies from the Palm Centro to a Linux desktop" by brmiller</title>
      <description>&lt;p&gt;Agree with Tom.  I tried removing the microSD card to short-cut a since-solved issue with my USB bus, and it was &lt;strong&gt;NOT&lt;/strong&gt; anything you would want to do.  Thanks for the python, Tom&amp;#8212;it rocks, and got me out of jam when I needed to use my Centro to capture a brainstorm on a white board here at the office.  Had to borrow a coworker&amp;#8217;s Treo cable, but only way to get that &amp;#8220;data&amp;#8221; off the whiteboard short of re-copying it.&lt;/p&gt;</description>
      <pubDate>Wed, 16 Jan 2008 17:28:51 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:52f65418-124d-45ec-870f-019df862eb70</guid>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop#comment-691</link>
    </item>
    <item>
      <title>"How to download photos and movies from the Palm Centro to a Linux desktop" by Tom Moertel</title>
      <description>&lt;p&gt;Ben, I suspect you don&amp;#8217;t have a Centro but some other Treo because taking the memory card out of a Centro is &lt;em&gt;not&lt;/em&gt; convenient.  And I&amp;#8217;m not the only person who thinks so:&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;The back (battery) cover is hard hard to remove, and a bit stiff to get back on. The microSD card door is on the phone&amp;#8217;s left side and looks tantalizingly accessible, but alas it&amp;#8217;s not. The manual suggests removing the back cover before opening the microSD card slot (indeed, it&amp;#8217;s not easy to open the plastic door unless you&amp;#8217;ve got a long fingernail). Though the manual doesn&amp;#8217;t suggest removing the back cover to eject a card, we found the card hung up on the battery cover&amp;#8217;s edge, so we had to remove the cover to get the card out. (Source: &lt;a href="http://www.mobiletechreview.com/phones/Palm-Centro.htm"&gt;Mobile Tech Review: Palm Centro&lt;/a&gt;)&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;Trust me, you would not be saving time by trying to use a card reader with the Centro.&lt;/p&gt;


	&lt;p&gt;Cheers,&lt;br /&gt;Tom&lt;/p&gt;</description>
      <pubDate>Mon, 14 Jan 2008 21:15:32 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:cd960e8c-51a8-4d57-a6bb-594e159e48e9</guid>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop#comment-690</link>
    </item>
    <item>
      <title>"How to download photos and movies from the Palm Centro to a Linux desktop" by Ben</title>
      <description>&lt;p&gt;OR you could save alot of time and use a card reader and open the card with konqueror or similar application. I find this much simpler.&lt;/p&gt;</description>
      <pubDate>Mon, 14 Jan 2008 10:45:37 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:43d9e7e2-ab86-464a-af69-235d69cc8263</guid>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop#comment-689</link>
    </item>
    <item>
      <title>"How to download photos and movies from the Palm Centro to a Linux desktop" by kloro</title>
      <description>&lt;p&gt;good post, tom.&lt;/p&gt;


	&lt;p&gt;pilot-xfer was a hassle for me until i discovered that you have to start the hotsync on the Centro (Press The Button) first, then fire pilot-xfer. This is known as The Workaround at the kpilot site.&lt;/p&gt;</description>
      <pubDate>Sat, 29 Dec 2007 16:14:52 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:942a54c3-07b3-4fc5-87e8-cee7eb06aae3</guid>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop#comment-679</link>
    </item>
    <item>
      <title>"How to download photos and movies from the Palm Centro to a Linux desktop" by brmiller</title>
      <description>&lt;p&gt;Any idea where Palm stores the camera files in its internal memory if you don&amp;#8217;t have an SD card?  I haven&amp;#8217;t located them yet.&lt;/p&gt;</description>
      <pubDate>Wed, 19 Dec 2007 23:12:55 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:d13b61a6-060b-4184-a1bb-727fb81dbf08</guid>
      <link>http://blog.moertel.com/articles/2007/11/02/how-to-download-photos-and-movies-from-the-palm-centro-to-a-linux-desktop#comment-675</link>
    </item>
  </channel>
</rss>
