hjw3001-flickrx 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = Uniquify
1
+ = Flickrx
2
2
 
3
3
  Ruby gem implementation of Flickr API.
4
4
 
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('flickrx', '0.1.0') do |p|
5
+ Echoe.new('flickrx', '0.1.1') do |p|
6
6
  p.description = "Ruby implementation of Flickr API."
7
7
  p.url = "http://github.com/hjw3001/flickrx"
8
8
  p.author = "Henry Wagner"
File without changes
data/bin/flickrxdaily ADDED
File without changes
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/flickrx")
4
+ FlickxUtils::SimpleUploader.execute
data/flickrx.gemspec CHANGED
@@ -1,27 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  Gem::Specification.new do |s|
2
4
  s.name = %q{flickrx}
3
- s.version = "0.1.0"
5
+ s.version = "0.1.1"
4
6
 
5
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
6
8
  s.authors = ["Henry Wagner"]
7
- s.date = %q{2009-02-12}
9
+ s.date = %q{2009-03-15}
8
10
  s.description = %q{Ruby implementation of Flickr API.}
9
11
  s.email = %q{hjw3001@gmail.com}
10
- s.extra_rdoc_files = ["lib/flickrx.rb", "README.rdoc"]
11
- s.files = ["init.rb", "lib/flickrx.rb", "Rakefile", "README.rdoc", "Manifest", "flickrx.gemspec"]
12
+ s.executables = ["flickrxauthorize", "flickrxdaily", "flickrxmegaadd", "flickrxordersets", "flickrxuploader"]
13
+ s.extra_rdoc_files = ["bin/flickrxauthorize", "bin/flickrxdaily", "bin/flickrxmegaadd", "bin/flickrxordersets", "bin/flickrxuploader", "lib/flickrx.rb", "lib/utils/AuthorizeFlickrx.rb", "lib/utils/DailyFlickr.rb", "lib/utils/MegaGroupAdd.rb", "lib/utils/OrderPhotosets.rb", "lib/utils/SimpleUploader.rb", "lib/utils/utils.rb", "README.rdoc"]
14
+ s.files = ["bin/flickrxauthorize", "bin/flickrxdaily", "bin/flickrxmegaadd", "bin/flickrxordersets", "bin/flickrxuploader", "flickrx.gemspec", "init.rb", "lib/flickrx.rb", "lib/utils/AuthorizeFlickrx.rb", "lib/utils/DailyFlickr.rb", "lib/utils/MegaGroupAdd.rb", "lib/utils/OrderPhotosets.rb", "lib/utils/SimpleUploader.rb", "lib/utils/utils.rb", "Manifest", "Rakefile", "README.rdoc"]
12
15
  s.has_rdoc = true
13
16
  s.homepage = %q{http://github.com/hjw3001/flickrx}
14
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Flickrx", "--main", "README.rdoc"]
15
18
  s.require_paths = ["lib"]
16
19
  s.rubyforge_project = %q{flickrx}
17
- s.rubygems_version = %q{1.2.0}
20
+ s.rubygems_version = %q{1.3.1}
18
21
  s.summary = %q{Ruby implementation of Flickr API.}
19
22
 
20
23
  if s.respond_to? :specification_version then
21
24
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
22
25
  s.specification_version = 2
23
26
 
24
- if current_version >= 3 then
27
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25
28
  else
26
29
  end
27
30
  else
data/lib/flickrx.rb CHANGED
@@ -630,66 +630,220 @@ class Photos < Flickr
630
630
  }
631
631
  end
632
632
 
