{"id":108,"date":"2006-06-05T14:31:19","date_gmt":"2006-06-05T22:31:19","guid":{"rendered":"http:\/\/www.stevenbrown.ca\/blog\/archives\/108"},"modified":"2009-01-07T17:34:05","modified_gmt":"2009-01-08T01:34:05","slug":"import-photos-script","status":"publish","type":"post","link":"https:\/\/www.stevenbrown.ca\/blog\/archives\/108","title":{"rendered":"Import Photos Script"},"content":{"rendered":"<p>I used to use a script to copy my files from my digital camera memory card to my computer.  Since recent Ubuntu releases use gnome-volume-manager to automatically prompt you with a <em>Photo Import<\/em> dialog when you insert your memory card, I never bothered using my script.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/card-detected.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" align=\"middle\" title=\"Photo Card Detected\" alt=\"Photo Card Detected\" src=\"https:\/\/i0.wp.com\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/card-detected.jpg?w=750&#038;ssl=1\" \/><\/a><\/p>\n<p>If it was just a memory card over USB (as opposed to a digital camera over USB), then all this would do is open the memory card&#8217;s DCIM folder in gthumb and you would have to manually copy the files over.  This has irritated me for a while, because I wanted the process to be as automated as possible.   So&#8230; I spent most of the night battling Bash and playing with <a title=\"Zenity man page.  (Couldn't find a designated homepage.)\" href=\"http:\/\/www.linuxmanpages.com\/man1\/zenity.1.php\">Zenity<\/a> to create a new script.  Behold!<\/p>\n<p>Once installed, after you click <strong>Import Photos<\/strong>, you should get this screen to select the destination forlder.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/select-destination.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\"  title=\"Select Destination\" alt=\"Select Destination\" src=\"https:\/\/i0.wp.com\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/select-destination.jpg?w=400&#038;ssl=1\" \/><\/a><\/p>\n<p>Once you&#8217;ve done that, it should jump straight to copying the files.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/copying.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\"  title=\"Copying Files...\" alt=\"Copying Files...\" src=\"https:\/\/i0.wp.com\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/copying.jpg?w=400&#038;ssl=1\" \/><\/a><\/p>\n<p>When it&#8217;s finished, it will ask you if you want to browse the <em>fresh<\/em> files with your favourite photo program, which you set in the script.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/finished-copying.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\"  title=\"Browse new photos?\" alt=\"Browse new photos?\" src=\"https:\/\/i0.wp.com\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/finished-copying.jpg?w=400&#038;ssl=1\" \/><\/a><\/p>\n<p>Clicking <strong>OK<\/strong> will open the destination directory in your program of choice (<a title=\"gthumb\" href=\"http:\/\/gthumb.sourceforge.net\/\">gthumb<\/a>, by default).  Clicking <strong>Cancel<\/strong> will put a notification in the notification area with a bubble saying where the photos were copied to.<\/p>\n<p>That&#8217;s it!<\/p>\n<p>My old script also used <a title=\"jhead\" href=\"http:\/\/www.sentex.net\/~mwandel\/jhead\/\">jhead<\/a> to rename the files according to date in the EXIF data, but I didn&#8217;t want to create a dependency on jhead.  Maybe I&#8217;ll add that later, as an option.<\/p>\n<h3>Installation&#8230;<\/h3>\n<p>&#8230;couldn&#8217;t be simpler.<\/p>\n<ol>\n<li><a title=\"import-photos script\" href=\"https:\/\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/import-photos\">Download the script<\/a> to a sensible place.  (I use <code>~\/bin<\/code>)<\/li>\n<li>Make sure you have executable permissions on it.<br \/>\n<code>chmod +x import-photos<\/p>\n<p><\/code><\/li>\n<li>Go to gnome-volume-properties and change the command for Digital Camera from<br \/>\n<code>gnome-volume-manager-gthumb %h<\/code><br \/>\nto the path to the import-photos script with the same parameter<br \/>\n<code>~\/bin\/import-photos %h<\/code><br \/>\n<a href=\"https:\/\/i0.wp.com\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/gnome-volume-properties.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\"   title=\"gnome-volume-properties\" alt=\"gnome-volume-properties\" src=\"https:\/\/i0.wp.com\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/gnome-volume-properties.jpg?w=400&#038;ssl=1\" \/><\/a><\/p>\n<p>In Ubuntu, you can access this window with: <strong><br \/>\nSystem > Preferences > Removable Drives and Media<\/strong>:<br \/>\n<a href=\"https:\/\/i0.wp.com\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/prefs-menu.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\"   title=\"uh oh.  I notice a typo!\" alt=\"uh oh.  I notice a typo!\" src=\"https:\/\/i0.wp.com\/www.stevenbrown.ca\/blog\/files\/2006-06-05\/prefs-menu.jpg?w=400&#038;ssl=1\" \/><\/p>\n<p><\/a><\/li>\n<li>You should be done.  \ud83d\ude42<\/li>\n<\/ol>\n<p>Guess I&#8217;d better study for my math midterm, now.  \ud83d\ude41<\/p>\n<blockquote><p><strong>Update (2006\/06\/06)<\/strong>:<\/p>\n<p>Looks like this issue (lack of USB mass storage support in gphoto2) can be resolved simply by using bleeding-edge libgphoto2 package in Dapper. <em>*gasp!*<\/em>  <a title=\"Davyd's LiveJournal\" href=\"http:\/\/davyd.livejournal.com\/\">Davyd<\/a> has built some packages and <a title=\"the relevant entry\" href=\"http:\/\/davyd.livejournal.com\/183220.html\">reports success<\/a>.  (Too bad I read his entry <em>after<\/em> writing the script&#8230;.)   Actually, I&#8217;m not sure I won&#8217;t continue using this script; it has some advantages.  Maybe.<\/p>\n<p>The first thing I want to do with pictures on my memory card is <em>get them off of the memory card<\/em>!  I don&#8217;t need to see them, I&#8217;ll browse and edit them locally &#8211; it&#8217;s faster.  The script currently copies all <em>.jpg<\/em>, <em>.avi<\/em>, <em>.mov<\/em>, and <em>.mpg<\/em> files found in the DCIM folder (and subfolders). As soon as the script has finished, I can unmount my memory card and plug it back into my camera, where it belongs. I don&#8217;t have to copy movie files in a seperate step. I will definitely try out the packages when I get a bit of time, though, because I honestly don&#8217;t know what I&#8217;m missing. Does it gphoto2 copy <em>.avi<\/em> files?<\/p>\n<p>Regardless, it was a good experience writing it.  \ud83d\ude42<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>I used to use a script to copy my files from my digital camera memory card to my computer. Since recent Ubuntu releases use gnome-volume-manager to automatically prompt you with a Photo Import dialog when you insert your memory card, I never bothered using my script. If it was just a memory card over USB&hellip; <a class=\"more-link\" href=\"https:\/\/www.stevenbrown.ca\/blog\/archives\/108\">Continue reading <span class=\"screen-reader-text\">Import Photos Script<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3,1,11],"tags":[197,12,10,4,9,29,176],"class_list":["post-108","post","type-post","status-publish","format-standard","hentry","category-geek","category-general","category-projects","tag-bash","tag-floss","tag-gnome","tag-linux","tag-photos","tag-screenshots","tag-scripts","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4jEMb-1K","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":1,"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":586,"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/posts\/108\/revisions\/586"}],"wp:attachment":[{"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stevenbrown.ca\/blog\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}