multistockphoto 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'rubygems'
2
3
  require 'mechanize'
3
4
 
@@ -59,12 +60,20 @@ class Zoonar < GenericSite
59
60
  begin
60
61
  page = agent.get 'http://www.zoonar.de'
61
62
  rescue WWW::Mechanize::ResponseCodeError
63
+ raise UploadException
64
+ rescue Iconv::InvalidEncoding
65
+ warn "Iconv::InvalidEncoding error in mechanize-gem"
66
+ warn "TODO: mechanize should fix this problem"
67
+ warn "skipping file"
62
68
  raise UploadException
63
69
  end
64
70
  form = page.forms[1] #TODO: besser nach Name
65
- form['loginForm[Username]'] = @config[:zoonar][:user]
66
- form['loginForm[Password]'] = @config[:zoonar][:password]
67
-
71
+ begin
72
+ form['loginForm[Username]'] = @config[:zoonar][:user]
73
+ form['loginForm[Password]'] = @config[:zoonar][:password]
74
+ rescue NoMethodError
75
+ raise "Loginformular zum Ausfuellen nicht gefunden"
76
+ end
68
77
  page = agent.submit form
69
78
  raise "login error" if ! page.body.include?("Hallo, #{@config[:zoonar][:user]}!")
70
79
  # old syntax of mechanize: page = agent.click page.links.text('Bilder hochladen')
@@ -161,4 +170,4 @@ Falls wir das Bild ablehnen sollten, werden Sie eine Benachrichtigung per E-Mail
161
170
  def site_can_handle_keywords?
162
171
  true
163
172
  end
164
- end
173
+ end
@@ -1,8 +1,8 @@
1
1
  module Multistockphoto #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 8
5
- TINY = 1
4
+ MINOR = 9
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multistockphoto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Preymesser
@@ -9,93 +9,113 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-30 00:00:00 +01:00
12
+ date: 2009-07-08 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: hoe
17
- type: :development
16
+ name: choice
17
+ type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.8.0
23
+ version: 0.1.2
24
24
  version:
25
- description: Upload your photos to multiple stock phote sites
26
- email:
27
- - thopre@gmail.com
25
+ - !ruby/object:Gem::Dependency
26
+ name: grep
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.1
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: exifr
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.10.6
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: rmagick
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.0.1
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: mini_exiftool
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 1.0.1
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: exifr
67
+ type: :runtime
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 0.10.8
74
+ version:
75
+ - !ruby/object:Gem::Dependency
76
+ name: mechanize
77
+ type: :runtime
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 0.7.5
84
+ version:
85
+ description: Upload your photos to multiple stock photo sites
86
+ email: thopre@gmail.com
28
87
  executables:
29
88
  - multistockphoto
30
- - multistockphoto-gui
31
- - mondrian.png
32
- - mondrian.ico
33
89
  extensions: []
34
90
 
35
- extra_rdoc_files:
36
- - History.txt
37
- - License.txt
38
- - Manifest.txt
39
- - PostInstall.txt
40
- - README.txt
41
- - website/index.txt
91
+ extra_rdoc_files: []
92
+
42
93
  files:
43
- - History.txt
44
- - License.txt
45
- - Manifest.txt
46
- - PostInstall.txt
47
94
  - README.txt
48
- - Rakefile
49
- - config.yaml
50
- - bin/multistockphoto
51
- - bin/multistockphoto-gui
52
- - bin/mondrian.png
53
- - bin/mondrian.ico
54
- - config/hoe.rb
55
- - config/requirements.rb
56
- - lib/multistockphoto.rb
57
- - lib/multistockphoto/multistockphoto.rb
58
- - lib/multistockphoto/version.rb
59
- - lib/multistockphoto/sender.rb
95
+ - History.txt
60
96
  - lib/multistockphoto/generic_site.rb
61
- - lib/multistockphoto/site_fotolia.rb
62
- - lib/multistockphoto/site_zoonar.rb
97
+ - lib/multistockphoto/sender.rb
63
98
  - lib/multistockphoto/mock_zoonar.rb