633
+ # <photo id="2477196681" secret="52159254f5" server="3293" farm="4">
634
+ # <exif tagspace="TIFF" tagspaceid="1" tag="271" label="Make">
635
+ # <raw>Canon</raw>
636
+ # </exif>
637
+ # <exif tagspace="TIFF" tagspaceid="1" tag="272" label="Model">
638
+ # <raw>Canon EOS 20D</raw>
639
+ # </exif>
640
+ # <exif tagspace="TIFF" tagspaceid="1" tag="274" label="Orientation">
641
+ # <raw>1</raw>
642
+ # <clean>Horizontal (normal)</clean>
643
+ # </exif>
644
+ # <exif tagspace="TIFF" tagspaceid="1" tag="306" label="Date and Time">
645
+ # <raw>2008:05:08 22:49:53</raw>
646
+ # </exif>
647
+ # <exif tagspace="EXIF" tagspaceid="0" tag="33434" label="Exposure">
648
+ # <raw>30/1</raw>
649
+ # <clean>30 sec (30)</clean>
650
+ # </exif>
651
+ # <exif tagspace="EXIF" tagspaceid="0" tag="33437" label="Aperture">
652
+ # <raw>71/10</raw>
653
+ # <clean>f/7.1</clean>
654
+ # </exif>
655
+ # <exif tagspace="EXIF" tagspaceid="0" tag="34850" label="Exposure Program">
656
+ # <raw>1</raw>
657
+ # <clean>Manual</clean>
658
+ # </exif>
659
+ # <exif tagspace="EXIF" tagspaceid="0" tag="34855" label="ISO Speed">
660
+ # <raw>100</raw>
661
+ # </exif>
662
+ # <exif tagspace="EXIF" tagspaceid="0" tag="36867" label="Date and Time (Original)">
663
+ # <raw>2006:05:31 09:47:51</raw>
664
+ # </exif>
665
+ # <exif tagspace="EXIF" tagspaceid="0" tag="37377" label="Shutter Speed">
666
+ # <raw>-4906891/1000000</raw>
667
+ # </exif>
668
+ # <exif tagspace="EXIF" tagspaceid="0" tag="37378" label="Aperture">
669
+ # <raw>5655638/1000000</raw>
670
+ # </exif>
671
+ # <exif tagspace="EXIF" tagspaceid="0" tag="37386" label="Focal Length">
672
+ # <raw>100/1</raw>
673
+ # <clean>100 mm</clean>
674
+ # </exif>
675
+ # <exif tagspace="EXIF" tagspaceid="0" tag="40961" label="Color Space">
676
+ # <raw>1</raw>
677
+ # <clean>sRGB</clean>
678
+ # </exif>
679
+ # <exif tagspace="EXIF" tagspaceid="0" tag="40962" label="Pixel X-Dimension">
680
+ # <raw>3504</raw>
681
+ # </exif>
682
+ # <exif tagspace="EXIF" tagspaceid="0" tag="40963" label="Pixel Y-Dimension">
683
+ # <raw>2336</raw>
684
+ # </exif>
685
+ # </photo>
686
+ def get_exif(photo_id)
687
+ method = 'flickr.photos.getExif'
688
+ api_sig = _get_api_sig(
689
+ {
690
+ 'method' => method,
691
+ 'auth_token' => config['token'],
692
+ 'photo_id' => photo_id
693
+ }
694
+ )
695
+ data = _do_get(method, {
696
+ 'api_sig' => api_sig,
697
+ 'auth_token' => config['token'],
698
+ 'photo_id' => photo_id
699
+ }
700
+ )
701
+ doc = Document.new(data)
702
+ doc.elements.each('rsp/photo') { |photo|
703
+ exif_arr = []
704
+ photos.elements.each('exif') { |exif|
705
+ exif_arr << {
706
+ 'tagspace' => exif.attributes['tagspace'],
707
+ 'tagspaceid' => exif.attributes['tagspaceid'],
708
+ 'tag' => exif.attributes['tag'],
709
+ 'label' => exif.attributes['label'],
710
+ 'raw' => exif.elements['raw'].text,
711
+ 'clean' => exif.elements['clean'].text
712
+ }
713
+ }
714
+ return {
715
+ 'id' => photo.attributes['id'],
716
+ 'secret' => photo.attributes['secret'],
717
+ 'server' => photo.attributes['server'],
718
+ 'farm' => photo.attributes['farm'],
719
+ 'exif' => exif_arr
720
+ }
721
+ }
722
+ end
723
+
633
724
  def get_info(photo_id)
634
725
  method = 'flickr.photos.getInfo'
635
726
  api_sig = _get_api_sig(
636
727
  {
637
- 'method' => method,
638
- 'auth_token' => config['token'],
639
- 'photo_id' => photo_id
728
+ 'method' => method,
729
+ 'auth_token' => config['token'],
730
+ 'photo_id' => photo_id
640
731
  }
641
732
  )
642
733
  data = _do_get(method, {
643
734
  'api_sig' => api_sig,
644
- 'auth_token' => config['token'],
645
- 'photo_id' => photo_id
735
+ 'auth_token' => config['token'],
736
+ 'photo_id' => photo_id
646
737
  }
647
738
  )
648
739
  doc = Document.new(data)
649
740
  doc.elements.each('rsp/photo') { |photo|
650
741
  owner = photo.elements['owner']
651
- date = photo.elements['dates']
742
+ visibility = photo.elements['visibility']
743
+ dates = photo.elements['dates']
744
+ permissions = photo.elements['permissions']
745
+ editability = photo.elements['editability']
746
+ usage = photo.elements['usage']
652
747
  tags = photo.elements['tags']
653
748
  tags_arr = []
654
749
  photo.elements.each('tags/tag') { |tag|
655
750
  tags_arr << {
656
- 'id' => tag.attributes['id'],
657
- 'text' => tag.text
751
+ 'id' => tag.attributes['id'],
752
+ 'text' => tag.text
658
753
  }
659
754
  }
660
- urls = photo.elements['urls']
661
755
  urls_arr = []
662
756
  photo.elements.each('urls/url') { |url|
663
757
  urls_arr << url.text
664
758
  }
665
759
  return {
666
- 'id' => photo.attributes['id'],
667
- 'isfavorite' => photo.attributes['isfavorite'],
668
- 'license' => photo.attributes['license'],
669
- 'views' => photo.attributes['views'],
670
- 'media' => photo.attributes['media'],
671
- 'title' => photo.elements['title'].text,
672
- 'owner_nsid' => owner.attributes['nsid'],
673
- 'owner_username'=> owner.attributes['username'],
674
- 'owner_realname'=> owner.attributes['realname'],
675
- 'owner_location'=> owner.attributes['location'],
676
- 'date_posted' => date.attributes['posted'],
677
- 'date_taken' => date.attributes['taken'],
678
- 'tags' => tags_arr,
679
- 'urls' => urls_arr
760
+ 'id' => photo.attributes['id'],
761
+ 'isfavorite' => photo.attributes['isfavorite'],
762
+ 'license' => photo.attributes['license'],
763
+ 'views' => photo.attributes['views'],
764
+ 'media' => photo.attributes['media'],
765
+ 'secret' => photo.attributes['secret'],
766
+ 'server' => photo.attributes['server'],
767
+ 'farm' => photo.attributes['farm'],
768
+ 'title' => photo.elements['title'].text,
769
+ 'description' => photo.elements['description'].text,
770
+ 'owner_nsid' => owner.attributes['nsid'],
771
+ 'owner_username' => owner.attributes['username'],
772
+ 'owner_realname' => owner.attributes['realname'],
773
+ 'owner_location' => owner.attributes['location'],
774
+ 'ispublic' => visibility.attributes['ispublic'],
775
+ 'isfriend' => visibility.attributes['isfriend'],
776
+ 'isfamily' => visibility.attributes['isfamily'],
777
+ 'date_posted' => dates.attributes['posted'],
778
+ 'date_taken' => dates.attributes['taken'],
779
+ 'date_takengranularity' => dates.attributes['takengranularity'],
780
+ 'date_lastupdate' => dates.attributes['lastupdate'],
781
+ 'permission_permcomment' => permissions.attributes['permcomment'],
782
+ 'permission_permaddmeta' => permissions.attributes['permaddmeta'],
783
+ 'edit_cancomment' => editability.attributes['cancomment'],
784
+ 'edit_canaddmeta' => editability.attributes['canaddmeta'],
785
+ 'usage_candownload' => usage.attributes['candownload'],
786
+ 'usage_canblog' => usage.attributes['canblog'],
787
+ 'usage_canprint' => usage.attributes['canprint'],
788
+ 'tags' => tags_arr,
789
+ 'urls' => urls_arr
680
790
  }
681
791
  }
