skype-call-detect 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +20 -0
- data/LICENSE.txt +21 -0
- data/README.md +42 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/skype/call/detect.rb +53 -0
- data/lib/skype/call/detect/version.rb +7 -0
- data/skype-call-detect.gemspec +40 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f4069094f0d8d58c7ae6870d753f4523f418fda4c89e2cec77084dbfdca31475
|
4
|
+
data.tar.gz: 9fd2eb50a64245f8761b2c3967345bcdc343d0fcaa51c9a79c480cd6bf438f50
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ecfe0af0df9d94e5218c98386c0f0467afbacd7f5459cbef54f681a37afa2953583a163bb145ea703e78de0589b10730544499e6b72928894231663aec6896cc
|
7
|
+
data.tar.gz: 33f510f6e9853cf01c08c5b95be4d9bfb376c03bd8ea5ff0ecb05cf626422fe2a449ac1fe792120949d3b025227f7f046591188a84f3b15cffbd9f1c21d6d340
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
skype-call-detect (0.1.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
rake (10.5.0)
|
10
|
+
|
11
|
+
PLATFORMS
|
12
|
+
ruby
|
13
|
+
|
14
|
+
DEPENDENCIES
|
15
|
+
bundler (~> 1.17)
|
16
|
+
rake (~> 10.0)
|
17
|
+
skype-call-detect!
|
18
|
+
|
19
|
+
BUNDLED WITH
|
20
|
+
1.17.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Nikola Krzalic
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Skype::Call::Detect
|
2
|
+
|
3
|
+
Attempts to detect an ongoing Skype call using `pactl`. Will only ever work on systems with PulseAudio (aka Linux/UNIX-based systems).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'skype-call-detect'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install skype-call-detect
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
`Skype::Call::Detect.running?` will return `true` if there is an ongoing skype call.
|
24
|
+
```
|
25
|
+
2.6.3 :001 > require 'skype/call/detect'
|
26
|
+
=> true
|
27
|
+
2.6.3 :002 > Skype::Call::Detect.running?
|
28
|
+
=> false
|
29
|
+
2.6.3 :003 >
|
30
|
+
```
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
Bug reports and pull requests are welcome.
|
35
|
+
|
36
|
+
## Inspired by
|
37
|
+
- https://askubuntu.com/questions/906160/is-there-a-way-to-detect-whether-a-skype-call-is-in-progress-dbus-pulseaudio
|
38
|
+
- https://github.com/kaspernj/pulseaudio
|
39
|
+
|
40
|
+
## License
|
41
|
+
|
42
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "skype/call/detect"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require "skype/call/detect/version"
|
2
|
+
|
3
|
+
module Skype
|
4
|
+
module Call
|
5
|
+
module Detect
|
6
|
+
class PACTLError < StandardError; end
|
7
|
+
|
8
|
+
def self.running?
|
9
|
+
raise PACTLError, "pactl not found on this system" unless pactlExists?
|
10
|
+
|
11
|
+
outputs = sourceOutputs
|
12
|
+
result = false
|
13
|
+
|
14
|
+
unless outputs.empty?
|
15
|
+
outputs.each do |output|
|
16
|
+
result = true if output[:application_name] == 'Skype' and output[:corked] == 'no'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
result
|
21
|
+
end
|
22
|
+
|
23
|
+
#Borrowed with some modifications from https://github.com/kaspernj/pulseaudio
|
24
|
+
def self.sourceOutputs
|
25
|
+
list = %x[pactl list source-outputs]
|
26
|
+
outputs = []
|
27
|
+
|
28
|
+
list.scan(/(\n|^)Source Output #(\d+)\s+([\s\S]+?)(\n\n|\Z)/) do |match|
|
29
|
+
props = {}
|
30
|
+
match[2].scan(/(\s+|^)([A-z]+?): (.+?)\n/) do |match_prop|
|
31
|
+
props[match_prop[1].downcase.to_sym] = match_prop[2]
|
32
|
+
end
|
33
|
+
|
34
|
+
match[2].scan(/(\t\t|^)([A-z\.]+?) = (.+?)\n/) do |match_prop|
|
35
|
+
props[match_prop[1].downcase.gsub(/\./, "_").to_sym] = match_prop[2].gsub(/\"/, "")
|
36
|
+
end
|
37
|
+
|
38
|
+
output_id = match[1].to_i
|
39
|
+
props[:output_id] = output_id
|
40
|
+
|
41
|
+
outputs << props
|
42
|
+
end
|
43
|
+
|
44
|
+
outputs
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.pactlExists?
|
48
|
+
system( "which pactl 1>/dev/null 2>&1" )
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "skype/call/detect/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "skype-call-detect"
|
8
|
+
spec.version = Skype::Call::Detect::VERSION
|
9
|
+
spec.authors = ["Nikola Krzalic"]
|
10
|
+
spec.email = ["nikola@krzalic.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Attempts to detect if a skype call is running using pactl}
|
13
|
+
spec.homepage = "https://github.com/crypt1d/skype-call-detect"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
#spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
22
|
+
spec.metadata["source_code_uri"] = "https://github.com/crypt1d/skype-call-detect"
|
23
|
+
#spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
24
|
+
else
|
25
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
26
|
+
"public gem pushes."
|
27
|
+
end
|
28
|
+
|
29
|
+
# Specify which files should be added to the gem when it is released.
|
30
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
31
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
32
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
33
|
+
end
|
34
|
+
spec.bindir = "exe"
|
35
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
|
+
spec.require_paths = ["lib"]
|
37
|
+
|
38
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
39
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: skype-call-detect
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nikola Krzalic
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-05-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- nikola@krzalic.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/console
|
55
|
+
- bin/setup
|
56
|
+
- lib/skype/call/detect.rb
|
57
|
+
- lib/skype/call/detect/version.rb
|
58
|
+
- skype-call-detect.gemspec
|
59
|
+
homepage: https://github.com/crypt1d/skype-call-detect
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata:
|
63
|
+
homepage_uri: https://github.com/crypt1d/skype-call-detect
|
64
|
+
source_code_uri: https://github.com/crypt1d/skype-call-detect
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubygems_version: 3.0.3
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: Attempts to detect if a skype call is running using pactl
|
84
|
+
test_files: []
|