hardcode 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91f7b01d422c471ab88fc6c5bf4d576d047082b5
4
- data.tar.gz: bc459b0a0b1cc140ad2cdac39ca8f02d5a647713
3
+ metadata.gz: 2d912e26331e0a103b0b2c31b9e5ebb45a0a4b01
4
+ data.tar.gz: 3a350306ec0f7707c1767e0f6f66939d65947e6a
5
5
  SHA512:
6
- metadata.gz: a4cb4f4065e4c06b81e623f9926bd4fe12ea7327d754606e7c5cf2e9091357d01ef2ea4e3c4ff1a14de68c57488ff39eaa5a0d5262b7eeb178abba6813fc03cb
7
- data.tar.gz: b6ddc03f544dcbee2968298f0a587dbec37ed0e74a0ed2d42c45feeb397acd59f014a225fc25f430dffc5915b6d97534c6e63eb3c5f84b6a44d8df98ae9fc195
6
+ metadata.gz: d3ebff0924fd3a10ae2ca5c9a8f62a32d72fbf56b199c7ddb23360ef3eb7277dd80e7693f619c3917dd99fdeca4b1939ab157afc9d57a94afb60fbb843f73f7e
7
+ data.tar.gz: 0a345f267373ee35ccdcca216bc95f6f6170a25589ecd2f7e5bcc209af41a8855da5c85fbe580a217b13e54b4eac4b783f6d2989b42fd9f2d752d41b08436984
@@ -27,6 +27,7 @@ module Hardcode
27
27
 
28
28
  class_option :amqp_url,
29
29
  desc: "AMQP URL",
30
+ aliases: '-u',
30
31
  default: ENV['AMQP_URL'] ||'amqp://guest:guest@localhost:5672'
31
32
 
32
33
  desc "version", "Outputs the version number"
@@ -105,6 +106,9 @@ module Hardcode
105
106
  desc: "temporary directory",
106
107
  aliases: '-t',
107
108
  default: '/tmp'
109
+ method_option :ffmpeg_options,
110
+ desc: "custom ffmpeg options",
111
+ aliases: '-o'
108
112
  def watch(source_dir)
109
113
  FileUtils.touch LOCK_FILE
110
114
  conn = Bunny.new(options[:amqp_url])
@@ -117,12 +121,14 @@ module Hardcode
117
121
  while system %Q[lsof '#{source_file}']
118
122
  sleep 1
119
123
  end
124
+ worker_options = {
125
+ source: File.join(options[:tmp_dir], File.basename(source_file)),
126
+ dest_dir: options[:destination]
127
+ }
128
+ worker_options[:ffmpeg_options] = options[:ffmpeg_options] if options[:ffmpeg_options]
120
129
  FileUtils.mv(source_file, options[:tmp_dir], verbose: true)
121
130
  ch.default_exchange.publish(
122
- {
123
- source: File.join(options[:tmp_dir], File.basename(source_file)),
124
- dest_dir: options[:destination]
125
- }.to_json,
131
+ worker_options.to_json,
126
132
  routing_key: q.name,
127
133
  persistent: true
128
134
  )
@@ -1,3 +1,3 @@
1
1
  module Hardcode
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -15,10 +15,11 @@ module Hardcode
15
15
  begin
16
16
  job = JSON.parse(msg)
17
17
  source_file = job['source']
18
+ ffmpeg_options = "--ffmpeg-options \"#{job['ffmpeg_options']}\"" if job['ffmpeg_options']
18
19
  if File.extname(source_file).match("^\.(mp4|mp3)$") != nil
19
20
  FileUtils.mv(source_file, job['dest_dir'], verbose: true)
20
21
  else
21
- puts output = %x[stack-encode encode --no-progress -l #{STACK_ENCODE_LOG} '#{source_file}']
22
+ puts output = %x[stack-encode encode --no-progress -l #{STACK_ENCODE_LOG} #{ffmpeg_options} '#{source_file}']
22
23
  if $?.success?
23
24
  puts filename = output[/.*>\s(.*)$/, 1]
24
25
  puts "Transcoding successful, deleting source file."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hardcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - niwo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-23 00:00:00.000000000 Z
11
+ date: 2015-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor