diff --git a/tmp/flickr.rb b/tmp/flickr.rb new file mode 100644 index 0000000..7923d96 --- /dev/null +++ b/tmp/flickr.rb @@ -0,0 +1,279 @@ +# +# https://www.flickr.com/services/api/ +# + +require 'adler32' +require 'digest' +require 'digest/crc32' +#require 'easy-crc' +require 'flickraw' +require 'openssl' + +FlickRaw.api_key = "" +FlickRaw.shared_secret = "" + +flickr.access_token = "" +flickr.access_secret = "" + +def titleize(str) + str.split(/ |\_/).map(&:capitalize).join(" ") +end + +def get_count(f, pp, pl) + # https://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html + count = f.photos.getWithoutGeoData(:sort => 'date-taken-desc', :per_page => pp, :page => pl).length +end + +login = flickr.test.login +puts "You are now authenticated as #{login.username}" + +pp = 20 +pl = 0 +photo_count = 0 +page_count = 0 +print "Counting Pages...\n" +while get_count(flickr, pp, pl) != 0 do + pl = pl + 1 + c = get_count(flickr, pp, pl) + photo_count = photo_count + c + print "." + STDOUT.flush +end +page_count = pl - 1 +print "\n" +print "Counted: " + page_count.to_s() + " pages..." +print "\n" +print "Counted: " + photo_count.to_s() + " photos..." +print "\n" + +tmp_page1 = 1 +paging_code1 = "
" + info.description + "
' >> photo/" + id_new + "/index.html; " + else + t_cmd = t_cmd + "echo '" + info.description + "
' >> photo/" + id_new + "/index.html; " + end + + if page < 2 + t_cmd = t_cmd + "echo 'Download full archive as 7z file (SHA1: " + archive_digest + ")
' >> photo/" + id_new + "/index.html; " + + t_cmd = t_cmd + "echo 'This photo is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license. Please contact me if you want to use this photo for commercial purposes.
\n' >> photo/" + id_new + "/index.html; " + + ##t_cmd = t_cmd + "echo 'If you want to add a comment, you can do this using a Flickr account. The photos are synced regularly and your comment will at some time occour here. https://www.flickr.com/photos/johannesfindeisen/" + vv.id + "/.
' >> photo/" + id_new + "/index.html; " + + wasGood = system( t_cmd ) + sleep 1 + t_cmd = "" + end + + p_cmd = "" + if page < 2 + p_cmd = p_cmd + "echo '