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 > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 01-19-2012, 04:30 PM
Ash Wyllie
 
Default scripting

I have a task that would be trivial on my old Amigas using Arexx.

I have a folder with a bunch of 30 minute mp3s in it. I would like to
resample them and them split them in to 5 minute segments.

Soundconverter and mp3split can do the work, and python can find the
file names.

But is there a way to have python call on external programs?

--
-ash
Elect Cthulhu
Vote the greatest evil



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-19-2012, 04:40 PM
Chris Green
 
Default scripting

On Thu, Jan 19, 2012 at 12:30:14PM -0500, Ash Wyllie wrote:
> I have a task that would be trivial on my old Amigas using Arexx.
>
> I have a folder with a bunch of 30 minute mp3s in it. I would like to
> resample them and them split them in to 5 minute segments.
>
> Soundconverter and mp3split can do the work, and python can find the
> file names.
>
> But is there a way to have python call on external programs?
>
There's several ways that Python can call external programs, in order of
complexity/capability (all of these are in the Python os module) :-

os.system(cmd)
Simple call of cmd, all you get back is the return code of cmd

os.popen(cmd, mode='I', bufsize=-1)
Runs cmd and allows you to read its stdout (default mode 'I'),
or by changing mode to write to its stdin.

os.popen2(), os.popen3(), os.popen4()
Similar to popen() but allow various combinations of stdin,
stdout and stderr to be read/written.

os.execXX()
Several functions which use the system's underlying C functions
of the same names to run programs with various combinations of
arguments, environment etc.



--
Chris Green

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 01-19-2012, 08:58 PM
Ash Wyllie
 
Default scripting

On Thu, 2012-01-19 at 17:40 +0000, Chris Green wrote:
> On Thu, Jan 19, 2012 at 12:30:14PM -0500, Ash Wyllie wrote:
> > I have a task that would be trivial on my old Amigas using Arexx.
> >
> > I have a folder with a bunch of 30 minute mp3s in it. I would like to
> > resample them and them split them in to 5 minute segments.
> >
> > Soundconverter and mp3split can do the work, and python can find the
> > file names.
> >
> > But is there a way to have python call on external programs?
> >
> There's several ways that Python can call external programs, in order of
> complexity/capability (all of these are in the Python os module) :-
>
> os.system(cmd)
> Simple call of cmd, all you get back is the return code of cmd
>
> os.popen(cmd, mode='I', bufsize=-1)
> Runs cmd and allows you to read its stdout (default mode 'I'),
> or by changing mode to write to its stdin.
>
> os.popen2(), os.popen3(), os.popen4()
> Similar to popen() but allow various combinations of stdin,
> stdout and stderr to be read/written.
>
> os.execXX()
> Several functions which use the system's underlying C functions
> of the same names to run programs with various combinations of
> arguments, environment etc.
>
>
Thanks, I didn't recognize the os.system() as what I wanted the first
time I saw it.

>
>
> --
> Chris Green
>

--
-ash
Elect Cthulhu
Vote the greatest evil


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

Thread Tools




All times are GMT. The time now is 01:13 AM.

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