MandrivaThis Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

I just persuaded my friend to get rid of windows and put mandrake linux on it. So he did, and he is mostly happy with it except for one problem. When he plugs his digital camera in, Konqueror stops working. I know this can probably be fixed by disabling KDE from putting an icon on the desktop, but I want to make a small program that can copy pictures from his camera automatically.

Here's what I'm thinking: It will ask you what you want the group of pictures to be called... You type something in and hit enter, and it will first create a directory with that name in the "~/My Pictures/" folder. After that, it will display the text "Coppying..." and then copy all the files from "/mnt/removable/" (since it has movies too) into "~/My Pictures/(whatever directory it created)/". After it does that, it will say "Done, would you like to delete the pictures from the camera? (yes or no)". Obviously it will delete all files in the "/mnt/removable/" folder if yes, and will not if no. After it deletes (or doesn't delete) the files, it will run "konqueror ~/My Pictures/(directory)/" and then exit.

I think that this can be done with a simple shell script, but I may be wrong. I know next to nothing about programming and am still generally new to Linux. If it does need to be compiled or anything like that, that's fine too. Any help is greatly appreciated. Thanks in advance if you do help me out.

I think the Programming forum would have been a better place to post this. One of the mods will probably move it for you

That sounds interesting, though; are you thinking of a command-line interface, or something with a GUI? I'm not sure about the feasibility of running something like that automatically - it would have to be called by a USB hotplug event of some kind, so that when you plug the camera in, it knows what program to run. It'd probably be easier to make it a manually-run operation; just plug in camera, then run the program.

In my experience, there's not really a need to mount the camera as a removable drive. gphoto2 usually detects the camera as being there, and can copy files directly from the camera to a location on the hard drive (and it can even delete the ones on the camera afterwards). It might be different for your friend's camera, though. I have a Kodak DX3600, which is well-supported by gphoto2. Your friend might not be so lucky.

A quick little GUI to do the things you described wouldn't be too hard, but first I would want to know if something might already exist for that. If not, it ought to! I've only used GTKam for downloading stuff from my camera (which, while a good program overall, seems somewhat unstable at times, and I've often resorted to using gphoto2 via the command-line - not a bad interface, either way, and easily scriptable). I think this could make for a pretty useful piece of software; it's special-purpose, and could be the easiest way for Linux newbies to get photos off their camera.

And to answer your question (if a GUI is what you were thinking of): yes, you can do GUIs from a shell script. perlGTK and wxPython are a couple APIs I know of; not sure which API would be best for this tool, but if I were to write it I'd probably use wxPython (since I already know it).

I think this could be a fun project! Let me know more details about what you have in mind.

Yes, I mean that he would plug in the camera and run a program on the desktop. No GUI needed, it would be text and open in a terminal (probably Konsole), but if anyone here has enough free time, a GUI would be fine.

And, also, this camera is not a true camera, it is just seen as flash removable memory (by windows and linux. In fact, it even works as XBox memory). Mandrake automatically mounted it as /mnt/removable, and that is fine.

Sounds fairly easy to do. The disadvantage of a GUI is that it would probably require extra libraries to be installed. A simple shell script could accomplish the same task, as long as the shortcut (in KDE or wherever) is set to "run in terminal", so you can have some interaction with it.

How's this sound:

Hook up camera (or memory card, or whatever)
Run program:

1. Get pictures from where? (use gphoto2 or mounted media like /mnt/removable. Check mounted media at this point to make sure something is there. Could even show a list of cameras accessible through gphoto2 - always thinking about users with a gphoto2-supported camera. Of course, if gphoto2 isn't installed, don't worry about it.)
2. Save pictures where? (default ~/My Pictures, or maybe even default to last place you saved pictures)
3. Name for the group of pictures? (default: whatever they're called on the camera)
4. Copying pictures... (files copied from mounted media or through gphoto2)
5. Done. Delete pictures from camera/media? (Y/N)
6. Preview pictures in another program? (default: Konqueror)

Does this sound like a good approach? If I'm going to build something like this, I want it to be powerful enough to handle more general cases, and give the user some choices (and intelligent defaults), instead of assuming too much.

If you think this sounds good, I will work on implementing it! I'll probably just use a regular shell script (instead of bash), so it will be very portable (even to non-Linux platforms).

Then, if it goes well and people like it, we could try doing a GUI. Either way, it should be fun!

Sounds pretty good. I just made a beta version of it. Right now it's pretty basic - it doesn't ask where to get the pictures from or where to put them (because that's the one I made for my friend). I can email it to you, PM me your email.