682
792
  end
683
793
 
794
+ # <sizes canblog="1" canprint="1" candownload="1">
795
+ # <size label="Square" width="75" height="75" source="<direct url to photo>" url="<url to flickr sizes page>" media="photo"/>
796
+ # <size label="Thumbnail" width="100" height="67" source="<direct url to photo>" url="<url to flickr sizes page>" media="photo"/>
797
+ # <size label="Small" width="240" height="160" source="<direct url to photo>" url="<url to flickr sizes page>" media="photo"/>
798
+ # <size label="Medium" width="500" height="333" source="<direct url to photo>" url="<url to flickr sizes page>" media="photo"/>
799
+ # <size label="Original" width="768" height="512" source="<direct url to photo>" url="<url to flickr sizes page>" media="photo"/>
800
+ # </sizes>
801
+ def get_sizes(photo_id)
802
+ method = 'flickr.photos.getSizes'
803
+ api_sig = _get_api_sig(
804
+ {
805
+ 'method' => method,
806
+ 'auth_token' => config['token'],
807
+ 'photo_id' => photo_id
808
+ }
809
+ )
810
+ data = _do_get(method, {
811
+ 'api_sig' => api_sig,
812
+ 'auth_token' => config['token'],
813
+ 'photo_id' => photo_id
814
+ }
815
+ )
816
+ doc = Document.new(data)
817
+ doc.elements.each('rsp/sizes') { |sizes|
818
+ size_arr = []
819
+ sizes.elements.each('size') { |size|
820
+ size_arr << {
821
+ 'label' => size.attributes['label'],
822
+ 'width' => size.attributes['width'],
823
+ 'height' => size.attributes['height'],
824
+ 'source' => size.attributes['source'],
825
+ 'url' => size.attributes['url'],
826
+ }
827
+ }
828
+
829
+ return {
830
+ 'canblog' => sizes.attributes['canblog'],
831
+ 'canprint' => sizes.attributes['canprint'],
832
+ 'candownload' => sizes.attributes['candownload'],
833
+ 'sizes' => size_arr
834
+ }
835
+ }
836
+ end
837
+
684
838
  def search(user_id, tags, tag_mode, page = 0, per_page = 500)
685
839
  method = 'flickr.photos.search'
686
840
  data = _do_get(method, {
687
841
  'api_key' => @config['api_key'],
688
842
  'user_id' => user_id,
689
- 'tags' => tags,
690
- 'tag_mode' => tag_mode,
691
- 'page' => page,
692
- 'per_page' => per_page
843
+ 'tags' => tags,
844
+ 'tag_mode' => tag_mode,
845
+ 'page' => page,
846
+ 'per_page' => per_page
693
847
 
694
848
  }
695
849
  )
@@ -697,14 +851,14 @@ class Photos < Flickr
697
851
  photos = []
698
852
  doc.elements.each('rsp/photos/photo') { |photo|
699
853
  photos << {
700
- 'id' => photo.attributes['id'],
701
- 'owner' => photo.attributes['owner']
854
+ 'id' => photo.attributes['id'],
855
+ 'owner' => photo.attributes['owner']
702
856
  }
703
857
  }
704
858
  return photos
705
859
  end
706
860
 
707
- def removeTag(auth_token, tag_id)
861
+ def removeTag(auth_token, tag_id)
708
862
  method = 'flickr.photos.removeTag'
