jmathai / elodie

An EXIF-based photo assistant, organizer and workflow automation tool.
https://bit.ly/introducing-elodie
Apache License 2.0
1.27k stars 139 forks source link

Allow the folder structure to be customized #5

Closed patricksan closed 7 years ago

patricksan commented 9 years ago

I would like to use another format for date like dd/MM/yyyy

jmathai commented 9 years ago

@patricksan A few folks have asked about this. The ability to define what the folder structure is would be nice. The folder names can't have reserved characters though.

You may want /%location%/%date% in addition to just wanting different date formats.

waynew commented 8 years ago

I think something to the effect of defining the format string like so:

FILENAME_FORMAT = "/{exif.date:%Y-%m-%d}/{exif.location}"

I don't know that I see a problem with putting reserved (i.e. path separator) characters in. Some may want a slightly different folder structure. Here are some I can think of off the top of my head:

jmathai commented 8 years ago

@waynew I like that format and I think it's something we can easily parse.

There are some considerations to keep in mind though. Right now, for example, the leaf folder can be either a location name or an album name. If the album exists in EXIF that takes precedent over location.

I think we want to keep that level of customization included when we try to solve this.

edent commented 7 years ago

Sketching an idea out, would it make sense to have this in config.ini?

[Directory]
key=%Y-%m-%d

Then, in filesystem.py

from configparser import ConfigParser
__DIR__ = None

def get_dir():
    global __DIR__
    if __DIR__ is not None:
        return __DIR__

    config_file = '%s/config.ini' % constants.application_directory
    if not path.exists(config_file):
        return None

    config = ConfigParser()
    config.read(config_file)
    if('Directory' not in config.sections()):
        return None

    __DIR__ = config.get('Directory', 'dir')
    return __DIR__

Which would then allow you to do

time.strftime(__DIR__, time_obj) and path.append(time.strftime(__DIR__, metadata['date_taken']))

I'm happy to write a PR if that looks suitable? Of course, it only lets you set a date based path, so no good if you want /place/date or anything like that.

jmathai commented 7 years ago

PR looks great. Moving discussion there.

jmathai commented 7 years ago

PR merged. You can now customize the folder path as documented here. https://github.com/jmathai/elodie#create-your-own-folder-structure

Customizing the file name is being tracked in #107.