mediafile 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mediafile/mediafile.rb +15 -15
- data/lib/mediafile/version.rb +1 -1
- data/lib/mediafile.rb +10 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cf95d2ef90842833ff1684e63e819eb786eb3b6
|
4
|
+
data.tar.gz: bf5437da339bcd635853b6cb2535b25914d14691
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9d7f53933c2b36e4788153a90109adfff0732d752ae6b55f39e69dace58a6b927904ae495792a5c8322e1e4e1f33aa7bbfc026b2ba2b2a4aa14fb5ead42c360
|
7
|
+
data.tar.gz: c14b16bf4336633b6322c9b8b9dca487e30b1d134d1cff43904d4e54f285e7d2c4d710523e3072b6177b168dc4089507fb71413a2e9fce06c37b989c5166cfca
|
data/lib/mediafile/mediafile.rb
CHANGED
@@ -43,21 +43,21 @@ class MediaFile
|
|
43
43
|
destination = out_path base_dir: dest, transcode_table: transcode_table
|
44
44
|
temp_dest = tmp_path base_dir: dest, typ: transcode_table[@type]
|
45
45
|
debug "temp dest is '#{temp_dest}'"
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
46
|
+
|
47
|
+
if File.exist?(destination)
|
48
|
+
info("File already exists at destination: #{@source} => #{destination}")
|
49
|
+
return
|
50
|
+
end
|
51
|
+
|
52
|
+
unless record_transfer(temp_dest)
|
53
|
+
error "Two source files mapped to the same destination file!"
|
54
|
+
error "This file: #{@source} => #{temp_dest}"
|
55
|
+
return
|
56
|
+
end
|
57
|
+
|
58
|
+
debug("Create parent directories at '#{File.dirname destination}'.")
|
59
|
+
FileUtils.mkdir_p File.dirname destination
|
60
|
+
FileUtils.touch temp_dest
|
61
61
|
begin
|
62
62
|
transcode_table.has_key?(@type) ?
|
63
63
|
transcode(transcode_table, temp_dest) :
|
data/lib/mediafile/version.rb
CHANGED
data/lib/mediafile.rb
CHANGED
@@ -5,7 +5,8 @@ require 'fileutils'
|
|
5
5
|
require 'mkmf'
|
6
6
|
require 'digest/md5'
|
7
7
|
require 'timeout'
|
8
|
-
require 'taglib'
|
8
|
+
require 'taglib'
|
9
|
+
require 'set'
|
9
10
|
require 'mediafile/version'
|
10
11
|
|
11
12
|
module MakeMakefile::Logging
|
@@ -38,15 +39,22 @@ module MediaFile
|
|
38
39
|
@@thread_count = nil
|
39
40
|
@@mutex = nil
|
40
41
|
@@initialized = false
|
42
|
+
@@transfers = Set.new
|
43
|
+
|
44
|
+
def check_transfer(path)
|
45
|
+
lock {
|
46
|
+
@@transfers.add? path
|
47
|
+
}
|
48
|
+
end
|
41
49
|
|
42
50
|
def initialize_threads(count = 1)
|
43
51
|
return if @@initialized
|
44
|
-
@@initialized = 1
|
45
52
|
@@thread_count = count
|
46
53
|
if @@thread_count > 1
|
47
54
|
require 'thread'
|
48
55
|
@@mutex = Mutex.new
|
49
56
|
end
|
57
|
+
@@initialized = true
|
50
58
|
end
|
51
59
|
|
52
60
|
def safe_print(message = '')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mediafile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Harvey-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: taglib-ruby
|