FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Kubuntu User

 
 
LinkBack Thread Tools
 
Old 04-18-2008, 04:59 PM
David Fletcher
 
Default Directory traversing file converter script?

I've done a little bit of bash scripting, to do nightly and weekly backups of
a subversion server, and convert a directory of files from, say, png format
at the full resolution of my camera to jpg files for printing at the shop as
8x6 inches @ 300dpi.

What I would like now, is a script that works a little bit like rsync, in that
it can traverse a complete directory tree and detect new files, except that
I'd like to have it create a duplicate directory tree, with the files
converted to a different format.

For example, two applications I would like to implement are:-
1) Rip my audio CDs to flac format and have the computer automatically
duplicate the flac directories, but with the files converted to ogg

2) Have selections of digital photographs in png format converted to jpg for a
digital photo frame, in a duplicated directory structure.

Does anybody know of such a script that I could adapt/build upon?

I have found one called flac2ogg but I don't know any python.

Dave


--
Registered Linux user number 393408

I use and recommend the email service at 1 & 1
For domain registration, email and web hosting please visit:
http://oneandone.co.uk/xml/init?k_id=6389763

--
kubuntu-users mailing list
kubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
 
Old 04-19-2008, 05:50 AM
Anton Rolls
 
Default Directory traversing file converter script?

Hi David,

David Fletcher wrote:
> I've done a little bit of bash scripting, to do nightly and weekly backups of
> a subversion server, and convert a directory of files from, say, png format
> at the full resolution of my camera to jpg files for printing at the shop as
> 8x6 inches @ 300dpi.
>
> What I would like now, is a script that works a little bit like rsync, in that
> it can traverse a complete directory tree and detect new files, except that
> I'd like to have it create a duplicate directory tree, with the files
> converted to a different format.
>
> For example, two applications I would like to implement are:-
> 1) Rip my audio CDs to flac format and have the computer automatically
> duplicate the flac directories, but with the files converted to ogg
>
> 2) Have selections of digital photographs in png format converted to jpg for a
> digital photo frame, in a duplicated directory structure.
>
> Does anybody know of such a script that I could adapt/build upon?
>
> I have found one called flac2ogg but I don't know any python.
>
> Dave

This approach could work for you:

Your source *.flac files are assumed to be somewhere in the
ent/Music/ directory.

0. Create 'mirror' directory and give it an old date.
(Older than when you started adding your *.flac files.)

mkdir mirror
touch -d "2000-01-01" mirror

(only need do this once)

1. Create a script file 'flacs2oggs' which processes all your files.
Original *.flac are in the 'ent/Music' directory, they must be
newer than the 'mirror' directory. Format each line so it
calls oggenc on your input file and saves the output in the
mirror directory, with an extra '.ogg' filename extension.

find ent/Music/ -iname "*.flac" -newer mirror -printf "oggenc -q 6
42%h/%f42 -o 42mirror/%h/%f.ogg42
" > flacs2oggs

2. Run the script.

bash flacs2oggs

3. Rename the "*.flac.ogg" files in the mirror directory to *.ogg
files. (I leave this to you to figure out if needed.)

4. Update the timestamp on the mirror directory.

touch mirror

5. Add more files to the ent/Music directory.

6. ... and repeat from step 1 any time you want to update.

Good luck!

Anton.

--
kubuntu-users mailing list
kubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
 
Old 04-20-2008, 07:58 PM
David Fletcher
 
Default Directory traversing file converter script?

Thanks for the suggestion, but I was thinking more along the lines of a script
that can take care of everything for itself.

Anyway, I've been working on my bash scripting over the last couple of days.
Can't say I'm actually good at it yet, but I've now got something that's a
bit rough but can convert a directory tree of png images into correctly sized
jpg images for my wife's digital photo frame.

Ultimately, I'm aiming for something that's a generalised converter that can
convert png files to jpg for the digital photo frame, or flac files into
either ogg files for my iriver, or mp3 files.

Dave


--
Registered Linux user number 393408

I use and recommend the email service at 1 & 1
For domain registration, email and web hosting please visit:
http://oneandone.co.uk/xml/init?k_id=6389763

--
kubuntu-users mailing list
kubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
 
