Skip to content

Instantly share code, notes, and snippets.

@masnick
Last active December 15, 2015 11:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masnick/5253481 to your computer and use it in GitHub Desktop.
Save masnick/5253481 to your computer and use it in GitHub Desktop.

Make all your Trovebox photos private:

  1. Check out https://github.com/photo/openphoto-ruby (I used this commit) and bundle install
  2. Copy the gist below into a new file in the openphoto-ruby folder you checked out
  3. Run ruby trovebox_private.rb

Use at your own risk!

require 'rubygems'
require 'openphoto-ruby'
require 'awesome_print'
@site = 'http://username.trovebox.com'
@consumer_key = ''
@consumer_secret = ''
@access_token = ''
@access_token_secret = ''
@client = Openphoto::Client.new(@site, @consumer_key, @consumer_secret, @access_token, @access_token_secret)
page = 1
while true do
response = @client.connect(:get, "/photos/list.json?page=#{page}&pageSize=100")
photos = JSON.parse(response.body)['result']
if photos.length > 0
puts "Page #{page}, #{photos.length} photo(s)"
puts photos.first['hash']
photos.each do |photo|
@client.connect(:post, "/photo/#{photo['id']}/update.json", {'permission' => '0'})
end
page = page + 1
else
break
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment