From f1afbdd1ac4667bf6ddfa26c23dead32e7d637a5 Mon Sep 17 00:00:00 2001 From: Phyks Date: Sat, 17 May 2014 22:21:51 +0200 Subject: [PATCH] Customization option for files renaming --- README.md | 7 +++---- backend.py | 3 +++ params.py.example | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c83825d..9d2e2b4 100644 --- a/README.md +++ b/README.md @@ -138,13 +138,12 @@ Here are some sources of inspirations for this project : A list of ideas and TODO. Don't hesitate to give feedback on the ones you really want or to propose your owns. -50. Anti-duplicate ? -55. Customization options for naming 60. Check stored versions when updating arxiv papers -65. Look for published version in arXiv 70. Export of bibtex 80. Search engine -90. No DOI for HAL => metadata with SOAP API… don't want to handle it for now :/ +85. Anti-duplicate ? +90. Look for published version in arXiv +95. No DOI for HAL => metadata with SOAP API… don't want to handle it for now :/ 200. Webserver interface ? GUI ? (not likely for now…) 300. Tree à la docear ? diff --git a/backend.py b/backend.py index 0934257..9b32479 100644 --- a/backend.py +++ b/backend.py @@ -42,6 +42,9 @@ def getNewName(src, bibtex, tag=''): else: new_name = new_name.replace("%v", '') + for custom in params.format_custom: + new_name = custom(new_name) + if tag == '': new_name = (params.folder + tools.slugify(new_name) + tools.getExtension(src)) diff --git a/params.py.example b/params.py.example index 6c51b73..25fdd1f 100644 --- a/params.py.example +++ b/params.py.example @@ -18,3 +18,8 @@ proxies = [ # %v = arXiv version (e.g. '-v1') or nothing if not an arXiv paper format_articles = "%f_%l-%j-%Y%v" format_books = "%a-%t" + +# Other customization +# List of lambda functions to apply +# E.g. : format_custom = [lambda x: x.replace('test', 'some_expr')] +format_custom = []