bvwack 0.0.4 → 0.0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/bvwack.gemspec +1 -1
  2. data/lib/bvwack/actionator.rb +30 -0
  3. data/lib/bvwack/bvwack_version.rb +1 -1
  4. data/lib/bvwack/cleaner.rb +22 -0
  5. data/lib/bvwack/constants.rb +5 -0
  6. data/lib/bvwack/drycleaner.rb +21 -0
  7. data/lib/bvwack/drywacker.rb +11 -0
  8. data/lib/bvwack/echobasedirs.rb +16 -0
  9. data/lib/bvwack/filelistgetter.rb +53 -0
  10. data/lib/bvwack/help.rb +33 -0
  11. data/lib/bvwack/limiter.rb +16 -0
  12. data/lib/bvwack/lister.rb +26 -0
  13. data/lib/bvwack/options.rb +42 -0
  14. data/lib/bvwack/runner.rb +30 -0
  15. data/lib/bvwack/wacker.rb +12 -0
  16. data/lib/bvwack.rb +23 -1
  17. data/pkg/{bvwack-0.0.2 → bvwack-0.0.4}/README.md +0 -0
  18. data/pkg/{bvwack-0.0.2 → bvwack-0.0.4}/Rakefile +0 -0
  19. data/pkg/{bvwack-0.0.2 → bvwack-0.0.4}/bin/bvwack +0 -0
  20. data/pkg/{bvwack-0.0.2 → bvwack-0.0.4}/bvwack.gemspec +0 -0
  21. data/pkg/bvwack-0.0.4/lib/bvwack/bvwack_version.rb +3 -0
  22. data/{lib → pkg/bvwack-0.0.4/lib}/bvwack/convert.rb +0 -0
  23. data/pkg/{bvwack-0.0.2 → bvwack-0.0.4}/lib/bvwack.rb +0 -0
  24. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2/README.md +25 -0
  25. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2/Rakefile +7 -0
  26. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2/bin/bvwack +3 -0
  27. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2/bvwack.gemspec +19 -0
  28. data/pkg/{bvwack-0.0.2 → bvwack-0.0.4/pkg/bvwack-0.0.2}/lib/bvwack/bvwack_version.rb +0 -0
  29. data/pkg/{bvwack-0.0.2 → bvwack-0.0.4/pkg/bvwack-0.0.2}/lib/bvwack/convert.rb +0 -0
  30. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2/lib/bvwack.rb +1 -0
  31. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2.gem +0 -0
  32. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/README.md +25 -0
  33. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/Rakefile +7 -0
  34. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/bin/bvwack +3 -0
  35. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/bvwack.gemspec +19 -0
  36. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/lib/bvwack/bvwack_version.rb +3 -0
  37. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/lib/bvwack/convert.rb +248 -0
  38. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/lib/bvwack.rb +1 -0
  39. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/README.md +25 -0
  40. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/Rakefile +7 -0
  41. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/bin/bvwack +3 -0
  42. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/bvwack.gemspec +19 -0
  43. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/lib/bvwack/bvwack_version.rb +3 -0
  44. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/lib/bvwack/convert.rb +252 -0
  45. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/lib/bvwack.rb +1 -0
  46. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2.gem +0 -0
  47. data/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3.gem +0 -0
  48. data/pkg/bvwack-0.0.4.gem +0 -0
  49. data/pkg/bvwack-0.0.5/README.md +25 -0
  50. data/pkg/bvwack-0.0.5/Rakefile +7 -0
  51. data/pkg/bvwack-0.0.5/bin/bvwack +3 -0
  52. data/pkg/bvwack-0.0.5/bvwack.gemspec +19 -0
  53. data/pkg/bvwack-0.0.5/lib/bvwack/actionator.rb +30 -0
  54. data/pkg/bvwack-0.0.5/lib/bvwack/bvwack_version.rb +3 -0
  55. data/pkg/bvwack-0.0.5/lib/bvwack/cleaner.rb +22 -0
  56. data/pkg/bvwack-0.0.5/lib/bvwack/constants.rb +5 -0
  57. data/pkg/bvwack-0.0.5/lib/bvwack/drycleaner.rb +21 -0
  58. data/pkg/bvwack-0.0.5/lib/bvwack/drywacker.rb +11 -0
  59. data/pkg/bvwack-0.0.5/lib/bvwack/echobasedirs.rb +16 -0
  60. data/pkg/bvwack-0.0.5/lib/bvwack/filelistgetter.rb +53 -0
  61. data/pkg/bvwack-0.0.5/lib/bvwack/help.rb +33 -0
  62. data/pkg/bvwack-0.0.5/lib/bvwack/limiter.rb +16 -0
  63. data/pkg/bvwack-0.0.5/lib/bvwack/lister.rb +26 -0
  64. data/pkg/bvwack-0.0.5/lib/bvwack/options.rb +42 -0
  65. data/pkg/bvwack-0.0.5/lib/bvwack/runner.rb +30 -0
  66. data/pkg/bvwack-0.0.5/lib/bvwack/wacker.rb +12 -0
  67. data/pkg/bvwack-0.0.5/lib/bvwack.rb +23 -0
  68. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.2.gem +0 -0
  69. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/README.md +25 -0
  70. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/Rakefile +7 -0
  71. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/bin/bvwack +3 -0
  72. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/bvwack.gemspec +19 -0
  73. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/lib/bvwack/bvwack_version.rb +3 -0
  74. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/lib/bvwack/convert.rb +248 -0
  75. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/lib/bvwack.rb +1 -0
  76. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/README.md +25 -0
  77. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/Rakefile +7 -0
  78. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/bin/bvwack +3 -0
  79. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/bvwack.gemspec +19 -0
  80. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/lib/bvwack/bvwack_version.rb +3 -0
  81. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/lib/bvwack/convert.rb +252 -0
  82. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/lib/bvwack.rb +1 -0
  83. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2.gem +0 -0
  84. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.3.gem +0 -0
  85. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/README.md +25 -0
  86. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/Rakefile +7 -0
  87. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/bin/bvwack +3 -0
  88. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/bvwack.gemspec +19 -0
  89. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/lib/bvwack/bvwack_version.rb +3 -0
  90. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/lib/bvwack/convert.rb +248 -0
  91. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/lib/bvwack.rb +1 -0
  92. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2/README.md +25 -0
  93. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2/Rakefile +7 -0
  94. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2/bin/bvwack +3 -0
  95. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2/bvwack.gemspec +19 -0
  96. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2/lib/bvwack/bvwack_version.rb +3 -0
  97. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2/lib/bvwack/convert.rb +252 -0
  98. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2/lib/bvwack.rb +1 -0
  99. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.2.gem +0 -0
  100. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/README.md +25 -0
  101. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/Rakefile +7 -0
  102. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/bin/bvwack +3 -0
  103. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/bvwack.gemspec +19 -0
  104. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/lib/bvwack/bvwack_version.rb +3 -0
  105. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/lib/bvwack/convert.rb +248 -0
  106. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/lib/bvwack.rb +1 -0
  107. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/README.md +25 -0
  108. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/Rakefile +7 -0
  109. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/bin/bvwack +3 -0
  110. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/bvwack.gemspec +19 -0
  111. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/lib/bvwack/bvwack_version.rb +3 -0
  112. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/lib/bvwack/convert.rb +252 -0
  113. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2/lib/bvwack.rb +1 -0
  114. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3/pkg/bvwack-0.0.2.gem +0 -0
  115. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4/pkg/bvwack-0.0.3.gem +0 -0
  116. data/pkg/bvwack-0.0.5/pkg/bvwack-0.0.4.gem +0 -0
  117. data/pkg/bvwack-0.0.5.gem +0 -0
  118. metadata +117 -11