Old 04-20-2008, 09:23 PM
"Jonas Norlander"
 
Default Directory traversing file converter script?

2008/4/20 David Fletcher <kubuntu-users@thefletchers.net>:
> Thanks for the suggestion, but I was thinking more along the lines of a script
> that can take care of everything for itself.
>
> Anyway, I've been working on my bash scripting over the last couple of days.
> Can't say I'm actually good at it yet, but I've now got something that's a
> bit rough but can convert a directory tree of png images into correctly sized
> jpg images for my wife's digital photo frame.
>
> Ultimately, I'm aiming for something that's a generalised converter that can
> convert png files to jpg for the digital photo frame, or flac files into
> either ogg files for my iriver, or mp3 files.
>
>
> Dave

Hi!

Have you tried Krename? You can set it up to run other commands for every file
renamed. Perhaps that can be used to do the converting of your files? You can
save profiles and load them at start see "krename --help-all". Worth a
try i think.

/ Jonas

--
kubuntu-users mailing list
kubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
 
Old 04-20-2008, 09:29 PM
"Jonas Norlander"
 
Default Directory traversing file converter script?

2008/4/20 Jonas Norlander <jonorland@gmail.com>:
> Hi!
>
> Have you tried Krename? You can set it up to run other commands for every file
> renamed. Perhaps that can be used to do the converting of your files? You can
> save profiles and load them at start see "krename --help-all". Worth a
> try i think.
>
> / Jonas
>

Found this page. Looks great explaining what you could do with Krename.
http://www.granneman.com/techinfo/linux/utilities/krename.htm

--
kubuntu-users mailing list
kubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
 
Old 04-20-2008, 09:47 PM
David Fletcher
 
Default Directory traversing file converter script?

On Sunday 20 Apr 2008, Jonas Norlander wrote:
> 2008/4/20 Jonas Norlander <jonorland@gmail.com>:
> > Hi!
> >
> > Have you tried Krename? You can set it up to run other commands for every
file
> > renamed. Perhaps that can be used to do the converting of your files? You
can
> > save profiles and load them at start see "krename --help-all". Worth a
> > try i think.
> >
> > / Jonas
> >
>
> Found this page. Looks great explaining what you could do with Krename.
> http://www.granneman.com/techinfo/linux/utilities/krename.htm
>

I'll take a look at this, but right now I'm busy rebuilding my wife's set of
pictures for her digital frame.

I notice that that one of the first applications for krename is to put the
taken date on a set of photo files. Well, I already wrote a script to do
that! It takes raw or jpg files as copied from the camera, uses the ls
command with some parameters to get the date and time the shutter release was
pressed, and renames the files with that information. Works like a charm!

Now, what I could probably use krename for, if I want to be pedantic, is to
rename one set of pictures I took when I forgot to alter the time on the
clock to BST.

Dave

PS I think you're selecting reply-to all instead of reply-to mailing list.
Just realised why I'm getting two copies :-)

--
Registered Linux user number 393408

I use and recommend the email service at 1 & 1
For domain registration, email and web hosting please visit:
http://oneandone.co.uk/xml/init?k_id=6389763

--
kubuntu-users mailing list
kubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
 
Old 04-20-2008, 10:38 PM
"Jonas Norlander"
 
Default Directory traversing file converter script?

2008/4/20 David Fletcher <kubuntu-users@thefletchers.net>:
> PS I think you're selecting reply-to all instead of reply-to mailing list.
> Just realised why I'm getting two copies :-)
>

That's weird. Never realised it before but it doesn't make any
difference if i press
reply or reply all in Gmail, it will add the addresses for the sender
and the mailing
list. Looking at the headers of the mail I see that it's the same
addresses that is
in the Reply-To header:
Reply-To: kubuntu-users@thefletchers.net,
Kubuntu Help and User Discussions <kubuntu-users@lists.ubuntu.com>

I don't think that your address should be there, only the kubuntu-users. Could
it be that you have specified a reply address in Kmail?
Perhaps some with more knowledge could explain the right purpose of Reply-To
header?

/ Jonas

--
kubuntu-users mailing list
kubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
 

Thread Tools




All times are GMT. The time now is 03:47 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org