Coder Social home page Coder Social logo

l-vo / photos-picker Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 162 KB

Library that allows to select (randomly or not) many photos and copy them to a destination (local filesystem or web services)

License: MIT License

Python 97.48% Makefile 2.52%
photoframe photos dropbox upload pictures googledrive drive

photos-picker's Introduction

Photos Picker

Build Status codecov license pypi

This libary allows to pick photos in a folder according to a given strategy (last photos, random photos...) and copy them to a destination (another system folder, Dropbox or Google drive folder...)

Compatibility

This library currently works with Python 2.7, Python 3.4, Python 3.5, Python 3.6 and Python 3.7.

Install

$ pip install photos-picker

Usage

The main class PhotosPicker accepts a "picker", a tuple of "filters" and an "uploader" as arguments. The picker allows to select photos while the filters modify them. At the end of the process, the uploader copy transformed (or not) photos to a given destination. Below the simplest example which copy the 50 lastest photos to another directory:

# Python 2.7 example
from photospicker.exception.abstract_exception import AbstractException
from photospicker.picker.pickers.last_photos_picker import LastPhotosPicker
from photospicker.uploader.uploaders.filesystem_uploader import FilesystemUploader
from photospicker.photos_picker import PhotosPicker

if __name__ == '__main__':
    try:
        picker = LastPhotosPicker('/pictures', 50)
        uploader = FilesystemUploader('/destination')
    
        photos_picker = PhotosPicker(picker, (), uploader)
        photos_picker.run()
    except AbstractException as err:
        print err.message

Since picking and uloading may take a while, progress events are dispatched. You can see a more complex example which displays work progress here.

Pickers:

  • LastPhotosPicker: pick the n lastest photos.
  • RandomPicker: pick randomly n photos.
  • SmartPicker: pick randomy n photos. Recent photos have more chance to be picked than old ones. It results by a picking of a majority of recent photos and a few old ones.

More details here

Note you can also create your own picker extending the base class AbstractPicker.

Filters:

  • ResizeFilter: resize the photos with the given width and height. The final photos size are computed for avoiding distortion.
  • RotateFilter: Rotate the photos according to EXIF data.

More details here

Note you can also create your own filter extending the base class AbstractFilter.

Uploaders:

Note that uploaders don't append new photos. Either the directory must be empty or the uploader clear it before copying files.

  • FilesystemUploader: copy the photos to a given directory. This directory must exist and be empty.
  • DropBoxUploader: upload the photos to Dropbox. Note that you should limit your token access to application. Creating a full access token is not needed and may induce security issues.
  • GDriveUploader upload the photos to Google Drive.

More details here

Note you can also create your own uploader extending the base class AbstractUploader.

Contributing

The project is currenlty currently shipped with many pickers, filters or uploaders. But others can be developed, you may post an issue for that. Or better, read how to post a pull request :)

photos-picker's People

Contributors

l-vo avatar

Watchers

 avatar  avatar

photos-picker's Issues

Add filters feature

Picked photos may take a long time to upload since they have a big size. Add the possibility to pass a tuple of filters to PhotosPicker. These filters could reduce image size or for instance change photo orientation according to EXIF data.

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.