99
+ - lib/multistockphoto/version.rb
100
+ - lib/multistockphoto/site_panthermedia.rb
64
101
  - lib/multistockphoto/site_photocase.rb
102
+ - lib/multistockphoto/site_istockphoto.rb
65
103
  - lib/multistockphoto/site_dreamstime.rb
66
- - lib/multistockphoto/site_bigstockphoto.rb
67
- - lib/multistockphoto/site_panthermedia.rb
68
104
  - lib/multistockphoto/photo.rb
105
+ - lib/multistockphoto/site_bigstockphoto.rb
69
106
  - lib/multistockphoto/upload_exception.rb
70
- - script/console
71
- - script/destroy
72
- - script/generate
73
- - script/txt2html
74
- - setup.rb
75
- - tasks/deployment.rake
76
- - tasks/environment.rake
77
- - tasks/website.rake
78
- - test/test_helper.rb
79
- - test/test_multistockphoto.rb
80
- - website/index.html
81
- - website/index.txt
82
- - website/face_boy.gif
83
- - website/javascripts/rounded_corners_lite.inc.js
84
- - website/stylesheets/screen.css
85
- - website/template.html.erb
107
+ - lib/multistockphoto/multistockphoto.rb
108
+ - lib/multistockphoto/site_aldi.rb
109
+ - lib/multistockphoto/site_zoonar.rb
110
+ - lib/multistockphoto/site_fotolia.rb
111
+ - lib/multistockphoto.rb
86
112
  has_rdoc: true
87
113
  homepage: http://multistockphoto.rubyforge.org
88
- post_install_message: |+
89
-
90
- For more information on multistockphoto, see http://multistockphoto.rubyforge.org
91
-
92
- NOTE: Change this information in PostInstall.txt
93
- You can also delete it if you don't want it.
94
-
95
-
96
- rdoc_options:
97
- - --main
98
- - README.txt
114
+ licenses: []
115
+
116
+ post_install_message:
117
+ rdoc_options: []
118
+
99
119
  require_paths:
100
120
  - lib
101
121
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -113,10 +133,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
133
  requirements: []
114
134
 
115
135
  rubyforge_project: multistockphoto
116
- rubygems_version: 1.3.1
136
+ rubygems_version: 1.3.4
117
137
  signing_key:
118
- specification_version: 2
119
- summary: Upload your photos to multiple stock phote sites
120
- test_files:
121
- - test/test_helper.rb
122
- - test/test_multistockphoto.rb
138
+ specification_version: 3
139
+ summary: Upload your photos to multiple stock photo sites
140
+ test_files: []
141
+
data/License.txt DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2008 FIXME full name
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt DELETED
@@ -1,43 +0,0 @@
1
- History.txt
2
- License.txt
3
- Manifest.txt
4
- PostInstall.txt
5
- README.txt
6
- Rakefile
7
- config.yaml
8
- bin/multistockphoto
9
- bin/multistockphoto-gui
10
- bin/mondrian.png
11
- bin/mondrian.ico
12
- config/hoe.rb
13
- config/requirements.rb
14
- lib/multistockphoto.rb
15
- lib/multistockphoto/multistockphoto.rb
16
- lib/multistockphoto/version.rb
17
- lib/multistockphoto/sender.rb
18
- lib/multistockphoto/generic_site.rb
19
- lib/multistockphoto/site_fotolia.rb
20
- lib/multistockphoto/site_zoonar.rb
21
- lib/multistockphoto/mock_zoonar.rb
22
- lib/multistockphoto/site_photocase.rb
23
- lib/multistockphoto/site_dreamstime.rb
24
- lib/multistockphoto/site_bigstockphoto.rb
25
- lib/multistockphoto/site_panthermedia.rb
26
- lib/multistockphoto/photo.rb
27
- lib/multistockphoto/upload_exception.rb
28
- script/console
29
- script/destroy
30
- script/generate
31
- script/txt2html
32
- setup.rb
33
- tasks/deployment.rake
34
- tasks/environment.rake
35
- tasks/website.rake
36
- test/test_helper.rb
37
- test/test_multistockphoto.rb
38
- website/index.html
39
- website/index.txt
40
- website/face_boy.gif
41
- website/javascripts/rounded_corners_lite.inc.js
42
- website/stylesheets/screen.css
43
- website/template.html.erb
data/PostInstall.txt DELETED
@@ -1,7 +0,0 @@
1
-
2
- For more information on multistockphoto, see http://multistockphoto.rubyforge.org
3
-
4
- NOTE: Change this information in PostInstall.txt
5
- You can also delete it if you don't want it.
6
-
7
-
data/Rakefile DELETED
@@ -1,4 +0,0 @@
1
- require 'config/requirements'
2
- require 'config/hoe' # setup Hoe + all gem configuration
3
-
4
- Dir['tasks/**/*.rake'].each { |rake| load rake }
data/bin/mondrian.ico DELETED
Binary file
data/bin/mondrian.png DELETED
Binary file
@@ -1,187 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
3
- # Freely reusable code: see SAMPLES-LICENSE.TXT for details
4
- begin
5
- require 'rubygems'
6
- rescue LoadError
7
- end
8
- #gem 'wxruby', "1.9.7"
9
- #require 'wx'
10
- gem 'wxruby', "!=1.9.8"
11
- require 'wx'
12
-
13
- # This sample shows a fairly minimal Wx::App using a Frame, with a
14
- # MenuBar and StatusBar but no controls. For the absolute minimum app,
15
- # see nothing.rb
16
-
17
- # A Wx::Frame is a self-contained, top-level Window that can contain
18
- # controls, menubars, and statusbars
19
- class MinimalFrame < Wx::Frame
20
- Id_send_all = 2001
21
- Id_list_done = 2002
22
- Id_purge_done = 2003
23
- Id_no_tags = 2004
24
- Id_not_sent = 2005
25
- Id_random = 2006
26
-
27
- def initialize(title)
28
- # The main application frame has no parent (nil)
29
- super(nil, :title => title, :size => [ 400, 300 ])
30
-
31
- # PNG can be used on all platforms, but icon type must be specified
32
- # to work on Windows. Note that OS X doesn't have "Frame" icons.
33
- icon_file = File.join( File.dirname(__FILE__), "mondrian.png")
34
- self.icon = Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_PNG)
35
-
36
- menu_bar = Wx::MenuBar.new
37
- # The "file" menu
38
- menu_file = Wx::Menu.new
39
- # Using Wx::ID_EXIT standard id means the menu item will be given
40
- # the right label for the platform and language, and placed in the
41
- # correct platform-specific menu - eg on OS X, in the Application's menu
42
- menu_file.append(Wx::ID_EXIT, "E&xit\tAlt-X", "Quit this program")
43
- menu_bar.append(menu_file, "&File")
44
-
45
- #multistockphoto - actions
46
- menu_actions = Wx::Menu.new
47
- menu_actions.append(Id_send_all,"Send all photos")
48
- menu_actions.append(Id_list_done,"List all done photos")
49
- menu_actions.append(Id_purge_done,"Purge all done photos")
50
- menu_actions.append(Id_random,"Random")
51
- menu_bar.append(menu_actions, "Actions")
52
-
53
- #multistockphoto - admin
54
- menu_admin = Wx::Menu.new
55
- menu_admin.append(Id_no_tags,"Photos without tags")
56
- menu_admin.append(Id_not_sent,"Photos not sent")
57
- menu_bar.append(menu_admin, "Administration")
58
-
59
- # The "help" menu
60
- menu_help = Wx::Menu.new
61
- menu_help.append(Wx::ID_ABOUT, "&About...\tF1", "Show about dialog")
62
- menu_bar.append(menu_help, "&Help")
63
-
64
- # Assign the menubar to this frame
65
- self.menu_bar = menu_bar
66
-
67
- # Create a status bar at the bottom of the frame
68
- create_status_bar(2)
69
- self.status_text = "Welcome to multistockphoto!"
70
-
71
- # Set it up to handle menu events using the relevant methods.
72
- evt_menu Wx::ID_EXIT, :on_quit
73
- evt_menu Wx::ID_ABOUT, :on_about
74
- evt_menu Id_send_all, :on_send_all
75
- evt_menu Id_list_done, :on_list_done
76
- evt_menu Id_no_tags, :on_no_tags
77
- evt_menu Id_not_sent, :on_not_sent
78
- evt_menu Id_random, :on_random
79
- end
80
-
81
- # End the application; it should finish automatically when the last
82
- # window is closed.
83
- def on_quit
84
- close()
85
- end
86
-
87
- # show an 'About' dialog - WxRuby's about_box function will show a
88
- # platform-native 'About' dialog, but you could also use an ordinary
89
- # Wx::MessageDialog here.
90
- def on_about
91
- Wx::about_box(:name => self.title,
92
- :version => `multistockphoto --version`, # Wx::WXRUBY_VERSION,
93
- :description => "multistockphoto-gui application",
94
- :developers => ['Thomas Preymesser (thopre@gmail.com)'] )
95
- end
96
-
97
- def on_send_all
98
- puts 'send-all'
99
- self.status_text = "uploading all photos"
100
-
101
- # puts `multistockphoto --send-all --verbose`
102
- self.status_text = "done uploading all photos"
103
- end
104
-
105
- def on_random
106
- puts 'random'
107
- self.status_text = "select a random picture"
108
- all = Dir.glob("upload/*.JPG")
109
- while true
110
- r = all[rand(all.size)]
111
- b = File.basename(r,".JPG")
112
- p b
113
- t = File.join("upload", b)+".tags"
114
- p t
115
- if b[0...4] == 'rot_'
116
- puts "nur rotierte Datei"
117
- elsif File.exist? t
118
- puts "tags-File existiert schon"
119
- else
120
- Thread.start do
121
- `eog #{r}`
122
- end
123
- Thread.start do
124
- `gedit #{t}`
125
- end
126
- break # wir haben eine gefunden
127
- end
128
- end
129
-
130
- # puts `ruby random.rb`
131
- self.status_text = "done random"
132
- end
133
-
134
- def on_list_done
135
- self.status_text = "list-done"
136
- result = `multistockphoto --list-done`
137
- puts result
138
- self.status_text = "done list-done"
139
- end
140
-
141
- def on_no_tags
142
- self.status_text = "no-tags"
143
- result = `multistockphoto --no-tags`
144
- puts result
145
- self.status_text = "done no-tags"
146
- end
147
-
148
-
149
- def on_not_sent
150
-
151
- self.status_text = "not-sent"
152
- #--
153
- not_sent = {}
154
- SITES.each {|site|
155
- not_sent[site] = 0
156
- }
157
- Dir.glob(UPLOAD_DIR+'/*').each {|filename|
158
- next if File.basename(filename)[0,4] == 'rot_'
159
- #puts "rot_ uebersprungen"
160
- if filename.upcase =~ PICTURE_FILES
161
- SITES.each {|site|
162
- print filename+"\t"+site+"\t" if $verbose
163
- g = grep(SENDELISTE, /#{site}\t#{filename}/)
164
- if g.size == 0
165
- puts "not sent" if $verbose
166
- not_sent[site] += 1
167
- else
168
- puts 'already sent' if $verbose
169
- end
170
- }
171
- end
172
- }
173
- p not_sent
174
- #--
175
- self.status_text = "done not-sent"
176
- end
177
- end
178
-
179
- # Wx::App is the container class for any wxruby app. To start an
180
- # application, either define a subclass of Wx::App, create an instance,
181
- # and call its main_loop method, OR, simply call the Wx::App.run class
182
- # method, as shown here.
183
- Wx::App.run do
184
- self.app_name = 'Minimal'
185
- frame = MinimalFrame.new("multistockphoto")
186
- frame.show
187
- end