diff --git a/oe/Drucken/oeprint/__init__.py b/oe/Drucken/oeprint/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/oe/Drucken/oeprint/config.py b/oe/Drucken/oeprint/config.py deleted file mode 100644 index efb549e..0000000 --- a/oe/Drucken/oeprint/config.py +++ /dev/null @@ -1,33 +0,0 @@ -"""config.py: Provides functions to read the config""" - -__author__ = 'Jim Martens' - -import json - - -class Config: - def __init__(self, config_file): - self.config_file = config_file - self.config_data = self.load_json_file() - - def load_build(self, build): - """ - Loads the data of a particular build or an empty object if no such build exists - :type build: str - :rtype: dict - """ - if build in self.config_data: - build_data = self.config_data[build] - else: - build_data = {} - return build_data - - def load_json_file(self): - """ - Loads the JSON configuration file - :type self: config.Config - :rtype : dict - """ - file = open(self.config_file, 'r', encoding='utf-8') - json_data = json.load(file) - return json_data diff --git a/oe/Drucken/oeprint/configuration/config.json b/oe/Drucken/oeprint/configuration/config.json deleted file mode 100644 index 2735ad2..0000000 --- a/oe/Drucken/oeprint/configuration/config.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "infodesk": { - "files": [ - { - "identifier": "test", - "prints": 1, - "options": "sides=one-sided" - } - ], - "builds": [] - } -} diff --git a/oe/Drucken/oeprint/file.py b/oe/Drucken/oeprint/file.py deleted file mode 100644 index 9b27d7a..0000000 --- a/oe/Drucken/oeprint/file.py +++ /dev/null @@ -1,33 +0,0 @@ -"""file.py: Provides functionality to manage printable files.""" - -__author__ = 'Jim Martens' - - -def get_file_path(year, directory, identifier): - """ - Returns the file path for the given identifier. - :type year: str - :type directory: str - :type identifier: str - :rtype: str - """ - path = directory + '/' + identifier + '/' - version_file = open(path + 'version.txt') - current_version = version_file.readline().strip() - return path + year + '_' + identifier + '_V' + current_version + '.pdf' - - -def insert_file_paths(year, directory, files): - """ - Manipulates the files list and adds a key named path to each object in the list. - :type year: str - :type directory: str - :type files: list - :rtype: list - """ - file_configs = [] - for file_config in files: - file_config['path'] = get_file_path(year, directory, file_config['identifier']) - file_configs.append(file_config) - - return file_configs diff --git a/oe/Drucken/oeprint/files/,gitkeep b/oe/Drucken/oeprint/files/,gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/oe/Drucken/oeprint/oeprint.py b/oe/Drucken/oeprint/oeprint.py deleted file mode 100755 index e10179c..0000000 --- a/oe/Drucken/oeprint/oeprint.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/python3 - -"""oeprint.py: The main file of the print tool""" - -__author__ = 'Jim Martens' - -import argparse -import sys - -from config import Config -from file import * - - -def main(): - """Main function for oeprint""" - year = '2015' - - parser = argparse.ArgumentParser(description='Printing tool for Orientation Unit') - parser.add_argument('build', metavar='build', help='the identifier of the build') - parser.add_argument('prints', metavar='numberOfPrints', type=int, help='how often the build is printed') - parser.add_argument('--printer', dest='printer', help='a valid printer name like d116_sw', default='d116_sw') - arguments = parser.parse_args() - config = Config('configuration/config.json') - build_data = config.load_build(arguments.build) - if build_data: - build_data['files'] = insert_file_paths(year, 'files', build_data['files']) - print(build_data) - else: - print('Invalid build', file=sys.stderr) - # TODO add actual functionality - -if __name__ == '__main__': - main()