Last active
August 29, 2015 14:03
-
-
Save ebibibi/64ca2cdd0aa1bbb2d516 to your computer and use it in GitHub Desktop.
flickr upload sample1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'flickraw' | |
| FlickRaw.api_key="" | |
| FlickRaw.shared_secret="" | |
| flickr.access_token = "" | |
| flickr.access_secret = "" | |
| # From here you are logged: | |
| login = flickr.test.login | |
| puts "You are now authenticated as #{login.username}" | |
| #flickr.upload_photo PHOTO_PATH + PHOTO_NAME, :title => PHOTO_NAME | |
| def recursive_dir(path) | |
| Dir::foreach(path) do |v| | |
| next if v == "." or v == ".." | |
| if path =~ /\/$/ | |
| #基本的にWindowsではここにはこない | |
| v = path + v | |
| else | |
| file = v | |
| v = path + "/" + v | |
| end | |
| if v =~ /.*\.jpg$|.*\.mov$|.*\.avi$|.*\.mp4$/i | |
| p "upload : " + v | |
| flickr.upload_photo v, :title => file | |
| end | |
| if FileTest::directory?(v) | |
| recursive_dir(v) | |
| end | |
| end | |
| end | |
| recursive_dir "E:\\picture" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment