GithubHelp home page GithubHelp logo

mediasort's Introduction

mediasort

MediaSort is a Python3 web UI that helps you sort media items into folders. The classic use case is to take the many photos and videos produced by a smartphone, and makes sense of them. It also works well for a DSLR.

What does it do?

The workflow is like this, assuming you keep the defaults:

  • First, all the files in the input directory are scanned. Each file will be automatically placed into a set. A set is a group of photos, seperated by 3 hours. This means that photos taken relatively close together (in terms of time) will be in the same set. The time is taken from the EXIF of the photo. If there isn't any EXIF, the file is ignored.
  • This is then shown in the UI. Six items in each set are shown (the first three and the last three), with each item showing a location (pulled from the EXIF of the photo, and geolocated), plus the date and time. You can then decide what to do with the set.
    • You can save with date. This will create a directory in the output folder called yyyy/yyyy-mm/yyyy-mm-ddd <name>. It'll then move all the files in the set there.
    • You can save without date. This will create a directory in the output folder called <name>. It'll then move all the files in the set there.
    • You can delete. This doesn't really delete the files in the set, but instead moves them to the deleted folder.
    • Additionally, for each item in a set, you can remove from set. This will detach it, and create a new set. This is useful if you want to split some sets up.
  • When you save a set with a name, the name is cached. This powers the typeahead, and lets you select the same name again. Note that using the same name multiple times is super common. It will effectively merge a set, assuming they have the same date.
  • And as you scrolling, more sets are loaded. If you want to load more photos for a set than the six, you can.

Get it running

Docker

The easiest way is to take the Docker Compose file, modify some of the config, and then execute it. It will start the required Redis server too. Note that the config is very conservative by default. No folders are mapped, and it runs in "dry-run" mode by default.

docker-compose -f docker-compose.yml up

It will then be available at port 8000 by default. If you are running it on your local machine, it is http://localhost:8000

Configuration

See some configuration options in default_config.py. Override them with the FLASK_ prefix.

Development, or local install

Dependancies

Python 3, plus the modules in requirements.txt

Note you should also have exiftool installed seperately. If you do not, fewer files will be processed - and tests will fail!

The minimum version of exiftool is 12.15. If the correct version is not installed, it will fail silently. (Not sure why...)

For Ubuntu, the minimum version is in 22.04 (jammy) and later. You can download the package directly and install it on earlier versions.

How to run a development server

Assumption is a Ubuntu machine. 22.04 will "just work".

Install the dependancies (exiftool may need some help):

pip3 install -r requirements.txt
sudo apt install exiftool

Set the variables:

export FLASK_REDIS_URL="redis://<ip>:<port>/0"
export FLASK_DEBUG=true

Execute:

python3 -m flask --app web_app run

or to have it listen across the network:

python3 -m flask --app web_app run --host=0.0.0.0

Configuration

If you run Flask in debug mode (via the --debug parameter or using the environment variable like above, then the default_config_dev.py file is used to set some parameters. Otherwise, default_config.py is used.

How to test

pytest is used. Invoke:

python3 -m pytest

Coverage (and a nice HTML report) is determined:

python3 -m pytest --cov . --cov-branch --cov-report html

Auto-formatting is achieved using Black:

python3 -m black .

And making sure you follow PEP 8 is done with Flake8, with the adjustments that Black recommend.

python3 -m flake8

mediasort's People

Contributors

dasos avatar dependabot[bot] avatar

Watchers

 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.