data/bvwack.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.requirements = ['ffmpeg and a libx264-slow.ffpreset (possibly in your ~/.ffmpeg/ directory.) Google is your friend.']
14
14
  s.rubyforge_project = "bvwack"
15
15
  s.required_ruby_version = '>=1.9'
16
- s.files = Dir['**/**']
16
+ s.files = Dir['bin/**/**', 'lib/**/**', 'pkg/**/**', '*']
17
17
  s.executables = ["bvwack"]
18
18
  s.has_rdoc = false
19
19
  end
@@ -0,0 +1,30 @@
1
+ class Actionator
2
+ def initialize(options, to_clean_list, converted_file_list, not_converted_list, to_convert_list, iteration_limit)
3
+ @options = options
4
+ @to_clean_list = to_clean_list
5
+ @converted_files_list = converted_file_list
6
+ @not_converted_list = not_converted_list
7
+ @to_convert_list = to_convert_list
8
+ @iteration_limit = iteration_limit
9
+ end
10
+
11
+ def actionate
12
+ case
13
+ when @options[:wack] == TRUE && @options[:clean_up] == TRUE
14
+ puts("Error! -w (--wack) and -c (--clean-up) cannot be used simultaneously.")
15
+ when @options[:list_converted] == TRUE
16
+ Lister.new(@to_clean_list, @converted_file_list, @not_converted_list).list_converted
17
+ when @options[:dry_run] == TRUE && @options[:clean_up] == TRUE
18
+ Runner.new(:dry_clean_up, @options, @iteration_limit, @to_clean_list, @not_converted_list, @to_convert_list).run
19
+ when @options[:clean_up] == TRUE
20
+ Runner.new(:clean_up, @options, @iteration_limit, @to_clean_list, @not_converted_list, @to_convert_list).run
21
+ when @options[:dry_run] == TRUE && @options[:wack] == TRUE
22
+ Runner.new(:dry_wack, @options, @iteration_limit, @to_clean_list, @not_converted_list, @to_convert_list).run
23
+ when @options[:wack] == TRUE
24
+ Runner.new(:wack, @options, @iteration_limit, @to_clean_list, @not_converted_list, @to_convert_list).run
25
+ else
26
+ man = Help.new
27
+ man.be_helpful
28
+ end
29
+ end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module BVWack
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5.1'
3
3
  end
