multistockphoto 0.9.0 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,108 +1,5 @@
1
- == 0.9.0 2009-07-08
1
+ rescue von Net::FTPPermError bei fotolia, damit man andere Sites fortsetzen kann
2
+ == 0.9.2 / 2010-06-21
2
3
 
3
- * 4 bugfixes
4
- * Laeuft jetzt mit Ruby 1.9
5
- * Login-Prozedur bei photocase angepasst
6
- * Abhaengigkeit von gem 'mini_exiftool' hat gefehlt
7
- * Abhaengigkeit von gem 'exifr' hat gefehlt
8
-
9
- == 0.8.2 2008-12-30
10
-
11
- * 1 bugfix
12
- * Abhaengigkeit von gem 'choice' hat gefehlt
13
-
14
- == 0.8.1 2008-12-30
15
-
16
- * 1 enhancement
17
- * doppelte Tags in Datei nicht mehrfach zaehlen
18
- * photocase: bessere Fehleranalyse, falls Upload-Fehler
19
4
  * 1 bugfix
20
- * Anpassung an neue Syntax beim mechanize gem in site_* Dateien
21
-
22
- == 0.8.0 2008-06-28
23
- * 1 major enhancement
24
- * neue Site Bigstockphoto erstellt
25
- * Option --plist in bin/multistockphoto erstellt
26
- * Option --count=N in Verbindung mit --no-tags und --tags_only erstellt
27
- * 1 minor enhancement
28
- * Absicherung/Fehlermeldung wenn Config-Datei nicht richtig gelesen werden kann
29
- * Methode self.accept?/accept? je Site Klasse neu, fuer zulaessige File-Typen
30
- * Optimierungen in bin/multistockphoto
31
- * 1 bug fix
32
- * --stats Fehler bei deaktivierten Sites behoben
33
-
34
- == 0.7.1 2008-06-16
35
- * 1 bug fix
36
- * entfernen von ueberfluessiger aldi-site fuehrte anderweitig zu Fehler
37
-
38
- == 0.7.0 2008-06-16
39
- * 1 major enhancement
40
- * neue Site Dreamstime erstellt
41
- * 3 minor enhancements
42
- * --stats listet zusaetzlich Anzahl Photos mit/ohne tags file auf + Anteil
43
- * neue Methode Sender#sent_to?(fn,site)
44
- * site_* Klassen etwas allgemeiner gehalten, so daß man leichter neue kopieren kann
45
-
46
- == 0.6.2 2008-06-14
47
- * 3 minor enhancements
48
- * new method Sitename.can_handle_orientation?
49
- * --tags-only Schalter sendet nur Photos mit .tags Datei
50
- * Zoonar: besser abgesichert gegen Site-down
51
- * 2 bug fix
52
- * an Fotolia wurden die nicht gedrehten, anstatt die gedrehten Bilder gesendet
53
- * an Zoonar wurden die nicht gedrehten, anstatt die gedrehten Bilder gesendet
54
-
55
- == 0.6.1 2008-06-13
56
- * 1 bug fix
57
- * hm, das Schreiben von Keywords scheint nicht aktiviert gewesen zu sein...
58
-
59
- == 0.6.0 2008-06-10
60
- * 4 enhancements
61
- * Sendedauer fuer jedes Photo beim Senden auflisten
62
- * Option --ordered fuer alphabetisches Senden der Files
63
- * Option --no-tags erstellt (auch in Verbindung mit --ordered)
64
- * neues Sender-Objekt fuer zentrale Upload-Funktionen
65
-
66
- == 0.5.2 2008-05-30
67
- * 1 bug fix
68
- * Ja ja, Thomas. Erst eine dicke Lippe riskieren, von wegen "fehlerfrei" und dann noch nichtmal die Sprachelemente von Ruby beherrschen... skip -> next
69
- * Keine weiteren Sendeversuche, wenn fuer eine Site bereits die maximale Upload-Anzahl / Tag erreicht ist und dieser Schalter in Konfigurationsdatei gesetzt
70
-
71
- == 0.5.1 2008-05-29
72
- * 1 bug fix
73
- * Fehlerbehandlung wenn Site keine Photos mehr annimmt
74
-
75
- == 0.5.0 2008-05-27
76
- * 2 major enhancements:
77
- * Schalter in Konfigurationsdatei :total_per_day (pro Site)
78
-
79
- == 0.4.0 2008-05-19
80
- * 2 major enhancements:
81
- * Schalter --stats fuer Sendestatistik
82
- * Bilder automatisch drehen, wenn in Hochformat aufgenommmen
83
- * Schalter --verbose fuer geschwaetzigen Output
84
-
85
- == 0.3.0 2008-05-19
86
- * 6 major enhancements:
87
- * Site in Lauf deaktivieren, wenn zu viele Fehler
88
- * Schalter '--total-per-site=N'
89
- * Schalter '--total-transfers=N' - Nur N Uploads insgsamte pro Session
90
- * Schalter '--check-orientation'
91
- * Schalter '--rotate'
92
- * Schalter '--not-sent' Listet auf wieviele Photos je Site noch nicht gesendet wurden
93
- * 1 bug fix
94
- * kurze Optionsschalter nur noch 1 Zeichen lang und anders benannt
95
-
96
- == 0.2.0 2008-05-08
97
- * 1 major enhancement:
98
- * new site www.photocase.de
99
-
100
- == 0.1.1 2008-05-07
101
-
102
- * 1 bug fix:
103
- * mehr Plattformunabhaengigkeit (waren noch spezielle Unix Kommandos drin)
104
-
105
- == 0.1.0 2008-05-01
106
-
107
- * 1 major enhancement:
108
- * Initial release
5
+ * photocase changed layout of the site, login form is now the 3rd form on the page
data/README.txt CHANGED
@@ -1,6 +1,5 @@
1
- = multistockphoto
2
-
3
- * http://multistockphoto.rubyforge.org
1
+ by Thomas Preymesser
2
+ http://thopre.wordpress.com
4
3
 
