findLoops 0.0.2

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjhiNjhkYTgxOWZhZWFjZjZmY2EwYWU5ZDBmZDdkMjU5NWEwYzQ2YQ==
5
+ data.tar.gz: !binary |-
6
+ NThiYWE4OGU0YWY5OTk5MDk3NTAwODRlMWQxYTJjMDUyZDg0NGQzYQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NDYxZWViZTNjN2EwNzQ2MmRhMDQwNDNhZTc1ZTJkOGVhMzg5M2VmMGFmZDg1
10
+ MTE3MTU4ODM4M2JhMDgzZTQyN2Y1MmE5N2E4NGIyNjQ2MTJmN2U1OGI3Y2M3
11
+ NGQ5NDVmZTI0NTI2NzQ1YWZjOGNjMWE3NGNmMzkzZWQ0N2EyMzE=
12
+ data.tar.gz: !binary |-
13
+ NWYyOTkyYWNhYjQ1Y2Y0OWI2YWI0ZTA0NDU5Y2IzMDlkMTEzMDAxODYxMWRh
14
+ OGJiNTA2YjY5Y2NiMWViZWY1MzU5YWEwZjQ0YjQwMTA1NzBhOTBkOWQ4M2Vj
15
+ Njk5MjMyZWYzOTlmNjllOTZkNzI2OWRlOGIxNDBmNTliMjI1MDQ=
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in findLoops.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 cyburgee
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # FindLoops
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'findLoops'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install findLoops
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/findLoops/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/findLoops.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'findLoops/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "findLoops"
8
+ spec.version = FindLoops::VERSION
9
+ spec.authors = ["cyburgee"]
10
+ spec.email = ["collin.e.burger@gmail.com"]
11
+ spec.summary = %q{Wrapper for my loopfindr command line tool.}
12
+ spec.description = %q{Requires imagemagick, gifsicle extractFrames and commandLoop from my github which is currently private. That might change soon.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
data/lib/findLoops.rb ADDED
@@ -0,0 +1,84 @@
1
+ #require "findLoops/version"
2
+ require 'csv'
3
+
4
+ class FindLoops
5
+ attr_accessor :commandPath, :extractPath, :inputFile, :outputFile, :progressFile, :finding, :doneFinding, :gifProgress
6
+
7
+ def initialize(commandLoop,extractFrames, input, output, progress)
8
+ @commandPath = commandLoop
9
+ @extractPath = extractFrames
10
+ @inputFile = input
11
+ @outputFile = output
12
+ @progressFile = progress
13
+ @finding = false
14
+ @doneFinding = false
15
+ end
16
+
17
+ def find
18
+ command = @commandPath << " "
19
+ command << "-i \"" << @inputFile << "\" "
20
+ command << "-o \"" << @outputFile << "\" "
21
+ command << "-p \"" << @progressFile << "\" "
22
+ #command << "&"
23
+ command << "> /dev/null &"
24
+ pid = spawn(command)
25
+ Process.detach(pid)
26
+ @finding = true
27
+ end
28
+
29
+ def getFindProgress
30
+ if @finding
31
+ text = File.open(@progressFile, "r").read
32
+ lines = text.lines.to_a
33
+ if lines.size > 1
34
+ line = lines[-1]
35
+ percIdx = line.index("%")
36
+ if percIdx != nil
37
+ percentDone = line.slice(0,percIdx);
38
+ if percentDone == "100"
39
+ @doneFinding = true
40
+ @finding = false
41
+ end
42
+ return percentDone.to_f
43
+ end
44
+ end
45
+ elsif @doneFinding
46
+ return 100
47
+ elsif !@finding
48
+ return 0
49
+ end
50
+ end
51
+
52
+ def deleteFindProgress
53
+ self.getFindProgress
54
+ if @doneFinding
55
+ #File.close(@progressFile)
56
+ File.delete(@progressFile)
57
+ end
58
+ end
59
+
60
+ def numGifs
61
+ self.getFindProgress
62
+ if @doneFinding
63
+ numGifs = File.open(@outputFile).readlines.size
64
+ #File.close(@outputFile)
65
+ return numGifs
66
+ end
67
+ end
68
+
69
+ def getGifs(imagePrefix, gifPrefix)
70
+ CSV.foreach(@outputFile) do |row|
71
+ imPrefixFinal = String.new(imagePrefix)
72
+ imPrefixFinal << "#{$.}_"
73
+ command1 = String.new
74
+ command1 << "getGifs "
75
+ command1 << "-i \"" << @inputFile << "\" "
76
+ command1 << "-s " << row[0] << " -e " << row[1] << " "
77
+ command1 << "-o \"" << imPrefixFinal << "\" "
78
+ command1 << "-g \"" << gifPrefix << "#{$.}\""
79
+ pid = spawn (command1)
80
+ Process.detach(pid)
81
+ end
82
+ File.delete(@outputFile)
83
+ end
84
+ end
@@ -0,0 +1,3 @@
1
+ module FindLoops
2
+ VERSION = "0.0.2"
3
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: findLoops
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - cyburgee
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ prerelease: false
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '1.7'
21
+ type: :development
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ prerelease: false
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: '10.0'
35
+ type: :development
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Requires imagemagick, gifsicle extractFrames and commandLoop from my
42
+ github which is currently private. That might change soon.
43
+ email:
44
+ - collin.e.burger@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - .gitignore
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - findLoops.gemspec
55
+ - lib/findLoops.rb
56
+ - lib/findLoops/version.rb
57
+ homepage: ''
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.4.1
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Wrapper for my loopfindr command line tool.
81
+ test_files: []