709
863
  api_sig = _get_api_sig(
710
864
  {
@@ -722,7 +876,7 @@ class Photos < Flickr
722
876
  if data
723
877
  return true
724
878
  end
725
- end
879
+ end
726
880
 
727
881
  end
728
882
 
@@ -750,15 +904,15 @@ class People < Flickr
750
904
  }
751
905
  doc.elements.each('rsp/photos/photo') { |photo|
752
906
  photos << {
753
- 'id' => photo.attributes['id'],
907
+ 'id' => photo.attributes['id'],
754
908
  'owner' => photo.attributes['owner'],
755
- 'secret' => photo.attributes['secret'],
756
- 'server' => photo.attributes['server'],
757
- 'farm' => photo.attributes['farm'],
909
+ 'secret' => photo.attributes['secret'],
910
+ 'server' => photo.attributes['server'],
911
+ 'farm' => photo.attributes['farm'],
758
912
  'title' => photo.attributes['title'],
759
- 'ispublic' => photo.attributes['ispublic'],
760
- 'isfriend' => photo.attributes['isfriend'],
761
- 'isfamily' => photo.attributes['isfamily']
913
+ 'ispublic' => photo.attributes['ispublic'],
914
+ 'isfriend' => photo.attributes['isfriend'],
915
+ 'isfamily' => photo.attributes['isfamily']
762
916
  }
763
917
  }
764
918
  page = page + 1
@@ -802,25 +956,25 @@ class Upload < Flickr
802
956
  api_sig = _get_api_sig(
803
957
  {
804
958
  'auth_token' => config['token'],
805
- 'title' => title,
806
- 'description' => description,
807
- 'tags' => tags,
808
- 'is_public' => is_public,
809
- 'is_family' => is_family,
810
- 'is_friend' => is_friend
959
+ 'title' => title,
960
+ 'description' => description,
961
+ 'tags' => tags,
962
+ 'is_public' => is_public,
963
+ 'is_family' => is_family,
964
+ 'is_friend' => is_friend
811
965
  }
812
966
  )
813
967
  params = {
814
- 'api_key' => config['api_key'],
815
- 'api_sig' => api_sig,
968
+ 'api_key' => config['api_key'],
969
+ 'api_sig' => api_sig,
816
970
  'auth_token' => config['token'],
817
- 'photo' => file,
818
- 'title' => title,
819
- 'description' => description,
820
- 'tags' => tags,
821
- 'is_public' => is_public,
822
- 'is_family' => is_family,
823
- 'is_friend' => is_friend
971
+ 'photo' => file,
972
+ 'title' => title,
973
+ 'description' => description,
974
+ 'tags' => tags,
975
+ 'is_public' => is_public,
976
+ 'is_family' => is_family,
977
+ 'is_friend' => is_friend
824
978
  }
825
979
  query, header = _prepare_query(params)
826
980
  file.close
@@ -0,0 +1,14 @@
1
+ require 'flickx'
2
+
3
+ photo = PhotoSets.new
4
+
5
+ frob = photo.get_frob
6
+ link = photo.get_login_url(frob, 'read')
7
+
8
+ puts
9
+ puts link
10
+ puts
11
+ puts "copy and paste the above url into your browser then hit enter after viewing the page"
12
+ gets
13
+
14
+ puts photo.get_token(frob)
@@ -0,0 +1,53 @@
1
+ require 'flickrx'
2
+ require 'c:/bat/WaldoFlickr'
3
+
4
+ # DailyFlickr.rb
5
+ #
6
+ # Randomly add a photo each time the program is run to the following Flickr groups
7
+ #
8
+ # 649122@N23 - The Anything Group...
9
+ # 67417927@N00 - anything and everything
10
+ # 76921467@N00 - Anything Goes!
11
+ # 86199631@N00 - Anything Goes :)
12
+ # 76649513@N00 - ANYTHING ALLOWED!!!!!!
13
+ # 38436807@N00 - the FlickrToday (only 1 pic per day)
14
+ # 95309787@N00 - Flickritis
15
+ # 34427469792@N01 - FlickrCentral
16
+ # 33968254@N00 - Anything and Everything
17
+ # 96458800@N00 - Flickr Underappreciated (4 per day)
18
+
19
+ class DailyFlickr
20
+ attr_accessor :group, :cache
21
+
22
+ def initialize
23
+ @group = Flickrx::Group.new
24
+ waldo = WaldoFlickr.new
25
+ @cache = waldo.cleanFilenames(waldo.loadCache)
26
+ end
27
+
28
+ def add_photos
29
+ group.poolAdd(cache.random, '649122@N23')
30
+ group.poolAdd(cache.random, '67417927@N00')
31
+ group.poolAdd(cache.random, '76921467@N00')
32
+ group.poolAdd(cache.random, '86199631@N00')
33
+ group.poolAdd(cache.random, '76649513@N00')
34
+ group.poolAdd(cache.random, '38436807@N00')
35
+ group.poolAdd(cache.random, '95309787@N00')
36
+ group.poolAdd(cache.random, '34427469792@N01')
37
+ group.poolAdd(cache.random, '33968254@N00')
38
+ group.poolAdd(cache.random, '96458800@N00')
39
+ group.poolAdd(cache.random, '96458800@N00')
40
+ group.poolAdd(cache.random, '96458800@N00')
41
+ group.poolAdd(cache.random, '96458800@N00')
42
+ end
43
+
44
+ end
45
+
46
+ class Array
47
+ def random
48
+ self[rand(self.length)]
49
+ end
50
+ end
51
+
52
+ daily = DailyFlickr.new
53
+ daily.add_photos
@@ -0,0 +1,32 @@
1
+ require 'WaldoFlickr'
2
+
3
+ class MegaPhotoAdd
4
+ attr_accessor :group, :cache
5
+
6
+ def initialize
7
+ @group = Group.new
8
+ waldo = WaldoFlickr.new
9
+ @cache = waldo.cleanFilenames(waldo.loadCache)
10
+ end
11
+
12
+ def add_all_public_photos
13
+ cache.each_with_index {|photo, i|
14
+ puts i
15
+
16
+ add_to_group(photo, '20759249@N00') # 10 Million Photos
17
+ add_to_group(photo, '24772180@N00') # 1 day we'll have the most photos on Flickr
18
+ add_to_group(photo, '40275508@N00') # Please join
19
+ }
20
+ end
21
+
22
+ def add_to_group(photo_id, group_id)
23
+ begin
24
+ group.poolAdd(photo_id, group_id)
25
+ rescue Exception
26
+ puts "#{photo_id} already in group #{group_id}"
27
+ end
28
+ end
29
+ end
30
+
31
+ mega = MegaPhotoAdd.new
32
+ mega.add_all_public_photos
@@ -0,0 +1,10 @@
1
+ require 'c:/bat/hwflickr'
2
+
3
+ photo = PhotoSets.new
4
+
5
+ photosets = photo.getList
6
+
7
+ ret = ''
8
+ #photosets.sort { |a,b| a.last['title']<=>b.last['title'] }
9
+ photosets.sort.each {|photoset| ret += "#{photoset.last['id']},"}
10
+ photo.orderSets(ret.chop)
@@ -0,0 +1,91 @@
1
+ require 'c:/bat/hwflickr'
2
+ require 'yaml'
3
+ require 'shorturl'
4
+ require 'twitter'
5
+
6
+ class SimpleUploader
7
+ attr_reader :photo, :ps, :group, :uploader, :config, :twitter
8
+
9
+ def initialize
10
+ @photo = Photos.new
11
+ @ps = PhotoSets.new
12
+ @group = Group.new
13
+ @uploader = Upload.new
14
+ @config = load_config
15
+ @twitter = create_or_find_config
16
+ end
17
+
18
+ def process
19
+ # jpgfiles = File.join('./', "*.jpg")
20
+ files = Dir.glob('*.jpg')
21
+
22
+ photosets = ps.getList
23
+ photoset = photosets[config['setname']]
24
+
25
+ files.each { |filename|
26
+ if (File.exists?(filename))
27
+ begin
28
+ #upload(filename)
29
+ exp_hap = false
30
+ rescue Exception
31
+ puts "exception on #{filename} try again"
32
+ print "An error occurred: ",$!, "\n"
33
+ exp_hap = true
34
+ end while exp_hap == true
35
+ else
36
+ puts "File #{filename} does not exist"
37
+ end
38
+ }
39
+
40
+ # Create TinyURL
41
+ tinyurl = ShortURL.shorten("http://www.flickr.com/photos/henrywagner/sets/#{photoset['id']}/")
42
+
43
+ # Post link to Twitter
44
+ message = "added #{files.size} photos to Flickr set '#{config['setname']}' at #{tinyurl}"
45
+ Twitter::Base.new(twitter['email'], twitter['password']).post(message)
46
+ end
47
+
48
+ private
49
+
50
+ def upload_file(filename)
51
+ # If we already have a flickr id, the photo just needs to be replaced
52
+ photoid = uploader.upload(filename, filename, config['description'], config['tags'], config['is_public'], config['is_friend'], config['is_family'])
53
+ # If photoset doesn't exist, create it and add the photo as the set thumbnail
54
+ if (photoset == nil)
55
+ photoset = ps.create(config['setname'], nil, photoid).first
56
+ # Otherwise, the photoset already exists, so just add the photo to it
57
+ else
58
+ ps.addPhoto(photoset['id'], photoid)
59
+ end
60
+
61
+ #if (config['is_public'] == '1')
62
+ # Add the photo to the default groups
63
+ group.poolAdd(photoid, '20759249@N00') # 10 Million Photos
64
+ group.poolAdd(photoid, '24772180@N00') # 1 day we'll have the most photos on Flickr
65
+ group.poolAdd(photoid, '40275508@N00') # Please join
66
+ #end
67
+
68
+ puts photoid
69
+ end
70
+
71
+ def load_config
72
+ begin
73
+ YAML::load open('data.yml')
74
+ rescue
75
+ puts "Trouble loading config"
76
+ end
77
+ end
78
+
79
+ def create_or_find_config
80
+ home = ENV['HOME'] || ENV['USERPROFILE'] || ENV['HOMEPATH']
81
+ begin
82
+ config = YAML::load open(home + "/.twitter")
83
+ rescue
84
+ puts "Trouble loading config"
85
+ end
86
+ end
87
+
88
+ end
89
+
90
+ simple_uploader = SimpleUploader.new
91
+ simple_uploader.process
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hjw3001-flickrx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry Wagner
@@ -9,26 +9,52 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-12 00:00:00 -08:00
12
+ date: 2009-03-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
16
  description: Ruby implementation of Flickr API.
17
17
  email: hjw3001@gmail.com
18
- executables: []
19
-
18
+ executables:
19
+ - flickrxauthorize
20
+ - flickrxdaily
21
+ - flickrxmegaadd
22
+ - flickrxordersets
23
+ - flickrxuploader
20
24
  extensions: []
21
25
 
22
26
  extra_rdoc_files:
27
+ - bin/flickrxauthorize
28
+ - bin/flickrxdaily
29
+ - bin/flickrxmegaadd
30
+ - bin/flickrxordersets
31
+ - bin/flickrxuploader
23
32
  - lib/flickrx.rb
33
+ - lib/utils/AuthorizeFlickrx.rb
34
+ - lib/utils/DailyFlickr.rb
35
+ - lib/utils/MegaGroupAdd.rb
36
+ - lib/utils/OrderPhotosets.rb
37
+ - lib/utils/SimpleUploader.rb
38
+ - lib/utils/utils.rb
24
39
  - README.rdoc
25
40
  files:
41
+ - bin/flickrxauthorize
42
+ - bin/flickrxdaily
43
+ - bin/flickrxmegaadd
44
+ - bin/flickrxordersets
45
+ - bin/flickrxuploader
46
+ - flickrx.gemspec
26
47
  - init.rb
27
48
  - lib/flickrx.rb
49
+ - lib/utils/AuthorizeFlickrx.rb
50
+ - lib/utils/DailyFlickr.rb
51
+ - lib/utils/MegaGroupAdd.rb
52
+ - lib/utils/OrderPhotosets.rb
53
+ - lib/utils/SimpleUploader.rb
54
+ - lib/utils/utils.rb
55
+ - Manifest
28
56
  - Rakefile
29
57
  - README.rdoc
30
- - Manifest
31
- - flickrx.gemspec
32
58
  has_rdoc: true
33
59
  homepage: http://github.com/hjw3001/flickrx
34
60
  post_install_message: