--0016e64cd7ee63c0760477935bf1
Content-Type: text/plain; charset=ISO-8859-1
How about a hash or something like that?
dir RGV[0]
store ash.new
Dir.foreach(dir) do |file|
unless file /^\./
num, name, ext ile.scan(/([0-9]+\-[0-9]+)\ ([A-Za-z0-9\
]+)(\.mp3)/).flatten
if store[name]
store[name][:numbers] << num
else
store[name] :extension ext, :numbers [num] }
end
end
end
store.each do |name, properties|
filename ame + properties[:extension]
complete_file ile.open(filename, "w")
store[name][:numbers].each do |num|
part_filename um + " " + name + properties[:extension]
File.open(dir+"/"+part_filename, "r") do |f|
complete_file.write(f.read)
end
end
complete_file.close
end
On Thu, Nov 5, 2009 at 1:20 AM, Qu3ry Qu3ry <thinkinstein / gmail.com> wrote:
> Bertram Scharpf wrote:
> > Hi,
> >
> > Am Mittwoch, 04. Nov 2009, 17:57:24 +0900 schrieb Qu3ry Qu3ry:
> >> Suppose I have the following files to group and merge, according to
> >> their filenames. How to do it on Ruby?
> >>
> >> P.S In BASH, you can merge two mp3 files perfectly with the cat command.
> >> # cat file1.mp3 file2.mp3 > file.mp3
> >>
> >
> > ruby -pe '' file1.mp3 file2.mp3 >file.mp3
> >
> > Bertram
>
> How to iterate the mp3 files according to their names, so that files
> with the same names are merged together?
>
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
--0016e64cd7ee63c0760477935bf1--