Giter VIP home page Giter VIP logo

4up's Introduction

4up

Mike's "4up" Pinterest PDF-book code abstracted just enough to work with non-Pinterest sources. Which really means any CSV file containing the following columns:

full_img,id,meta

For example, Flickr:

http://farm1.staticflickr.com/1/132429_cb520f81ce.jpg,132429,"{""og:description"": ""Untitled-1, by mickey1 (2004)"", ""pinterestapp:source"": ""http://www.flickr.com/photos/44124351339@N01/132429""}"

If you're looking carefully at the example above and wondering why the various properties are named the way they are it's only because this is still an early branch and I've been more concerned with the bits that can be removed rather than what things should or should not be named. So og:description it is, for now.

Once you have a CSV file you can create a book like this:

$> python ./layout.py -d data/flickr-photos-2005.csv

By default books are split at the 240-page limit. You can override this by passing a --pages argument:

$> python ./layout.py -d data/flickr-photos-2005.csv --pages 150

Flickr

Scripts for generating 4up "compliant" CSV files for a user's photos or favourited photos on Flickr. These scripts will dump all the photos in to CSV files grouped by year uploaded or year faved.

One limitation of the this code is that it assumes old-skool Flickr Auth API credentials (which you can't create anymore). Updating it to work with the newer OAuth stuff is on the list.

Note the use of the -u me shortcut. By default you pass a Flickr NSID to identify a user but if that value is set to "me" the code will look up the NSID for the user identified by the Flickr auth token.

Flickr photos for a user

$> python ./flickr/4up-photos.py -c flickr.cfg -u me -o ../data

Flickr faves for a user

$> python ./flickr/4up-faves.py -c flickr.cfg -u me -o ../data

flickr.cfg

A sample config file is included but it looks like this. As noted above this assumes old Flickr Auth API style credentials.

[flickr]
api_key=YOUR_FLICKR_API_KEY
api_secret=YOUR_FLICKR_API_SECRET
auth_token=YOUR_FLICKR_AUTH_TOKEN

Why "4up"

Because it's sort of catchy and more often that not its the layout that the code chooses for arranging photos on a page.

Caveats

  • You will need to have both Cairo and its corresponding Python bindings installed. This is sometimes harder than it sounds. See below inre: a setup.py script.

To do

  • A proper setup.py script

  • Identify and document that minimum properties required to generate a book and update everything else accordingly

  • Add the ability to pass multiple CSV files at once. Yak shaving ?

  • Figure out paths and library loading for libfreetype stuff under OS X

Credits

Contributors

4up's People

Contributors

hugovk avatar straup avatar thisisaaronland avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.