-
Notifications
You must be signed in to change notification settings - Fork 0
/
sharedExporterFunctions.py
44 lines (35 loc) · 1.29 KB
/
sharedExporterFunctions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
This script provides functions used together by jntExporter and oneExporter.
"""
__author__ = ["Dietmar Malli"]
__copyright__ = "Copyright 2017, Dietmar Malli"
__credits__ = []
__license__ = "GPLv3"
__version__ = "1.0.3"
__maintainer__ = ["Dietmar Malli"]
__email__ = ["[email protected]"]
__status__ = "Production"
import os
def get_output_path(filename):
basename, _ = os.path.splitext(filename)
return os.path.abspath(basename + '.pdf')
def newer_as(note_file, pdf_file):
if not os.path.exists(note_file):
raise Exception('At least file1 must exist.')
note_file_time = os.path.getmtime(note_file)
pdf_file_time = os.path.getmtime(note_file) # init var
if os.path.exists(pdf_file):
pdf_file_time = os.path.getmtime(pdf_file)
if pdf_file_time < note_file_time:
return True
else:
return False
def get_recursive_filelist(filebase='./', filetype='.one', exclude_folders=[]):
list = []
print('Generating recursive list for: {}'.format(filebase))
for root, dirs, files in os.walk(filebase, topdown=True):
for file in files:
dirs[:] = [d for d in dirs if d not in exclude_folders]
if file.endswith(filetype):
list.append(os.path.abspath(os.path.join(root, file)))
return list