mireru 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de717adbc118c32f4864dec868df30fcf776f14f
4
- data.tar.gz: a23cab13d3c32ffc8ad88483970228cdf718719e
3
+ metadata.gz: dfe9e101ef8c66b8d9a69ef0c629a6d2b77706ef
4
+ data.tar.gz: a4725b2c6cecd0989c01d8ed180e81be07832deb
5
5
  SHA512:
6
- metadata.gz: 7bbbfdd3d3126049269bf5db794641594f795a3144283f2a80357dabcac655c6a5718a4787dbf05f50a3e663123e7b4e33d7fa832dab3a59e70a562772b2034a
7
- data.tar.gz: 8742ac1289baf9921e5c322a4e5ea849def9f1d1f745158059edc64cf85567465817744a65774e8fbca4de495ef7ec5759fbcf9c3d04eadb8aa9472b656d9368
6
+ metadata.gz: abf1106c655c22887bedc93c1a03f91cd3e0d8fe4062e782040378c99e89bc37eee1baea9082575b2bf17a68d1fba4d0ba880c26940f6303362307d4a2d78b69
7
+ data.tar.gz: 559d84ab5ebcecef3c7f27022247bbaec3948cb416850d3c2dc184550a97d68cf4165a5e6dbadac0c587734fef3f74daf87242e6af0208c47d2aee00425ef42b
data/NEWS.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # NEWS
2
2
 
3
+ ## 0.1.6: 2013-09-29
4
+
5
+ Video support release!
6
+
7
+ ### Changes
8
+
9
+ * Improvements
10
+ * Supported video file.
11
+
3
12
  ## 0.1.5: 2013-08-29
4
13
 
5
14
  ### Changes
data/README.md CHANGED
@@ -4,6 +4,11 @@ A file viewer with a focus on flexibility by Ruby/GTK3.
4
4
 
5
5
  A friend of a keyboard.
6
6
 
