From 0f15efb7a8893ed8161a42ef0a21094b98ee4dc5 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 3 Dec 2014 23:39:03 +0100 Subject: ext.papermanager: added comments --- ranger/ext/papermanager.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ranger/ext/papermanager.py b/ranger/ext/papermanager.py index 932505c9..15fc13a5 100644 --- a/ranger/ext/papermanager.py +++ b/ranger/ext/papermanager.py @@ -141,6 +141,11 @@ class PaperManager(object): return [] def _get_metafile_names(self, path): + # Iterates through the paths of all .paperinfo files that could + # influence the metadata of the given file. + # When deep_search is deactivated, this only yields the .paperinfo file + # in the same directory as the given file. + base = dirname(path) yield join(base, PAPERINFO_FILE_NAME) if self.deep_search: @@ -149,8 +154,10 @@ class PaperManager(object): yield join("/" + "/".join(dirs[0:i]), PAPERINFO_FILE_NAME) def _fill_ostruct_with_data(self, ostruct, dataset): + # Copy data from a CSV row to a dict/ostruct + filename, year, title, authors, url = dataset - if year: ostruct.year = year - if title: ostruct.title = title - if authors: ostruct.authors = authors - if url: ostruct.url = url + if year: ostruct['year'] = year + if title: ostruct['title'] = title + if authors: ostruct['authors'] = authors + if url: ostruct['url'] = url -- cgit 1.4.1-2-gfad0