multistockphoto 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -1
- data/Manifest.txt +2 -0
- data/bin/multistockphoto +3 -2
- data/lib/multistockphoto.rb +3 -0
- data/lib/multistockphoto/mock_zoonar.rb +17 -0
- data/lib/multistockphoto/upload_exception.rb +3 -0
- data/lib/multistockphoto/version.rb +1 -1
- data/test/test_multistockphoto.rb +238 -26
- data/website/index.html +10 -2
- metadata +4 -2
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -14,9 +14,11 @@ lib/multistockphoto/version.rb
|
|
14
14
|
lib/multistockphoto/generic_site.rb
|
15
15
|
lib/multistockphoto/site_fotolia.rb
|
16
16
|
lib/multistockphoto/site_zoonar.rb
|
17
|
+
lib/multistockphoto/mock_zoonar.rb
|
17
18
|
lib/multistockphoto/site_photocase.rb
|
18
19
|
lib/multistockphoto/site_aldi.rb
|
19
20
|
lib/multistockphoto/photo.rb
|
21
|
+
lib/multistockphoto/upload_exception.rb
|
20
22
|
script/console
|
21
23
|
script/destroy
|
22
24
|
script/generate
|
data/bin/multistockphoto
CHANGED
@@ -208,13 +208,14 @@ def send_all
|
|
208
208
|
end
|
209
209
|
break if result != :duplicate && total_transfers >= Choice.choices[:total_transfers]
|
210
210
|
break if all_sites_done(total,Choice.choices[:total_per_site])
|
211
|
-
rescue Net::FTPTempError
|
211
|
+
rescue #UploadException #Net::FTPTempError #TODO: gefaellt mir noch nicht so ganz
|
212
212
|
errors[site_name] += 1
|
213
213
|
if errors[site_name] >= 3
|
214
214
|
done[site_name] = true # nichts mehr uploaden
|
215
215
|
puts "too many errors. giving up."
|
216
216
|
end
|
217
|
-
puts "FTP-Fehler beim Senden an #{site_name} aufgetreten. Ggf. Konfiguration ueberpruefen oder spaeter erneut vesuchen"
|
217
|
+
# puts "FTP-Fehler beim Senden an #{site_name} aufgetreten. Ggf. Konfiguration ueberpruefen oder spaeter erneut vesuchen"
|
218
|
+
puts "Upload-Fehler beim Senden an #{site_name} aufgetreten. Ggf. Konfiguration ueberpruefen oder spaeter erneut vesuchen"
|
218
219
|
end
|
219
220
|
end
|
220
221
|
}
|
data/lib/multistockphoto.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
class Mock_Zoonar
|
2
|
+
def initialize(key,*args)
|
3
|
+
@key = key
|
4
|
+
|
5
|
+
if args[0].include? :remaining
|
6
|
+
@remaining = args[0][:remaining]
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def transfer(photo)
|
11
|
+
if @remaining < 1
|
12
|
+
raise UploadException
|
13
|
+
end
|
14
|
+
@remaining -= 1
|
15
|
+
true
|
16
|
+
end
|
17
|
+
end
|
@@ -22,6 +22,7 @@ class TestMultistockphoto < Test::Unit::TestCase
|
|
22
22
|
@aldi_password = ENV['ALDI_PASSWORD']
|
23
23
|
@photocase_user = ENV['PHOTOCASE_USER']
|
24
24
|
@photocase_password = ENV['PHOTOCASE_PASSWORD']
|
25
|
+
ENV['MSP_CONFIG'] = nil
|
25
26
|
end
|
26
27
|
|
27
28
|
def test_bin_help
|
@@ -193,32 +194,32 @@ sending foto3.jpg ... OK
|
|
193
194
|
#kein ftp assert_equal @photocase_ftp_password, photocase.ftp_password
|
194
195
|
end
|
195
196
|
|
196
|
-
def test_aldi
|
197
|
-
after Date.new(2008,5,30) do
|
198
|
-
site = Aldi.new("ALDI")
|
199
|
-
|
200
|
-
assert_kind_of Aldi, site
|
201
|
-
assert_equal "ALDI", site.name
|
202
|
-
|
203
|
-
site.user = @aldi_user
|
204
|
-
site.password = @aldi_password
|
205
|
-
|
206
|
-
assert site.user
|
207
|
-
assert site.password
|
208
|
-
|
209
|
-
assert_equal @aldi_user, site.user
|
210
|
-
assert_equal @aldi_password, site.password
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
def test_aldi_transfer
|
215
|
-
after Date.new(2008,5,30) do
|
216
|
-
site = Aldi.new("ALDI")
|
217
|
-
photo = Photo.new("/media/LACIE/private/CF-Card/DCIM/119CANON/IMG_3267_zugeschnitten_blank_names.jpg")
|
218
|
-
site.transfer(photo)
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
197
|
+
# def test_aldi
|
198
|
+
# after Date.new(2008,5,30) do
|
199
|
+
# site = Aldi.new("ALDI")
|
200
|
+
#
|
201
|
+
# assert_kind_of Aldi, site
|
202
|
+
# assert_equal "ALDI", site.name
|
203
|
+
#
|
204
|
+
# site.user = @aldi_user
|
205
|
+
# site.password = @aldi_password
|
206
|
+
#
|
207
|
+
# assert site.user
|
208
|
+
# assert site.password
|
209
|
+
#
|
210
|
+
# assert_equal @aldi_user, site.user
|
211
|
+
# assert_equal @aldi_password, site.password
|
212
|
+
# end
|
213
|
+
# end
|
214
|
+
#
|
215
|
+
# def test_aldi_transfer
|
216
|
+
# after Date.new(2008,5,30) do
|
217
|
+
# site = Aldi.new("ALDI")
|
218
|
+
# photo = Photo.new("/media/LACIE/private/CF-Card/DCIM/119CANON/IMG_3267_zugeschnitten_blank_names.jpg")
|
219
|
+
# site.transfer(photo)
|
220
|
+
# end
|
221
|
+
# end
|
222
|
+
#
|
222
223
|
def test_grep
|
223
224
|
file = "test/testgrep.dat"
|
224
225
|
content = "zoonar\tIMG1.jpg\n"+
|
@@ -365,5 +366,216 @@ sending foto3.jpg ... OK
|
|
365
366
|
assert_equal 0, photocase.sent_today
|
366
367
|
|
367
368
|
|
369
|
+
end
|
370
|
+
#end
|
371
|
+
# Code Generated by ZenTest v. 3.9.2
|
372
|
+
# classname: asrt / meth = ratio%
|
373
|
+
# GenericSite: 0 / 4 = 0.00%
|
374
|
+
|
375
|
+
#require 'test/unit' unless defined? $ZENTEST and $ZENTEST
|
376
|
+
|
377
|
+
#class Multistockphoto
|
378
|
+
def DONT_test_iptc_data(*args)
|
379
|
+
raise NotImplementedError, 'Need to write DONT_test_iptc_data'
|
380
|
+
end
|
381
|
+
|
382
|
+
def after(*args)
|
383
|
+
raise NotImplementedError, 'Need to write after'
|
384
|
+
end
|
385
|
+
|
386
|
+
def aldi(*args)
|
387
|
+
raise NotImplementedError, 'Need to write aldi'
|
388
|
+
end
|
389
|
+
|
390
|
+
def aldi_transfer(*args)
|
391
|
+
raise NotImplementedError, 'Need to write aldi_transfer'
|
392
|
+
end
|
393
|
+
|
394
|
+
def bin_help(*args)
|
395
|
+
raise NotImplementedError, 'Need to write bin_help'
|
396
|
+
end
|
397
|
+
|
398
|
+
def bin_version(*args)
|
399
|
+
raise NotImplementedError, 'Need to write bin_version'
|
400
|
+
end
|
401
|
+
|
402
|
+
def config_params_fotolia(*args)
|
403
|
+
raise NotImplementedError, 'Need to write config_params_fotolia'
|
404
|
+
end
|
405
|
+
|
406
|
+
def config_params_photocase(*args)
|
407
|
+
raise NotImplementedError, 'Need to write config_params_photocase'
|
408
|
+
end
|
409
|
+
|
410
|
+
def config_params_pixelio(*args)
|
411
|
+
raise NotImplementedError, 'Need to write config_params_pixelio'
|
412
|
+
end
|
413
|
+
|
414
|
+
def config_params_zoonar(*args)
|
415
|
+
raise NotImplementedError, 'Need to write config_params_zoonar'
|
416
|
+
end
|
417
|
+
|
418
|
+
def fotolia(*args)
|
419
|
+
raise NotImplementedError, 'Need to write fotolia'
|
420
|
+
end
|
421
|
+
|
422
|
+
def fotolia_transfer_1(*args)
|
423
|
+
raise NotImplementedError, 'Need to write fotolia_transfer_1'
|
424
|
+
end
|
425
|
+
|
426
|
+
def fotolia_transfer_existing_no_duplicate_picture(*args)
|
427
|
+
raise NotImplementedError, 'Need to write fotolia_transfer_existing_no_duplicate_picture'
|
428
|
+
end
|
429
|
+
|
430
|
+
def grep(*args)
|
431
|
+
raise NotImplementedError, 'Need to write grep'
|
432
|
+
end
|
433
|
+
|
434
|
+
def iptc_file_keywords(*args)
|
435
|
+
raise NotImplementedError, 'Need to write iptc_file_keywords'
|
436
|
+
end
|
437
|
+
|
438
|
+
def iptc_file_keywords_non_existing_tag_file(*args)
|
439
|
+
raise NotImplementedError, 'Need to write iptc_file_keywords_non_existing_tag_file'
|
440
|
+
end
|
441
|
+
|
442
|
+
def iptc_keywords(*args)
|
443
|
+
raise NotImplementedError, 'Need to write iptc_keywords'
|
444
|
+
end
|
445
|
+
|
446
|
+
def max_errors(*args)
|
447
|
+
raise NotImplementedError, 'Need to write max_errors'
|
448
|
+
end
|
449
|
+
|
450
|
+
def multistockphoto_group(*args)
|
451
|
+
raise NotImplementedError, 'Need to write multistockphoto_group'
|
452
|
+
end
|
453
|
+
|
454
|
+
def photo(*args)
|
455
|
+
raise NotImplementedError, 'Need to write photo'
|
456
|
+
end
|
457
|
+
|
458
|
+
def photocase_transfer_1(*args)
|
459
|
+
raise NotImplementedError, 'Need to write photocase_transfer_1'
|
460
|
+
end
|
461
|
+
|
462
|
+
def set_max_errors(*args)
|
463
|
+
raise NotImplementedError, 'Need to write set_max_errors'
|
464
|
+
end
|
465
|
+
|
466
|
+
# def setup(*args)
|
467
|
+
# raise NotImplementedError, 'Need to write setup'
|
468
|
+
# end
|
469
|
+
|
470
|
+
def site_object(*args)
|
471
|
+
raise NotImplementedError, 'Need to write site_object'
|
472
|
+
end
|
473
|
+
|
474
|
+
def string_to_keyword_array(*args)
|
475
|
+
raise NotImplementedError, 'Need to write string_to_keyword_array'
|
476
|
+
end
|
477
|
+
|
478
|
+
def total_per_day_from_config_file(*args)
|
479
|
+
raise NotImplementedError, 'Need to write total_per_day_from_config_file'
|
480
|
+
end
|
481
|
+
|
482
|
+
def transfer_all(*args)
|
483
|
+
raise NotImplementedError, 'Need to write transfer_all'
|
484
|
+
end
|
485
|
+
#end
|
486
|
+
|
487
|
+
#class TestGenericSite < Test::Unit::TestCase
|
488
|
+
def test_heute_schon_gesendet
|
489
|
+
raise NotImplementedError, 'Need to write test_heute_schon_gesendet'
|
490
|
+
end
|
491
|
+
|
492
|
+
def test_max_errors
|
493
|
+
raise NotImplementedError, 'Need to write test_max_errors'
|
494
|
+
end
|
495
|
+
|
496
|
+
def test_max_errors_equals
|
497
|
+
raise NotImplementedError, 'Need to write test_max_errors_equals'
|
498
|
+
end
|
499
|
+
|
500
|
+
def test_password
|
501
|
+
password = rand(1_000_000).to_s
|
502
|
+
site = Fotolia.new('fotolia')
|
503
|
+
site.password = password
|
504
|
+
assert_equal password, site.password
|
505
|
+
password = rand(1_000_000).to_s
|
506
|
+
site = Zoonar.new('zoonar')
|
507
|
+
site.password = password
|
508
|
+
assert_equal password, site.password
|
509
|
+
password = rand(1_000_000).to_s
|
510
|
+
site = Photocase.new('photocase')
|
511
|
+
site.password = password
|
512
|
+
assert_equal password, site.password
|
513
|
+
end
|
514
|
+
|
515
|
+
def test_password_equals
|
516
|
+
password = rand(1_000_000).to_s
|
517
|
+
site = Fotolia.new('fotolia')
|
518
|
+
site.password = password
|
519
|
+
assert_equal password, site.password
|
520
|
+
password = rand(1_000_000).to_s
|
521
|
+
site = Zoonar.new('zoonar')
|
522
|
+
site.password = password
|
523
|
+
assert_equal password, site.password
|
524
|
+
password = rand(1_000_000).to_s
|
525
|
+
site = Photocase.new('photocase')
|
526
|
+
site.password = password
|
527
|
+
assert_equal password, site.password
|
528
|
+
end
|
529
|
+
|
530
|
+
def test_photos_fuer_heute_uebrig_eh
|
531
|
+
raise NotImplementedError, 'Need to write test_photos_fuer_heute_uebrig_eh'
|
532
|
+
end
|
533
|
+
|
534
|
+
def test_password
|
535
|
+
password = rand(1_000_000).to_s
|
536
|
+
site = Fotolia.new('fotolia')
|
537
|
+
site.password = password
|
538
|
+
assert_equal password, site.password
|
539
|
+
password = rand(1_000_000).to_s
|
540
|
+
site = Zoonar.new('zoonar')
|
541
|
+
site.password = password
|
542
|
+
assert_equal password, site.password
|
543
|
+
password = rand(1_000_000).to_s
|
544
|
+
site = Photocase.new('photocase')
|
545
|
+
site.password = password
|
546
|
+
assert_equal password, site.password
|
547
|
+
end
|
548
|
+
|
549
|
+
def test_password_equals
|
550
|
+
password = rand(1_000_000).to_s
|
551
|
+
site = Fotolia.new('fotolia')
|
552
|
+
site.password = password
|
553
|
+
assert_equal password, site.password
|
554
|
+
password = rand(1_000_000).to_s
|
555
|
+
site = Zoonar.new('zoonar')
|
556
|
+
site.password = password
|
557
|
+
assert_equal password, site.password
|
558
|
+
password = rand(1_000_000).to_s
|
559
|
+
site = Photocase.new('photocase')
|
560
|
+
site.password = password
|
561
|
+
assert_equal password, site.password
|
562
|
+
|
563
|
+
end
|
564
|
+
|
565
|
+
def test_zoonar_nur_noch_5_uploads_moeglich
|
566
|
+
site = Mock_Zoonar.new('zoonar',:remaining => 5)
|
567
|
+
photo = Photo.new("test/1234.jpg")
|
568
|
+
assert site.transfer(photo)
|
569
|
+
assert site.transfer(photo)
|
570
|
+
assert site.transfer(photo)
|
571
|
+
assert site.transfer(photo)
|
572
|
+
assert site.transfer(photo)
|
573
|
+
assert_raise (UploadException) {
|
574
|
+
site.transfer(photo)
|
575
|
+
}
|
576
|
+
assert_raise (UploadException) {
|
577
|
+
site.transfer(photo)
|
578
|
+
}
|
368
579
|
end
|
369
580
|
end
|
581
|
+
|
data/website/index.html
CHANGED
@@ -384,11 +384,19 @@ sie sich aktuell in der Warteschlage der zu begutachtenden Photos befinden.</p>
|
|
384
384
|
|
385
385
|
|
386
386
|
<ul>
|
387
|
-
<li>rubyforge: <
|
387
|
+
<li>rubyforge: <span class="caps">MISSING IN ACTION</span></li>
|
388
388
|
</ul>
|
389
389
|
|
390
390
|
|
391
|
-
<
|
391
|
+
<p><span class="caps">TODO</span> – You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
|
392
|
+
yet to refresh your local rubyforge data with this projects’ id information.</p>
|
393
|
+
|
394
|
+
|
395
|
+
<p>When you do this, this message will magically disappear!</p>
|
396
|
+
|
397
|
+
|
398
|
+
<p>Or you can hack website/index.txt and make it all go away!!</p>
|
399
|
+
|
392
400
|
|
393
401
|
<ul>
|
394
402
|
<li>github: <a href="http://github.com/GITHUB_USERNAME/multistockphoto/tree/master">http://github.com/GITHUB_USERNAME/multistockphoto/tree/master</a></li>
|
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.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Preymesser
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-05-
|
12
|
+
date: 2008-05-29 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -44,9 +44,11 @@ files:
|
|
44
44
|
- lib/multistockphoto/generic_site.rb
|
45
45
|
- lib/multistockphoto/site_fotolia.rb
|
46
46
|
- lib/multistockphoto/site_zoonar.rb
|
47
|
+
- lib/multistockphoto/mock_zoonar.rb
|
47
48
|
- lib/multistockphoto/site_photocase.rb
|
48
49
|
- lib/multistockphoto/site_aldi.rb
|
49
50
|
- lib/multistockphoto/photo.rb
|
51
|
+
- lib/multistockphoto/upload_exception.rb
|
50
52
|
- script/console
|
51
53
|
- script/destroy
|
52
54
|
- script/generate
|