stack-encode 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03616382d07016371d7a1c18f72be0d40f6c16bd
4
- data.tar.gz: 4d2754cb59e14cd9c7327c76f5ae66b24d336010
3
+ metadata.gz: 56f2900c4cca6a3104b99aba5136a36f65eb6a5b
4
+ data.tar.gz: 5fbdafecde4ae7949c24557af9488f65ea08e099
5
5
  SHA512:
6
- metadata.gz: acb165b3ac089efd0e253b678d14bc08ac480f95f1f91aabb6d98399bbbc3ad1d4c39278196622d309c73cc1198c945fa42c8feaf427862effccd15c832ff185
7
- data.tar.gz: a01747eba0f809385ac594fa0c5407b60d11b9dd77f672d1258fd85f4e8aaeb9c60c5f27c3e3101fea2e3192d69b7b1f02917d68aba40d2e498fc861751fdb90
6
+ metadata.gz: 4ba7af04e39e12c2c6319c650b9966cdaed35360a7e90b8eed866e0e7619868040d1bd650b6c2898d76bc36a6726c0899b3760f976244b66f43c8b0827c04dec
7
+ data.tar.gz: e9847010d1d6e85e98b0bd2fd563f690103b45fdecc5af19eda4472fb2c3f2e0de4738b4bb5b1ee495d5bacfda3f124b37022884a74e8371b757d9c980a4602f
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Stack Encode
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/stack-encode.svg)](http://badge.fury.io/rb/stack-encode)
4
+
3
5
  A simple gem for automating the encoding process with ffmpeg.
4
6
 
5
7
  ## Installation
@@ -16,17 +18,17 @@ $ stack-encode help
16
18
  stack-encode commands:
17
19
  stack-encode encode FILES # Encodes a number video or audio files
18
20
  stack-encode help [COMMAND] # Describe available commands or one specific command
19
- stack-encode version # Outputs the version
21
+ stack-encode version # Outputs the version number
20
22
  ```
21
23
 
22
24
  Example encode command:
23
25
 
24
26
  ```bash
25
27
  $ stack-encode encode -d ~/destination/ /source/files/*
26
- Trancoding 2011-05-31_0053_lo.mpg to Mp4: [#################################] 100%
27
- Trancoding 2011-05-31_0053_loaud3.mp2 to Mp3: [#################################] 100%
28
- Trancoding 2011-05-31_0053_loaud4.mp2 to Mp3: [#################################] 100%
29
- Trancoding 2014-05-26_0010_lo.mp4 to Mp4: [#################################] 100%
28
+ Encoding 2011-05-31_0053_lo.mpg to MP4: [#################################] 100%
29
+ Encoding 2011-05-31_0053_loaud3.mp2 to MP3: [#################################] 100%
30
+ Encoding 2011-05-31_0053_loaud4.mp2 to MP3: [#################################] 100%
31
+ Encoding 2014-05-26_0010_lo.mp4 to MP4: [#################################] 100%
30
32
  ```
31
33
 
32
34
  ## Contributing
@@ -6,6 +6,10 @@ module StackEncode
6
6
  class Cli < Thor
7
7
  include Thor::Actions
8
8
 
9
+ def self.exit_on_failure?
10
+ true
11
+ end
12
+
9
13
  # catch control-c and exit
10
14
  trap("SIGINT") {
11
15
  puts " bye"
@@ -15,7 +19,7 @@ module StackEncode
15
19
  package_name "stack-encode"
16
20
  map %w(-v --version) => :version
17
21
 
18
- desc "version", "Outputs the version"
22
+ desc "version", "Outputs the version number"
19
23
  def version
20
24
  say "stack-encode v#{StackEncode::VERSION}"
21
25
  end
@@ -32,21 +36,33 @@ module StackEncode
32
36
  desc: "audio format",
33
37
  aliases: '-a',
34
38
  default: 'mp3'
39
+ option :log_file,
40
+ desc: "log file path",
41
+ aliases: '-l',
42
+ default: '/dev/null'
43
+ option :verbose,
44
+ desc: "verbose mode",
45
+ type: :boolean,
46
+ default: true
35
47
  def encode(*files)
36
- FFMPEG.logger = Logger.new('/dev/null')
48
+ FFMPEG.logger = Logger.new(options[:log_file])
37
49
  files.each do |source|
50
+ unless File.file?(source)
51
+ puts "#{source} is not a valid file"
52
+ next
53
+ end
38
54
  movie = FFMPEG::Movie.new(source)
39
55
  dest_format = movie.video_stream ? options[:video_format] : options[:audio_format]
40
56
  dest_dir = options[:destination] || File.dirname(source)
41
- banner = "Trancoding #{File.basename(source)} to #{dest_format.upcase}"
57
+ banner = "Encoding #{File.basename(source)} to #{dest_format.upcase}"
42
58
  transcoded_movie = movie.transcode(
43
59
  File.expand_path(
44
60
  "#{dest_dir}/" + File.basename(source,
45
61
  File.extname(source)
46
62
  ) + ".#{dest_format}"
47
63
  )
48
- ) {|progress| print_progress(progress * 100, banner)}
49
- puts
64
+ ) { |progress| print_progress(progress * 100, banner) if options[:verbose] }
65
+ puts if options[:verbose]
50
66
  transcoded_movie
51
67
  end
52
68
  end
@@ -1,3 +1,3 @@
1
1
  module StackEncode
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stack-encode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nik Wolfgramm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-22 00:00:00.000000000 Z
11
+ date: 2014-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor