omxplayer 0.4.1

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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omxplayer.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Nick Campbell
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.
@@ -0,0 +1,29 @@
1
+ # Omxplayer
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'omxplayer'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install omxplayer
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,51 @@
1
+ require 'singleton'
2
+ require 'omxplayer/keyboard_shortcuts'
3
+
4
+ class Omxplayer
5
+ include Singleton
6
+ include KeyboardShortcuts
7
+
8
+ attr_reader :filename
9
+
10
+ PIPE = '/tmp/omxpipe'
11
+ VERSION = '0.4.1'
12
+
13
+ def initialize
14
+ mkfifo
15
+ end
16
+
17
+ def open(filename)
18
+ @filename = filename
19
+ #`killall omxplayer &`
20
+ system "omxplayer -o hdmi \"#{filename}\" < #{PIPE} &"
21
+ action(:start)
22
+ end
23
+
24
+ def status
25
+ time, file = get_status_from_ps
26
+ "#{time} #{file}"
27
+ end
28
+
29
+ def action(key)
30
+ send_to_pipe KEYS.fetch(key.to_sym)
31
+ end
32
+
33
+ private
34
+
35
+ def mkfifo
36
+ system "mkfifo #{PIPE}" unless File.exists?(PIPE)
37
+ end
38
+
39
+ def send_to_pipe(command)
40
+ system "echo -n #{command} > #{PIPE} &"
41
+ end
42
+
43
+ def get_status_from_ps
44
+ # The [/] excludes self matches http://serverfault.com/q/367921
45
+ status = `ps ax -o etime,args | grep [/]usr/bin/omxplayer.bin`
46
+ # matches time, filename
47
+ match = /([\d:.]+).*hdmi (.*)/.match(status)
48
+ match ? match.captures : [nil, nil]
49
+ end
50
+
51
+ end
@@ -0,0 +1,36 @@
1
+ module KeyboardShortcuts
2
+
3
+ KEYS = {
4
+ :start => '.',
5
+ :play => 'p',
6
+ :pause => 'p',
7
+ :quit => 'q',
8
+ :forward => "$'\x1b\x5b\x43'",
9
+ :backward => "$'\x1b\x5b\x44'",
10
+ :big_forward => "$'\x1b\x5b\x41'",
11
+ :big_backward => "$'\x1b\x5b\x42'",
12
+ :subtitles => 's'
13
+ }
14
+
15
+ end
16
+
17
+ =begin
18
+ z Show Info
19
+ 1 Increase Speed
20
+ 2 Decrease Speed
21
+ j Previous Audio stream
22
+ k Next Audio stream
23
+ i Previous Chapter
24
+ o Next Chapter
25
+ n Previous Subtitle stream
26
+ m Next Subtitle stream
27
+ s Toggle subtitles
28
+ q Exit OMXPlayer
29
+ Space or p Pause/Resume
30
+ - Decrease Volume
31
+ + Increase Volume
32
+ Left Arrow Seek -30
33
+ Right Arrow Seek +30
34
+ Down Arrow Seek -600
35
+ Up Arrow Seek +600
36
+ =end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omxplayer'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "omxplayer"
8
+ gem.version = Omxplayer::VERSION
9
+ gem.authors = ["Nick Campbell"]
10
+ gem.email = ["nickcampbell18@gmail.com"]
11
+ gem.description = %q{Control your Raspberry Pi omxplayer from Ruby using mkfifo}
12
+ gem.summary = %q{Control your Raspberry Pi omxplayer from Ruby using mkfifo pipes}
13
+ gem.homepage = "https://github.com/nickcampbell18/omxplayer"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omxplayer
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 1
9
+ version: 0.4.1
10
+ platform: ruby
11
+ authors:
12
+ - Nick Campbell
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-02-24 00:00:00 +00:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Control your Raspberry Pi omxplayer from Ruby using mkfifo
22
+ email:
23
+ - nickcampbell18@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - LICENSE.txt
34
+ - README.md
35
+ - Rakefile
36
+ - lib/omxplayer.rb
37
+ - lib/omxplayer/keyboard_shortcuts.rb
38
+ - omxplayer.gemspec
39
+ has_rdoc: true
40
+ homepage: https://github.com/nickcampbell18/omxplayer
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options: []
45
+
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ requirements: []
63
+
64
+ rubyforge_project:
65
+ rubygems_version: 1.3.6
66
+ signing_key:
67
+ specification_version: 3
68
+ summary: Control your Raspberry Pi omxplayer from Ruby using mkfifo pipes
69
+ test_files: []
70
+