Rename openphoto to trovebox, in order to work with openphoto-python release 0.4

This commit is contained in:
sneakypete81 2013-07-20 19:16:58 +01:00
parent d0fa10655c
commit 3297a24b93
2 changed files with 22 additions and 24 deletions

View file

@ -1,6 +1,6 @@
Open Photo API / Import companion for export- tools
Trovebox API / Import companion for export- tools
=======================
#### OpenPhoto, a photo service for the masses
#### Trovebox, a photo service for the masses
----------------------------------------
@ -15,17 +15,14 @@ This tool processes the files generated from the `export-*` tools such as `expor
Before you run an import you'll have to first run an export. If you haven't done this already pick the appropriate one below.
* https://github.com/photo/export-flickr
* https://github.com/photo/export-openphoto
<a name="dependencies"></a>
### Getting dependencies
The only dependency you need the `openphoto` module ([repository on Github](https://github.com/photo/openphoto-python)).
The only dependency you need the `trovebox` module ([repository on Github](https://github.com/photo/openphoto-python)).
git clone git://github.com/photo/openphoto-python.git
cd openphoto-python
sudo python setup.py install
# you can leave this directory now that it's been installed
cd ..
sudo pip install trovebox
<a name="download"></a>
### Downloading the script
@ -48,9 +45,9 @@ https://raw.github.com/photo/import/master/import.py
<a name="credentials"></a>
### Credentials
For full access to your photos, you need to create the following config file in ``~/.config/openphoto/default``
For full access to your photos, you need to create the following config file in ``~/.config/trovebox/default``
# ~/.config/openphoto/default
# ~/.config/trovebox/default
host = your.host.com
consumerKey = your_consumer_key
consumerSecret = your_consumer_secret
@ -96,7 +93,7 @@ case you try to import a duplicate, the file will instead be moved in `duplicate
### YAY
You can go to your OpenPhoto site and see all of your Flickr photos with tags, title and description all in tact.
You can go to your Trovebox site and see all of your Flickr photos with tags, title and description all in tact.
<a name="knownissues"></a>
### Known issues

View file

@ -12,13 +12,13 @@ import logging
# import flickrapi
# `easy_install flickrapi` or `pip install flickrapi`
from openphoto import OpenPhoto, OpenPhotoError, OpenPhotoDuplicateError
from trovebox import Trovebox, TroveboxError, TroveboxDuplicateError
from os.path import join, getsize
# main program
def import_into_openphoto(client):
def import_into_trovebox(client):
for root, dirs, files in os.walk('fetched/'):
@ -45,17 +45,17 @@ def import_into_openphoto(client):
try:
resp = client.post('/photo/upload.json', **params)
if resp['code'] != 201:
raise OpenPhotoError("Unexpected response code: %d: %s"%
raise TroveboxError("Unexpected response code: %d: %s"%
(resp['code'], resp['message']))
print "OK"
processed = processed + 1
shutil.move("errored/%s" % i, "processed/%s" % i)
except OpenPhotoDuplicateError:
except TroveboxDuplicateError:
print "DUPLICATE: This photo already exists on the server"
shutil.move("errored/%s" % i, "duplicates/%s" % i)
errored = errored + 1
except OpenPhotoError as error:
except TroveboxError as error:
print "FAILED: %s" % error
errored = errored + 1
@ -78,9 +78,9 @@ def createDirectorySafe( name ):
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description='Import photos into an OpenPhoto instance')
parser = argparse.ArgumentParser(description='Import photos into an Trovebox instance')
parser.add_argument('--config', help="Configuration file to use")
parser.add_argument('--host', help="Hostname of the OpenPhoto server (overrides config_file)")
parser.add_argument('--host', help="Hostname of the Trovebox server (overrides config_file)")
parser.add_argument('--consumer-key')
parser.add_argument('--consumer-secret')
parser.add_argument('--token')
@ -93,16 +93,17 @@ if __name__ == '__main__':
# Host option overrides config file settings
if config.host:
client = OpenPhoto(host=config.host, consumer_key=config.consumer_key,
consumer_secret=config.consumer_secret,
token=config.token, token_secret=config.token_secret)
client = Trovebox(host=config.host, consumer_key=config.consumer_key,
consumer_secret=config.consumer_secret,
token=config.token, token_secret=config.token_secret)
else:
try:
client = OpenPhoto(config_file=config.config)
client = Trovebox(config_file=config.config)
except IOError as error:
print error
print
print "You must create a configuration file with the following contents:"
print "You must create a configuration file in ~/.config/trovebox/default"
print "with the following contents:"
print " host = your.host.com"
print " consumerKey = your_consumer_key"
print " consumerSecret = your_consumer_secret"
@ -123,4 +124,4 @@ if __name__ == '__main__':
createDirectorySafe('errored')
createDirectorySafe('duplicates')
import_into_openphoto(client)
import_into_trovebox(client)