From 8066900ab3e628e5a4d6b523b25b4311f5fe00a3 Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Tue, 16 Jan 2024 21:38:06 +0100 Subject: [PATCH] add by_citename --- paperlibrary/library/library.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/paperlibrary/library/library.py b/paperlibrary/library/library.py index 2a80c71..775d795 100644 --- a/paperlibrary/library/library.py +++ b/paperlibrary/library/library.py @@ -50,10 +50,12 @@ def write_symlinks(api: PaperLibraryAPI, config: Config): title_dir = basedir / "by_title" custom_title_dir = basedir / "by_custom_title" citation_key_dir = basedir / "by_citation_key" + citename_dir = basedir / "by_citename" tags = set() - for directory in [author_dir, keyword_dir, year_dir, title_dir, tags_dir, custom_title_dir, citation_key_dir]: + for directory in [author_dir, keyword_dir, year_dir, title_dir, tags_dir, custom_title_dir, citation_key_dir, + citename_dir]: shutil.rmtree(directory, ignore_errors=True) directory.mkdir() @@ -81,13 +83,13 @@ def write_symlinks(api: PaperLibraryAPI, config: Config): link_file(pdf_dir, tag_dir, paper, paper.title) tags.add(tag) - if not paper.custom_title: - continue - link_file(pdf_dir, custom_title_dir, paper, paper.custom_title) + if paper.custom_title: + link_file(pdf_dir, custom_title_dir, paper, paper.custom_title) - if not paper.custom_title: - continue - link_file(pdf_dir, citation_key_dir, paper, paper.citation_key) + if paper.citation_key: + link_file(pdf_dir, citation_key_dir, paper, paper.citation_key) + if paper.citename: + link_file(pdf_dir, citename_dir, paper, paper.citename) for year, papers in api.fetch_papers_by_year().items(): year_subdir = year_dir / str(year)