-
Notifications
You must be signed in to change notification settings - Fork 3
/
pa_print.py
61 lines (44 loc) · 1.96 KB
/
pa_print.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# This file is part of the NIME Proceedings Analyzer (NIME PA)
# Copyright (C) 2024 Jackson Goode, Stefano Fasciani
# The NIME PA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# The NIME PA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# If you use the NIME Proceedings Analyzer or any part of it in any program or
# publication, please acknowledge its authors by adding a reference to:
# J. Goode, S. Fasciani, A Toolkit for the Analysis of the NIME Proceedings
# Archive, in 2022 International Conference on New Interfaces for
# Musical Expression, Auckland, New Zealand, 2022.
import logging
from tqdm import tqdm
notice = "\nNIME Proceedings Analyzer\n\
Copyright (C) 2024 Jackson Goode, Stefano Fasciani\n\
This program comes with ABSOLUTELY NO WARRANTY;\n\
This is free software, and you are welcome to redistribute it\n\
under certain conditions; for details check the LICENSE file.\n"
# Allows a verbose toggle to switch on/off prints to console
def init(args):
global tprint
global nprint
global lprint
logging.basicConfig(filename="./lastrun.log", level=logging.INFO)
def tqdm_out(msg):
# Remove formatting of display
logging.info(" ".join(msg.strip().splitlines()))
if args.verbose:
tqdm.write(msg)
def normal_out(msg):
logging.info(msg)
if args.verbose:
print(msg)
def licence_out():
print(notice)
tprint = tqdm_out
nprint = normal_out
lprint = licence_out