@@ -0,0 +1,22 @@
1
+ class Cleaner
2
+ def initialize(options_list, to_clean_list, not_converted_list)
3
+ @options_list = options_list
4
+ @to_clean_list = to_clean_list
5
+ @not_converted_list = not_converted_list
6
+ if @options_list[:base_dir]
7
+ @clean_dir = "#{@options_list[:base_dir]}/bvwack-back"
8
+ else
9
+ @clean_dir = DEFAULT_CLEAN_BASE_DIR
10
+ end
11
+ end
12
+
13
+ def clean_up
14
+ if @to_clean_list.length > 0
15
+ key = @to_clean_list.pop
16
+ filename = @not_converted_list[key]
17
+ dirname = File.dirname(@not_converted_list[key])
18
+ `mkdir -p "#{@clean_dir}/#{dirname}" && mv "#{filename}" "#{@clean_dir}/#{filename}"`
19
+ #puts "I would have run clean_up"
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ DEFAULT_CONVERT_BASE_DIR = "#{ENV['PWD']}"
2
+ DEFAULT_CLEAN_BASE_DIR = "#{ENV['PWD']}/bvwack-back"
3
+ DEFAULT_ITERATION_LIMIT = 2
4
+ DEFAULT_THREADS = 3
5
+ FFMPEG_OPTS = "-acodec aac -ac 2 -ab 160k -s 1024x768 -vcodec libx264 -vpre slow -vpre iPod640 -vb 1200k -f mp4 -threads #{DEFAULT_THREADS} -strict experimental"
@@ -0,0 +1,21 @@
1
+ class DryCleaner
2
+ def initialize(options_list, to_clean_list, not_converted_list)
3
+ @options_list = options_list
4
+ @to_clean_list = to_clean_list
5
+ @not_converted_list = not_converted_list
6
+ if @options_list[:base_dir]
7
+ @clean_dir = "#{@options_list[:base_dir]}/bvwack-back"
8
+ else
9
+ @clean_dir = DEFAULT_CLEAN_BASE_DIR
10
+ end
11
+ end
12
+
13
+ def dry_clean_up
14
+ if @to_clean_list.length > 0
15
+ key = @to_clean_list.pop
16
+ filename = @not_converted_list[key]
17
+ dirname = File.dirname(@not_converted_list[key])
18
+ puts %Q{mkdir -p "#{@clean_dir}/#{dirname}" && mv "#{filename}" "#{@clean_dir}/#{filename}"\n\n}
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ class DryWacker
2
+ def initialize(path_to_file)
3
+ @path_to_file = path_to_file
4
+ end
5
+
6
+ def dry_wack
7
+ if @path_to_file.class == String
8
+ puts "ffmpeg -i #{@path_to_file} #{FFMPEG_OPTS} #{@path_to_file.gsub(/mkv$|avi$/, "ipad.mp4")}\n\n"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+
2
+ class EchoBaseDirs
3
+ def initialize(options)
4
+ @options = options
5
+ end
6
+
7
+ def echo_base_dirs
8
+ if @options[:base_dir]
9
+ puts "\nOperating in #{ @options[:base_dir]}"
10
+ puts "I will create #{ @options[:base_dir]}/bvwack-back to store converted files if you use clean-up.\n\n"
11
+ else
12
+ puts "\nOperating in #{DEFAULT_CONVERT_BASE_DIR}"
13
+ puts "I will create #{ DEFAULT_CLEAN_BASE_DIR} to store converted files if you use clean-up.\n\n"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,53 @@
1
+ class FileListGetter
2
+ def initialize(options)
3
+ @options = options
4
+ @converted_files = { }
5
+ @not_converted_files = { }
6
+ @to_convert = []
7
+ get_all_files
8
+ end
9
+
10
+ def get_all_files
11
+ if @options[:base_dir]
12
+ base_dir = @options[:base_dir]
13
+ else
14
+ base_dir = DEFAULT_CONVERT_BASE_DIR
15
+ end
16
+ Dir.chdir(base_dir)
17
+ converted_files = Dir.glob(File.join("**", "*ipad.mp4"))
18
+ converted_files.each do |i|
19
+ if i.include?("bvwack-back")
20
+ next
21
+ else
22
+ @converted_files[File.basename(i, ".ipad.mp4")] = i
23
+ end
24
+ end
25
+ not_converted_files = Dir.glob(File.join("**", "*.{mkv,avi}"))
26
+ not_converted_files.each do |i|
27
+ if i.include?("bvwack-back")
28
+ next
29
+ else
30
+ if File.basename(i).split(".").last == "mkv"
31
+ @not_converted_files[File.basename(i, ".mkv")] = i
32
+ elsif File.basename(i).split(".").last == "avi"
33
+ @not_converted_files[File.basename(i, ".avi")] = i
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ def converted_files
40
+ @converted_files
41
+ end
42
+
43
+ def not_converted_files
44
+ @not_converted_files
45
+ end
46
+
47
+ def get_unconverted_files
48
+ (@not_converted_files.keys - @converted_files.keys).each do |key|
49
+ @to_convert << @not_converted_files[key]
50
+ end
51
+ @to_convert
52
+ end
53
+ end
@@ -0,0 +1,33 @@
1
+ require_relative 'bvwack_version'
2
+ class Help
3
+ def be_helpful
4
+ puts "
5
+ Usage: bvwack <options>
6
+
7
+ version #{VERSION}
8
+
9
+ Default action is equivalent to bvwack -n 2
10
+
11
+ Options:
12
+ -b BASE_DIR, --base-dir BASE_DIR Set BASE_DIR instead of /Volumes/thundar/media/video
13
+ -d, --dry-run Do a dry run. Prints proposed commands to STDOUT.
14
+ -c, --clean-up Instead of converting, move all converted files to /Volumes/thundar/media/converted/[old-path]
15
+ -n #, --num-files # Number of videos to batch.
16
+ -l, --list_converted Lists files that have been converted but not cleaned. Useful for vierifying successful conversion.
17
+
18
+ Notes: By default this will not work for you. You must change DEFAULT_CONVERT_BASE_DIR
19
+ and DEFAULT_CLEAN_BASE_DIR to something that exists on your system. Do not let
20
+ the clean dir be a subdirectory of base dir or you'll be sad. I have set the
21
+ FFMPEG options to use only 2 threads. This allows me to use my laptop while
22
+ converting things. If you just want to hog through video try setting -threads 0
23
+ in FFMPEG_OPTS. Currently this only works on UNIX-like systems.
24
+
25
+ Requirements: ffmpeg and a libx264-slow.ffpreset (possibly in your ~/.ffmpeg/ directory or in your Cellar if you use brew.) Google is your friend.
26
+
27
+ Examples:
28
+ bvwack -dw Shows proposed commands for 2 videos
29
+ bvwack -w -b somedir/anotherdir -n 5 Converts 5 videos under somedir/anotherdir
30
+ bvwack -c -n 10 Moves 10 already converted mkv or avi files to /Volumes/thundar/medai/converted/[od-path]"
31
+
32
+ end
33
+ end
@@ -0,0 +1,16 @@
1
+ require_relative "constants"
2
+
3
+ class Limiter
4
+ def initialize(options)
5
+ @options = options
6
+ end
7
+
8
+ def set_limit
9
+ if @options[:num_files]
10
+ limit = (@options[:num_files] - 1).to_i
11
+ else
12
+ limit = DEFAULT_ITERATION_LIMIT
13
+ end
14
+ limit
15
+ end
16
+ end
@@ -0,0 +1,26 @@
1
+ class Lister
2
+ def initialize(to_clean_list, converted_files_list, not_converted_list)
3
+ @to_clean_list = to_clean_list
4
+ @converted_files_list = converted_files_list
5
+ @not_converted_list = not_converted_list
6
+ end
7
+
8
+ def list_converted
9
+ begin
10
+ while @to_clean_list
11
+ key = @to_clean_list.pop
12
+ converted_filename = @converted_files_list[key]
13
+ old_filename = @not_converted_list[key]
14
+ dirname = File.dirname(@not_converted_list[key])
15
+ puts "\nConverted file:\n"
16
+ puts %Q{In Directory "#{dirname}"}
17
+ p `ls -lh "#{converted_filename}"`
18
+ p `ls -lh "#{old_filename}"`
19
+ puts %Q{To test run: open "#{converted_filename}"}
20
+ puts "\n"
21
+ end
22
+ rescue
23
+ puts("\nNothing to list")
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,42 @@
1
+ require 'optparse'
2
+
3
+ class GetOptions
4
+ def initialize
5
+ @options = {}
6
+ option_parser = OptionParser.new do |opts|
7
+ opts.on("-d", "--dry-run") do
8
+ @options[:dry_run] = true
9
+ end
10
+
11
+ opts.on("-b BASE_DIR", "--base-dir BASE_DIR") do |base_dir|
12
+ @options[:base_dir] = base_dir
13
+ end
14
+
15
+ opts.on("-c", "--clean-up") do
16
+ @options[:clean_up] = true
17
+ end
18
+
19
+ opts.on("-n NUM_FILES", "--num-files NUM_FILES", Integer) do |num_files|
20
+ @options[:num_files] = num_files
21
+ end
22
+
23
+ opts.on("-h", "--help") do
24
+ @options[:help] = true
25
+ end
26
+
27
+ opts.on("-l", "--list-converted") do
28
+ @options[:list_converted] = true
29
+ end
30
+
31
+ opts.on("-w", "--wack") do
32
+ @options[:wack] = true
33
+ end
34
+ end
35
+ option_parser.parse!
36
+
37
+ end
38
+
39
+ def put_options
40
+ @options
41
+ end
42
+ end
@@ -0,0 +1,30 @@
1
+ class Runner
2
+ def initialize(command, options, iteration_limit, to_clean_list, not_converted_list, to_convert_list)
3
+ @command = command
4
+ @options = options
5
+ @iteration_limit = iteration_limit
6
+ @to_clean_list = to_clean_list
7
+ @not_converted_list = not_converted_list
8
+ @to_convert_list = to_convert_list
9
+
10
+ end
11
+
12
+ def run
13
+ EchoBaseDirs.new(@options).echo_base_dirs
14
+ (0..@iteration_limit).each do |i|
15
+ case
16
+ when @command == :dry_clean_up
17
+ DryCleaner.new(@options, @to_clean_list, @not_converted_list).dry_clean_up
18
+ when @command == :clean_up
19
+ Cleaner.new(@options, @to_clean_list, @not_converted_list).clean_up
20
+ when @command == :dry_wack
21
+ file = @to_convert_list[i]
22
+ DryWacker.new(file).dry_wack
23
+ when @command == :wack
24
+ file = @to_convert_list[i]
25
+ Wacker.new(file).wack
26
+ else
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,12 @@
1
+ class Wacker
2
+ def initialize(path_to_file)
3
+ @path_to_file = path_to_file
4
+ end
5
+
6
+ def wack
7
+ if @path_to_file.class == String
8
+ `ffmpeg -i "#{@path_to_file}" #{FFMPEG_OPTS} "#{@path_to_file.gsub(/mkv$|avi$/, "ipad.mp4")}"`
9
+ #puts "I would have wacked"
10
+ end
11
+ end
12
+ end
data/lib/bvwack.rb CHANGED
@@ -1 +1,23 @@
1
- require "bvwack/convert"
1
+ require_relative 'bvwack/help'
2
+ require_relative 'bvwack/options'
3
+ require_relative 'bvwack/lister'
4
+ require_relative 'bvwack/drycleaner'
5
+ require_relative 'bvwack/cleaner'
6
+ require_relative 'bvwack/echobasedirs'
7
+ require_relative 'bvwack/runner'
8
+ require_relative 'bvwack/wacker'
9
+ require_relative 'bvwack/drywacker'
10
+ require_relative 'bvwack/limiter'
11
+ require_relative 'bvwack/filelistgetter'
12
+ require_relative 'bvwack/constants'
13
+ require_relative 'bvwack/actionator'
14
+
15
+ options = GetOptions.new.put_options
16
+ p options
17
+ iteration_limit = Limiter.new(options).set_limit
18
+ file_list_getter = FileListGetter.new(options)
19
+ converted_files = file_list_getter.converted_files
20
+ not_converted_files = file_list_getter.not_converted_files
21
+ to_convert = file_list_getter.get_unconverted_files
22
+ to_clean = not_converted_files.keys & converted_files.keys
23
+ Actionator.new(options, to_clean, converted_files, not_converted_files, to_convert, iteration_limit).actionate
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ module BVWack
2
+ VERSION = '0.0.4'
3
+ end
File without changes
File without changes
@@ -0,0 +1,25 @@
1
+ # bvwack - Bulk Convert video files
2
+
3
+ Author:: Robie Lutsey
4
+
5
+ Copyright:: Copyright (c) 2012 by Robie Lutsey
6
+ License:: Distributed under the Apache License
7
+
8
+ bvwack (sounds like bivouc) is a dead simple tool for converting logs of video files.
9
+ Currently it supports .avi and .mkv --> iPad compatible .mp4.
10
+
11
+ ## Install
12
+
13
+ gem install bvwack
14
+
15
+ ## Use
16
+
17
+ bvwack -[wc] < -n # -b base-dir >
18
+
19
+ For more help:
20
+
21
+ bvwack --help
22
+
23
+ ## Developing for `bvwack`
24
+
25
+ TODO
@@ -0,0 +1,7 @@
1
+ require "rake/gempackagetask"
2
+
3
+ spec = eval(File.read('bvwack.gemspec'))
4
+
5
+ Rake::GemPackageTask.new(spec) do |pkg|
6
+
7
+ end
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'bvwack'
@@ -0,0 +1,19 @@
1
+ $LOAD_PATH.push File.expand_path("../lib/bvwack", __FILE__)
2
+ require "bvwack_version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "bvwack"
6
+ s.version = BVWack::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Robie Lutsey"]
9
+ s.email = ["robie 0x55D in dec at gmail dit com"]
10
+ s.homepage = ""
11
+ s.summary = %q{bvwack will wack it's way your pile of unconverted video files.'}
12
+ s.description = %q{Super simple utility to help you convert all your videos to iPad ready files.}
13
+ s.requirements = ['ffmpeg and a libx264-slow.ffpreset (possibly in your ~/.ffmpeg/ directory.) Google is your friend.']
14
+ s.rubyforge_project = "bvwack"
15
+ s.required_ruby_version = '>=1.9'
16
+ s.files = Dir['**/**']
17
+ s.executables = ["bvwack"]
18
+ s.has_rdoc = false
19
+ end
@@ -0,0 +1 @@
1
+ require "bvwack/convert"
@@ -0,0 +1,25 @@
1
+ # bvwack - Bulk Convert video files
2
+
3
+ Author:: Robie Lutsey
4
+
5
+ Copyright:: Copyright (c) 2012 by Robie Lutsey
6
+ License:: Distributed under the Apache License
7
+
8
+ bvwack (sounds like bivouc) is a dead simple tool for converting logs of video files.
9
+ Currently it supports .avi and .mkv --> iPad compatible .mp4.
10
+
11
+ ## Install
12
+
13
+ gem install bvwack
14
+
15
+ ## Use
16
+
17
+ bvwack -[wc] < -n # -b base-dir >
18
+
19
+ For more help:
20
+
21
+ bvwack --help
22
+
23
+ ## Developing for `bvwack`
24
+
25
+ TODO
@@ -0,0 +1,7 @@
1
+ require "rake/gempackagetask"
2
+
3
+ spec = eval(File.read('bvwack.gemspec'))
4
+
5
+ Rake::GemPackageTask.new(spec) do |pkg|
6
+
7
+ end
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'bvwack'
@@ -0,0 +1,19 @@
1
+ $LOAD_PATH.push File.expand_path("../lib/bvwack", __FILE__)
2
+ require "bvwack_version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "bvwack"
6
+ s.version = BVWack::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Robie Lutsey"]
9
+ s.email = ["robie 0x55D in dec at gmail dit com"]
10
+ s.homepage = ""
11
+ s.summary = %q{bvwack will wack it's way your pile of unconverted video files.'}
12
+ s.description = %q{Super simple utility to help you convert all your videos to iPad ready files.}
13
+ s.requirements = ['ffmpeg and a libx264-slow.ffpreset (possibly in your ~/.ffmpeg/ directory.) Google is your friend.']
14
+ s.rubyforge_project = "bvwack"
15
+ s.required_ruby_version = '>=1.9'
16
+ s.files = Dir['**/**']
17
+ s.executables = ["bvwack"]
18
+ s.has_rdoc = false
19
+ end
@@ -0,0 +1,3 @@
1
+ module BVWack
2
+ VERSION = '0.0.3'
3
+ end