5
4
  == DESCRIPTION:
6
5
 
@@ -11,12 +10,12 @@ anzubieten.
11
10
  == FEATURES/PROBLEMS:
12
11
 
13
12
  * automatisiertes Hochladen an mehrere Sites
14
- * automatisches Drehen von Hochformatphotos, falls die Site dies nicht selbstaendig erkennen kann
13
+ * automatisches Drehen von Hochformatphotos, falls die Site dies nicht selbständig erkennen kann
15
14
  * automatische Verarbeiten von Keywords
16
15
 
17
16
  == SYNOPSIS:
18
17
 
19
- ausfuehrliche Dokumentation zur Benutzung, siehe http://multistockphoto.rubyforge.org
18
+ ausfuehrliche Dokumentation zur Benutzung, siehe http://multistockphoto.rubyforge.org GUIDE.txt
20
19
 
21
20
  == REQUIREMENTS:
22
21
 
@@ -30,7 +29,7 @@ anzubieten.
30
29
 
31
30
  (The MIT License)
32
31
 
33
- Copyright (c) 2008 FIX
32
+ Copyright (c) 2008 FIXME (different license?)
34
33
 
35
34
  Permission is hereby granted, free of charge, to any person obtaining
36
35
  a copy of this software and associated documentation files (the
@@ -49,4 +48,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
49
48
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
50
49
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
51
50
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
52
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,47 @@
1
+ # Look in the tasks/setup.rb file for the various options that can be
2
+ # configured in this Rakefile. The .rake files in the tasks directory
3
+ # are where the options are used.
4
+
5
+ begin
6
+ require 'bones'
7
+ #Bones.setup
8
+ rescue LoadError
9
+ begin
10
+ load 'tasks/setup.rb'
11
+ rescue LoadError
12
+ raise RuntimeError, '### please install the "bones" gem ###'
13
+ end
14
+ end
15
+
16
+ ensure_in_path 'lib'
17
+ require 'multistockphoto'
18
+
19
+ task :default => 'spec:run'
20
+
21
+ Bones {
22
+ name 'multistockphoto'
23
+ authors 'Thomas Preymesser'
24
+ email 'thopre@gmail.com'
25
+ url 'http://multistockphoto.rubyforge.net/'
26
+ version Multistockphoto::VERSION
27
+ dependencies = [
28
+ # ['activesupport', '>= 1.3.1']
29
+ # s.u. ['mechanize', '>= 0.7.5'], # mein aktuelles release
30
+ ['choice', '>= 0.1.2'], # mein aktuelles release
31
+ ['grep', '>= 0.0.1'], # mein aktuelles release
32
+ ['exifr', '>= 0.10.6'], # mein aktuelles release
33
+ ['rmagick', '>= 0.0.1'],
34
+ ['mini_exiftool', '>= 1.0.1'], # mein aktuelles release
35
+ ['exifr', '>= 0.10.8'], # mein aktuelles release
36
+ ['mechanize'],
37
+ #if RUBY_VERSION >= "1.9.0"
38
+ # EXTRA_DEPENDENCIES <<
39
+ # ['mechanize', '>= 0.7.5'] # mein aktuelles release
40
+ #else
41
+ # EXTRA_DEPENDENCIES <<
42
+ # ['mechanize', '>= 0.9.2'] # in Ruby 1.9* dieses wegen iconv-Problem
43
+ #end
44
+ ]
45
+ }
46
+
47
+
data/TODO ADDED
@@ -0,0 +1,2 @@
1
+ * ab 10.06.2010 kann Zoonar auch FTP-Upload, ggf. umstellen
2
+
data/bin/multistockphoto CHANGED
@@ -1,5 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
+
4
+ require File.expand_path(
5
+ File.join(File.dirname(__FILE__), %w[.. lib multistockphoto]))
6
+
7
+ # Put your code here
3
8
  require 'rubygems'
4
9
  require 'choice'
5
10
  require 'multistockphoto'
@@ -7,7 +12,10 @@ require 'RMagick'
7
12
  include Magick
8
13
  require 'exifr'
9
14
  require 'grep'
15
+ require 'multistockphoto/photo'
16
+ require 'multistockphoto/upload_exception'
10
17
  include Grep
18
+ require 'timeout'
11
19
 
12
20
  SENDELISTE = 'sendeliste.dat'
13
21
  ROT_PREFIX = 'rot_'
@@ -99,7 +107,7 @@ def all_sites_done(sites,n)
99
107
  result
100
108
  end
101
109
 
102
- version = Multistockphoto::VERSION::STRING
110
+ version = Multistockphoto::VERSION #::STRING
103
111
 
104
112
  Choice.options do
105
113
  header 'Options:'
@@ -141,7 +149,7 @@ Choice.options do
141
149
  $tags_only = true
142
150
  end
143
151
  end
144
-
152
+
145
153
  option :verbose do
146
154
  short '-y'
147
155
  long '--verbose'
@@ -241,7 +249,7 @@ Choice.options do
241
249
  $silent = true
242
250
  end
243
251
  end
244
-
252
+
245
253
  option :ordered do
246
254
  short '-o' #TODO: geht das?
247
255
  long '--ordered'
@@ -272,7 +280,7 @@ Choice.options do
272
280
  $count_flag = true
273
281
  end
274
282
  end
275
-
283
+
276
284
  option :plist do
277
285
  short '-d'
278
286
  long '--plist'
@@ -290,7 +298,7 @@ Choice.options do
290
298
  $check_translation = true
291
299
  end
292
300
  end
293
-
301
+
294
302
  option :shuffle do
295
303
  short '-f'
296
304
  long '--shuffle'
@@ -335,8 +343,8 @@ def not_enough_tags?(photo)
335
343
  if $tags_only
336
344
  if ! tagsfile?(photo.filename)
337
345
  return true
338
- else
339
- if $count_flag
346
+ else
347
+ if $count_flag
340
348
  photo.set_keywords
341
349
  if photo.tags.uniq.size < $count
342
350
  return true
@@ -364,7 +372,7 @@ def send_all
364
372
 
365
373
  remaining = Hash.new
366
374
  done = Hash.new
367
- $active_sites.each {|site|
375
+ $active_sites.each {|site|
368
376
  done[site] = false
369
377
  remaining[site] = 999_999_999
370
378
  }
@@ -393,8 +401,8 @@ def send_all
393
401
  $active_sites.each {|site_name|
394
402
  # TODO:
395
403
  # Bevor man Threads nutzt, muß man sicherstellen, dass das Rotieren
396
- # von Bildern abeschlossen ist, bevor ein anderer Thread auf das
397
- # rotierte Bilde zugreift
404
+ # von Bildern abeschlossen ist, bevor ein anderer Thread auf das
405
+ # rotierte Bilde zugreift
398
406
  #threads << Thread.new(site_name) { |site_name|
399
407
  #print "Thread #{site_name} gestartet\n"
400
408
  #Thread.current["threadname"] = site_name.to_s
@@ -404,7 +412,7 @@ def send_all
404
412
  site = eval(site_name.to_s.capitalize+".new(#{site_name.to_s.capitalize})")
405
413
  done[site_name] = true if remaining[site_name] <= 0
406
414
  next if done[site_name]
407
-
415
+
408
416
  if ! site.accept?(File.extname(filename))
409
417
  warn "Warning: Site (#{site_name}) does not support this file extension (#{File.extname(filename)}). Skipped"
410
418
  next
@@ -415,7 +423,7 @@ def send_all
415
423
  end
416
424
  #end
417
425
  if $send_all or
418
- (total_per_site_flag and
426
+ (total_per_site_flag and
419
427
  total[site_name] < Choice.choices[:total_per_site])
420
428
  if !site.already_sent?(photo)
421
429
  begin
@@ -442,17 +450,17 @@ def send_all
442
450
  sleep 30
443
451
  errors[site_name] += 1
444
452
  if errors[site_name] >= MAX_ERRORS
445
- done[site_name] = true
453
+ done[site_name] = true
446
454
  puts "too many errors. giving up."
447
455
  end
448
456
  puts "Upload error at sending to #{site_name} occurred. Check configuration or try again later!"
449
- rescue UploadException
457
+ rescue UploadException => msg
450
458
  errors[site_name] += 1
451
459
  if errors[site_name] >= MAX_ERRORS
452
- done[site_name] = true
460
+ done[site_name] = true
453
461
  puts "too many errors. giving up."
454
462
  end
455
- puts "Upload error at sending to #{site_name} occurred. Check configuration or try again later!"
463
+ puts "Upload error at sending to #{site_name} occurred ('#{msg}'. Check configuration or try again later!"
456
464
  rescue Timeout::Error
457
465
  puts "timeout error"
458
466
  #timeout error
@@ -469,16 +477,16 @@ def send_all
469
477
  end # Timeout
470
478
  end # timeout
471
479
  #} # Thread
472
-
480
+
473
481
  } # alle Sites
474
482
  #print "warte auf Beendigung aller Threads ...\n"
475
483
  #
476
- #threads.each {|thr|
477
- # print "warte auf Thread "+thr.to_s+" "+thr["threadname"]+"\n"
484
+ #threads.each {|thr|
485
+ # print "warte auf Thread "+thr.to_s+" "+thr["threadname"]+"\n"
478
486
  # $stdout.flush
479
487
  # thr.join
480
488
  #}
481
-
489
+
482
490
  end
483
491
  }
484
492
  puts "#{total_transfers} photos sent."
@@ -575,7 +583,7 @@ def stats
575
583
  chosen_date.year,
576
584
  chosen_date.month,
577
585
  chosen_date.day)+" | "
578
- $active_sites.each {|site|
586
+ $active_sites.each {|site|
579
587
  key = [site.to_s, chosen_date]
580
588
  fmt = "%#{site.to_s.length}d | "
581
589
  printf(fmt, (count[key] || 0))
@@ -591,7 +599,7 @@ def stats
591
599
  }
592
600
  count.each_pair {|k,v|
593
601
  site = k[0]
594
- if $active_sites.include? site.to_sym # sonst kommt es zu Fehlern bei
602
+ if $active_sites.include? site.to_sym # sonst kommt es zu Fehlern bei
595
603
  # deaktivierten Sites
596
604
  totals[site.to_sym] += v
597
605
  end
@@ -605,11 +613,11 @@ def stats
605
613
  fmt = "%#{"total".length}d"
606
614
  printf(fmt, all)
607
615
  puts
608
-
616
+
609
617
  #Photos mit/ohne tags-file
610
618
  count = Hash.new
611
619
  count[:tags] = 0
612
- count[:notags] = 0
620
+ count[:notags] = 0
613
621
  Dir.glob(File.join($upload_dir,'*')).each {|filename|
614
622
  next if File.basename(filename)[0,4] == ROT_PREFIX
615
623
  if filename.upcase =~ PICTURE_FILES
@@ -617,7 +625,7 @@ def stats
617
625
  count[:tags] += 1
618
626
  else
619
627
  count[:notags] += 1
620
- end
628
+ end
621
629
  end
622
630
  }
623
631
  puts "#{count[:tags]+count[:notags]} files"
@@ -688,10 +696,10 @@ def purge_done
688
696
  FileUtils.mkdir $done_dir
689
697
  end
690
698
  puts "mv #{filename} done/#{File.basename filename}" unless $silent
691
- FileUtils.mv(filename, File.join($done_dir,File.basename(filename)))
699
+ FileUtils.mv(filename, File.join($done_dir,File.basename(filename)))
692
700
  if tagsfile?(filename)
693
701
  puts "mv #{tagsfilename(filename)} done/#{File.basename(tagsfilename(filename))}" unless $silent
694
- FileUtils.mv(tagsfilename(filename),
702
+ FileUtils.mv(tagsfilename(filename),
695
703
  File.join($done_dir,File.basename(tagsfilename(filename))))
696
704
  end
697
705
  end
@@ -711,7 +719,7 @@ def no_tags
711
719
  next if File.basename(fn)[0,4] == ROT_PREFIX
712
720
  if fn.upcase =~ PICTURE_FILES
713
721
  if ! tagsfile?(fn)
714
- puts fn
722
+ puts fn
715
723
  else
716
724
  # es gibt eine aber zu wenige keywords
717
725
  if $count_flag
@@ -722,7 +730,7 @@ def no_tags
722
730
  end
723
731
  end
724
732
  end
725
-
733
+
726
734
  end
727
735
  }
728
736
  end
@@ -774,7 +782,7 @@ def check_translation
774
782
  photo = Photo.new(fn)
775
783
  photo.set_keywords_without_write(:de,:en) #TODO: später noch flexibler machen!
776
784
  end
777
-
785
+
778
786
  end
779
787
  }
780
788
  end
@@ -819,3 +827,5 @@ end
819
827
  if $check_translation
820
828
  check_translation
821
829
  end
830
+
831
+ # EOF
@@ -0,0 +1,187 @@
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