7
+ ## Requirements
8
+
9
+ * Ruby/GTK3, Ruby/GtkSourceView3, Ruby/ClutterGTK, Ruby/ClutterGStreamer in
10
+ [Ruby-GNOME2](http://ruby-gnome2.sourceforge.jp/)
11
+
7
12
  ## Installation
8
13
 
9
14
  $ gem install mireru
@@ -59,6 +64,10 @@ o: original size<br />
59
64
 
60
65
  f: change font (at random)<br />
61
66
 
67
+ #### Video
68
+
69
+ space: play/pause<br />
70
+
62
71
  ## Contributing
63
72
 
64
73
  1. Fork it
@@ -118,6 +118,9 @@ Keybind:
118
118
 
119
119
  text:
120
120
  f: change font (at random)
121
+
122
+ video:
123
+ space: play/pause
121
124
  EOM
122
125
  @logger.info(message)
123
126
  end
@@ -1,3 +1,3 @@
1
1
  module Mireru
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -0,0 +1,47 @@
1
+ require "clutter-gtk"
2
+ require "clutter-gst"
3
+ require "mireru/widget"
4
+
5
+ module Mireru
6
+ class Video
7
+ class << self
8
+ def create(file)
9
+ clutter = ClutterGtk::Embed.new
10
+ stage = clutter.stage
11
+ stage.background_color = Clutter::Color.new(:black)
12
+ video_texture = ClutterGst::VideoTexture.new
13
+ stage.add_child(video_texture)
14
+ video_texture.signal_connect("eos") do |_video_texture|
15
+ _video_texture.progress = 0.0
16
+ _video_texture.playing = true
17
+ end
18
+ video_texture.filename = file
19
+ video_texture.playing = true
20
+ define_events(stage, video_texture)
21
+ clutter.signal_connect("destroy") do
22
+ video_texture.playing = false
23
+ end
24
+ clutter
25
+ end
26
+
27
+ def define_events(stage, video_texture)
28
+ stage.signal_connect("event") do |_stage, event|
29
+ handled = false
30
+
31
+ case event.type
32
+ when Clutter::EventType::KEY_PRESS
33
+ animation = nil
34
+ case event.key_symbol
35
+ when Clutter::Keys::KEY_space
36
+ state = video_texture.playing?
37
+ video_texture.playing = state ? false : true
38
+ end
39
+ handled = true
40
+ end
41
+
42
+ handled
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
data/lib/mireru/widget.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "gtk3"
2
2
  require "gtksourceview3"
3
+ require "mireru/video"
3
4
 
4
5
  module Mireru
5
6
  class Error < StandardError
@@ -12,10 +13,12 @@ module Mireru
12
13
  image = Gtk::Image.new
13
14
  pixbuf = Gdk::Pixbuf.new(file)
14
15
  if pixbuf.width > width || pixbuf.height > height
15
- pixbuf = Gdk::Pixbuf.new(file, width, height)
16
+ pixbuf = Gdk::Pixbuf.new(file, width, height)
16
17
  end
17
18
  image.pixbuf = pixbuf
18
19
  widget = image
20
+ elsif video?(file)
21
+ widget = Mireru::Video.create(file)
19
22
  else
20
23
  begin
21
24
  buffer = buffer_from_file(file)
@@ -39,6 +42,10 @@ module Mireru
39
42
  /\.(png|jpe?g|gif|ico|ani|bmp|pnm|ras|tga|tiff|xbm|xpm)\z/i =~ file
40
43
  end
41
44
 
45
+ def video?(file)
46
+ /\.(ogm|mp4|flv|mpe?g2?|ts|mov|avi|divx|mkv|wmv|asf|wmx)\z/i =~ file
47
+ end
48
+
42
49
  private
43
50
  def buffer_from_file(file)
44
51
  text = File.open(file).read
data/lib/mireru/window.rb CHANGED
@@ -106,7 +106,7 @@ module Mireru
106
106
  def add_from_file(file)
107
107
  @scroll.hadjustment.value = 0
108
108
  @scroll.vadjustment.value = 0
109
- @scroll.each {|child| @scroll.remove(child) }
109
+ @scroll.each {|child| child.destroy }
110
110
  if file.is_a?(Enumerable)
111
111
  @widget = Mireru::Thumbnail.create(file, *self.size)
112
112
  self.title = "Thumbnails: #{file.size} / #{file.size}"
data/mireru.gemspec CHANGED
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_runtime_dependency("gtk3")
22
22
  spec.add_runtime_dependency("gtksourceview3")
23
+ spec.add_runtime_dependency("clutter-gtk")
24
+ spec.add_runtime_dependency("clutter-gstreamer", "= 2.0.2")
23
25
 
24
26
  spec.add_development_dependency("test-unit")
25
27
  spec.add_development_dependency("test-unit-notify")
@@ -0,0 +1,12 @@
1
+ require "mireru/video"
2
+ require "clutter-gtk"
3
+
4
+ class VideoTest < Test::Unit::TestCase
5
+ def test_create
6
+ filename = "XXX.ogm"
7
+ widget = Mireru::Video.create(filename)
8
+ assert_not_nil(widget)
9
+ assert_equal(ClutterGtk::Embed, widget.class)
10
+ widget.destroy
11
+ end
12
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mireru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masafumi Yokoyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-29 00:00:00.000000000 Z
11
+ date: 2013-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gtk3
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: clutter-gtk
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: clutter-gstreamer
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.0.2
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.0.2
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: test-unit
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -132,6 +160,7 @@ files:
132
160
  - lib/mireru/logger.rb
133
161
  - lib/mireru/thumbnail.rb
134
162
  - lib/mireru/version.rb
163
+ - lib/mireru/video.rb
135
164
  - lib/mireru/widget.rb
136
165
  - lib/mireru/window.rb
137
166
  - mireru.gemspec
@@ -144,6 +173,7 @@ files:
144
173
  - test/test-logger.rb
145
174
  - test/test-mireru.rb
146
175
  - test/test-thumbnail.rb
176
+ - test/test-video.rb
147
177
  - test/test-widget.rb
148
178
  - test/test-window.rb
149
179
  homepage: https://github.com/myokoym/mireru
@@ -180,6 +210,7 @@ test_files:
180
210
  - test/test-logger.rb
181
211
  - test/test-mireru.rb
182
212
  - test/test-thumbnail.rb
213
+ - test/test-video.rb
183
214
  - test/test-widget.rb
184
215
  - test/test-window.rb
185
216
  has_rdoc: