NaPs / Kolekto

Kolekto is a really KISS movie catalog software

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Delete "Collection" word in the name of collections

tetraf opened this issue · comments

With config:

view 'Collections' {
    pattern = '{collection}/{title}.{ext}'
}

The result:

Collections/<Collection A> Collection/<movie A1>.avi
Collections/<Collection A> Collection/<movie A2>.avi
Collections/<Collection B> Collection/<movie B1>.avi
Collections/<Collection B> Collection/<movie B2>.avi

We could imagine a new config syntax:

view 'Collections' {
    pattern = '{collection_name}/{title}.{ext}'
}

Which give:

Collections/<Collection A>/<movie A1>.avi
Collections/<Collection A>/<movie A2>.avi
Collections/<Collection B>/<movie B1>.avi
Collections/<Collection B>/<movie B2>.avi

Hi. I finally implemented something which will allow you to do what you want (and many more!). This is a new "rewrite" datasource which allow to modify or create fields based on movies data (or not). This new feature use a Python expression to do its job.

Here is an example of configuration to do what you want with collections:

datasource 'rewrite' {
    rewrite 'collection_name' {
        value = "sub('(?i) collection$', '', movie.get('collection')) if 'collection' in movie else None"
    }
}

You can also replace 'collection_name' by 'collection' to rewrite the field instead of creating a new one. You can check the result with the show command.

Don't forget to do a python setup.py egg_info before to try (to register the new datasource).

Wow, great. Thanks.