| Super lazy way to group calls by similarities, requires output of the automatch… | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit 00e2eaa7783695ad2026001f0ba0ed6e590c0a26 | |
| parent a64de8bc7baea28846729624cb83ec8d32b6d46c | |
| Author: HD Moore <[email protected]> | |
| Date: Thu, 19 Feb 2009 04:11:03 +0000 | |
| Super lazy way to group calls by similarities, requires output of the automatch… | |
| Diffstat: | |
| A bin/create_media_groups.rb | 47 +++++++++++++++++++++++++++++… | |
| 1 file changed, 47 insertions(+), 0 deletions(-) | |
| --- | |
| diff --git a/bin/create_media_groups.rb b/bin/create_media_groups.rb | |
| @@ -0,0 +1,47 @@ | |
| +#!/usr/bin/env ruby | |
| +################### | |
| + | |
| +# | |
| +# Load the library path | |
| +# | |
| +base = __FILE__ | |
| +while File.symlink?(base) | |
| + base = File.expand_path(File.readlink(base), File.dirname(base)) | |
| +end | |
| +$:.unshift(File.join(File.expand_path(File.dirname(base)), '..', 'lib')) | |
| +require 'warvox' | |
| +require 'fileutils' | |
| + | |
| +# | |
| +# Script | |
| +# | |
| + | |
| +def usage | |
| + $stderr.puts "#{$0} [groups_file] [media_source] [destination]" | |
| + exit | |
| +end | |
| + | |
| + | |
| +group = ARGV.shift || usage() | |
| +src = ARGV.shift || usage() | |
| +dst = ARGV.shift || usage() | |
| + | |
| + | |
| +File.readlines(group).each do |line| | |
| + line.strip! | |
| + line.gsub!(/\-\d+/, '') | |
| + bits = line.split(/\s+/) | |
| + | |
| + | |
| + gdir = File.join(dst, bits[0]) | |
| + FileUtils.mkdir_p(gdir) | |
| + puts "Processing #{bits[0]}..." | |
| + bits.each do |num| | |
| + system("cp #{src}/#{num}.* #{gdir}") | |
| + end | |
| + | |
| +end | |
| + | |
| + | |
| + | |
| +FileUtils.mkdir_p(dst) |