helpema 0.2.0 → 1.0.0

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: 97aef7e26445e9b17fb514f34fba1d286dd6cda7
4
- data.tar.gz: c8149b74cb8d35ce7e0a42dfc6236c4a210f35a8
3
+ metadata.gz: f825bd3e6b6e1b825a3a998e4571af1f0186a620
4
+ data.tar.gz: fc0978830f198cb1dc2876fc972d0ae7b3d04ba0
5
5
  SHA512:
6
- metadata.gz: 9d37cc78e671535927fdfe18c36374409729a6b8490a85e5b91394f566755dbde70f459db38452bff697e6f36d42dab5f62c008f3dc0ff6e22f42f1d38a8e08e
7
- data.tar.gz: ecbc2b1ff09517c00d7fe9a430345c9c6331b62f8bdfd17259d81e6a3017c7428ff89f8cb9f53c68e918b56c71f6a410fe691d36bd744661bcbce7417aa31387
6
+ metadata.gz: bdd8e438e980c9cb5189eb2490f72eff2033e120c0c653d5002b98afb720ef93b35c0515852b9cdaf0a495d5f0598288a6781ccbbb350bb42d720f58f96c7d39
7
+ data.tar.gz: 2bfd8fae64732d33d251fdb752c67f9d201e09280394c8ac713f3ee470ddef9b95f1ad0731b534f31039fca30f0a0dbd680c93e642f5a39881b7868ec7d9dcc0
data/README.rdoc CHANGED
@@ -14,7 +14,13 @@ More later.
14
14
 
15
15
  === Helpema::SSSS.combine( *shared_secrets )
16
16
 
17
- === Helpema::ZBar.qrcode( timeout=3 )
17
+ === Helpema::ZBar.cam( timeout=3 )
18
+
19
+ Reads qrcodes on camera.
20
+
21
+ === Helpema::ZBar.screen
22
+
23
+ Reads qrcodes on screen.
18
24
 
19
25
  === Helpema::YouTubeDL.json( url ){|obj| ... }
20
26
 
@@ -26,7 +32,7 @@ More later.
26
32
 
27
33
  (The MIT License)
28
34
 
29
- Copyright (c) 2014 carlosjhr64
35
+ Copyright (c) 2017 carlosjhr64
30
36
 
31
37
  Permission is hereby granted, free of charge, to any person obtaining
32
38
  a copy of this software and associated documentation files (the
data/lib/helpema/ssss.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'open3'
2
+
1
3
  module Helpema
2
4
  module SSSS
3
5
 
@@ -1,3 +1,6 @@
1
+ require 'json'
2
+ require 'open3'
3
+
1
4
  module Helpema
2
5
  module YouTubeDL
3
6
 
data/lib/helpema/zbar.rb CHANGED
@@ -1,26 +1,42 @@
1
+ require 'timeout'
2
+ require 'tmpdir'
3
+
1
4
  module Helpema
2
5
  module ZBar
3
6
 
4
- def self.qrcode(timeout=3)
5
- qrcode = ''
7
+ def self.cam(timeout=3)
8
+ raw = ''
6
9
  IO.popen('zbarcam --nodisplay --raw --prescale=800x800', 'r') do |io|
7
10
  begin
8
11
  Timeout.timeout(timeout) do
9
- qrcode << io.gets
12
+ raw << io.gets
10
13
  while q = io.gets
11
14
  break if q=="\n"
12
- qrcode << q
15
+ raw << q
13
16
  end
14
- qrcode.strip!
17
+ raw.strip!
15
18
  end
16
19
  rescue Timeout::Error
17
- qrcode = nil
20
+ raw = nil
18
21
  $stderr.puts $!
19
22
  ensure
20
23
  Process.kill('INT', io.pid)
21
24
  end
22
25
  end
23
- qrcode
26
+ raw
27
+ end
28
+
29
+ def self.screen
30
+ tmpdir = Dir.tmpdir()
31
+ screenshot = File.join(tmpdir, "#{$$}.#{Time.now.to_f}.png")
32
+ raw = nil
33
+ begin
34
+ system "gnome-screenshot -f #{screenshot}"
35
+ raw = `zbarimg -q --raw #{screenshot}`.strip
36
+ ensure
37
+ File.unlink screenshot if File.exist? screenshot
38
+ end
39
+ raw
24
40
  end
25
41
 
26
42
  end
data/lib/helpema.rb CHANGED
@@ -1,10 +1,8 @@
1
- # Standard Libraries
2
- require 'open3'
3
- require 'timeout'
4
- require 'json'
1
+ module Helpema
2
+ VERSION = '1.0.0'
3
+ end
5
4
 
6
5
  # This Gem
7
- require 'helpema/version.rb'
8
6
  require 'helpema/ssss.rb'
9
7
  require 'helpema/zbar.rb'
10
8
  require 'helpema/youtubedl.rb'
@@ -14,3 +12,4 @@ require 'helpema/youtubedl.rb'
14
12
  #`ssss-split`
15
13
  #`ssss-combine`
16
14
  #`zbarcam`
15
+ #`gnome-screenshot`
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helpema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - carlosjhr64
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-14 00:00:00.000000000 Z
11
+ date: 2017-11-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Some wrappers on the following linux commands: ssss-split, ssss-combine, zbarcam, youtube-dl -j.
@@ -23,7 +23,6 @@ files:
23
23
  - README.rdoc
24
24
  - lib/helpema.rb
25
25
  - lib/helpema/ssss.rb
26
- - lib/helpema/version.rb
27
26
  - lib/helpema/youtubedl.rb
28
27
  - lib/helpema/zbar.rb
29
28
  homepage: https://github.com/carlosjhr64/helpema
@@ -47,12 +46,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
46
  - !ruby/object:Gem::Version
48
47
  version: '0'
49
48
  requirements:
50
- - 'ruby: ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]'
49
+ - 'ruby: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]'
51
50
  - 'ssss-split: 0.5'
52
51
  - 'ssss-combine: 0.5'
53
- - 'zbarcam: 0.10'
52
+ - 'zbarcam: 0.20'
53
+ - 'gnome-screenshot: gnome-screenshot 3.22.0'
54
54
  rubyforge_project:
55
- rubygems_version: 2.5.2
55
+ rubygems_version: 2.6.13
56
56
  signing_key:
57
57
  specification_version: 4
58
58
  summary: 'Some wrappers on the following linux commands: ssss-split, ssss-combine,
@@ -1,3 +0,0 @@
1
- module Helpema
2
- VERSION = '0.2.0'
3
- end