synoptic 0.0.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.
- data/.gitignore +4 -0
- data/Gemfile +7 -0
- data/Rakefile +1 -0
- data/bin/synoptik +5 -0
- data/lib/snejinka.png +0 -0
- data/lib/solnyshko.png +0 -0
- data/lib/synoptic/version.rb +3 -0
- data/lib/synoptic.rb +38 -0
- data/synoptic.gemspec +24 -0
- metadata +55 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/synoptik
ADDED
data/lib/snejinka.png
ADDED
Binary file
|
data/lib/solnyshko.png
ADDED
Binary file
|
data/lib/synoptic.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require "synoptic/version"
|
4
|
+
require "net/http"
|
5
|
+
require "nokogiri"
|
6
|
+
require "gtk2"
|
7
|
+
|
8
|
+
module Synoptic
|
9
|
+
public
|
10
|
+
def on_timer
|
11
|
+
$uri = URI.parse("http://www.spr.by/pogoda/kamenets-i-kamenetskiy-rayon/")
|
12
|
+
http = Net::HTTP.new($uri.host)
|
13
|
+
req = Net::HTTP::Get.new($uri.path)
|
14
|
+
res = http.request(req)
|
15
|
+
|
16
|
+
html = Nokogiri.HTML(res.body, nil, 'UTF-8')
|
17
|
+
temp = html.css('span[style="font-size:44px;"]')[0].text
|
18
|
+
$status_icon.tooltip = "Температура в Каменце #{@temp}"
|
19
|
+
|
20
|
+
|
21
|
+
tt = temp.partition(/\d{2}/)[1].to_i
|
22
|
+
if tt > 18
|
23
|
+
$status_icon.pixbuf = $solnyshko
|
24
|
+
else
|
25
|
+
$status_icon.pixbuf = $sneg
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.start
|
30
|
+
$status_icon = Gtk::StatusIcon.new()
|
31
|
+
$solnyshko = Gdk::Pixbuf.new('/home/dzen/solnyshko.png')
|
32
|
+
$sneg = Gdk::Pixbuf.new('/home/dzen/snejinka.png')
|
33
|
+
$status_icon.pixbuf = $solnyshko
|
34
|
+
GLib::Timeout.add(5000) { on_timer }
|
35
|
+
Gtk.main()
|
36
|
+
end
|
37
|
+
# Your code goes here...
|
38
|
+
end
|
data/synoptic.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "synoptic/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "synoptic"
|
7
|
+
s.version = Synoptic::VERSION
|
8
|
+
s.authors = ["chemt79"]
|
9
|
+
s.email = ["chemt79@gmail.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Программа для граббинга температуры}
|
12
|
+
s.description = %q{Погода}
|
13
|
+
|
14
|
+
s.rubyforge_project = "synoptic"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: synoptic
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- chemt79
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-30 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: Погода
|
15
|
+
email:
|
16
|
+
- chemt79@gmail.com
|
17
|
+
executables:
|
18
|
+
- synoptik
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- Rakefile
|
25
|
+
- bin/synoptik
|
26
|
+
- lib/snejinka.png
|
27
|
+
- lib/solnyshko.png
|
28
|
+
- lib/synoptic.rb
|
29
|
+
- lib/synoptic/version.rb
|
30
|
+
- synoptic.gemspec
|
31
|
+
homepage: ''
|
32
|
+
licenses: []
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubyforge_project: synoptic
|
51
|
+
rubygems_version: 1.8.17
|
52
|
+
signing_key:
|
53
|
+
specification_version: 3
|
54
|
+
summary: Программа для граббинга температуры
|
55
|
+
test_files: []
|