Created
June 16, 2015 17:47
-
-
Save simonszu/5306c0719eeaeec5fe93 to your computer and use it in GitHub Desktop.
Slowly post the content of a directory of images to tumblr
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
| #! /usr/bin/env ruby | |
| require 'tumblr_client' | |
| consumer_key = "" | |
| consumer_secret = "" | |
| access_token = "" | |
| access_token_secret = "" | |
| Tumblr.configure do |config| | |
| config.consumer_key = consumer_key | |
| config.consumer_secret = consumer_secret | |
| config.oauth_token = access_token | |
| config.oauth_token_secret = access_token_secret | |
| end | |
| client = Tumblr::Client.new | |
| #Dir.entries("/home/simonszu/soup-simonszu").first do |filename| | |
| # puts filename | |
| #end | |
| filename = Dir.entries("/path/to/pictures").last | |
| if ((!filename.eql? ".") && (!filename.eql? "..")) | |
| fullpath = File.join("/path/to/pictures", filename) | |
| puts filename | |
| puts fullpath | |
| client.photo("yourname.tumblr.com", {:data => [fullpath], :caption => "Autoimport - #{filename}" }) | |
| File.delete(fullpath) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment