diff --git a/data/db.json b/data/db.json index e9b181766639413e5667fca0ef12bf9dc2bcb639..0f8bb6beaaee6b4b0ab002354fcd370816891abf 100644 --- a/data/db.json +++ b/data/db.json @@ -1 +1 @@ -{"_default": {}} \ No newline at end of file +{"_default": {"1": {"file_code": "771-002-042", "uploaded_date": "2025-01-23_-_10-34-33", "original_name": "test_file_1.pdf", "new_file_name": "771-002-042___-___2025-01-23_-_10-34-33___-___test_file_1.pdf", "path": "/home/fejao/Coding/CCC/git_cccv/c3infodesk-printer/uploads/771-002-042___-___2025-01-23_-_10-34-33___-___test_file_1.pdf", "size": 9819, "num_pages": 1}}} \ No newline at end of file diff --git a/data/usage.ini b/data/usage.ini index b700753f697de416019e4bbedca6bd56c7f625fd..fc4816cf6b394d9a6095f140ac07b6741350fa3d 100644 --- a/data/usage.ini +++ b/data/usage.ini @@ -11,8 +11,8 @@ total = 0 total = 1 [FILES] -total = 0 +total = 1 [TOTAL_SIZE_UPLOAD] -total = 0 +total = 9819 diff --git a/src/config.yml b/src/config.yml index 18c4ba83f644b1ece5053394b44f02b53a35c23b..fbec90fd52aecc6cd9e783b3d2bc833f6285cab9 100644 --- a/src/config.yml +++ b/src/config.yml @@ -5,13 +5,16 @@ default: ### ### SET OWN PROPERTIES: BEGIN ### + + ### PRINTER USED ON 38c3 + printer_name: 'HP_LaserJet_M402n' # printer_name: 'EPSON_ET_2820_Series_USB@localhost' # printer_name: 'EPSON_ET-2820_Series' - printer_name: 'HP_LaserJet_M402n' - path_to_upload: "/home/fejao/Coding/CCC/Repos/c3infodesk/c3printer/uploads" - path_to_log: "/home/fejao/Coding/CCC/Repos/c3infodesk/c3printer/logs/log_01.txt" - path_to_data: "/home/fejao/Coding/CCC/Repos/c3infodesk/c3printer/data" - path_to_test_file: "/home/fejao/Coding/CCC/Repos/c3infodesk/c3printer/src/tests/files/test_file.pdf" + ### LOCAL PATHS --> PLEASE CHANGE THIS + path_to_upload: "/home/fejao/Coding/CCC/git_cccv/c3infodesk-printer/uploads" + path_to_log: "/home/fejao/Coding/CCC/git_cccv/c3infodesk-printer/logs/log_01.txt" + path_to_data: "/home/fejao/Coding/CCC/git_cccv/c3infodesk-printer/data" + path_to_test_file: "/home/fejao/Coding/CCC/git_cccv/c3infodesk-printer/src/tests/files/test_file.pdf" ### ### SET OWN PROPERTIES: END ### @@ -76,8 +79,8 @@ default: enabled_api: true # enabled_api: false ### INFLUXDB - enabled_influxdb: true - # enabled_influxdb: false + # enabled_influxdb: true + enabled_influxdb: false ### FILE PREVIEW file_preview_width: '800' file_preview_height: '900' diff --git a/src/utils/app_usage.py b/src/utils/app_usage.py index 6cef5c1a0b0a94610dd7f9d5cf4bdd4d43478610..5ea3915ba9de16d421fa306ad8dc6142378e10e0 100644 --- a/src/utils/app_usage.py +++ b/src/utils/app_usage.py @@ -8,8 +8,6 @@ ### ### DEPENDENCIES ### -# import os -# import os.path import sys import configparser @@ -159,7 +157,7 @@ class AppUsage(): int: The total uploads. """ - logger("Fetched the counter for total uploads...") + logger("Fetching the counter for total uploads...") tot_uploads = None if self.influxdb is None: @@ -179,7 +177,7 @@ class AppUsage(): ------- None """ - logger("Update the counter for total uploads...") + logger("Updating the counter for total uploads...") tot_uploads = self.counter_uploads_get() + 1 @@ -201,7 +199,7 @@ class AppUsage(): int: The total uploads. """ - logger("Fetched the counter for total files...") + logger("Fetching the counter for total files...") tot_files = None if self.influxdb is None: @@ -221,7 +219,7 @@ class AppUsage(): ------- None """ - logger("Update the counter for total files...") + logger("Updating the counter for total files...") files_at_the_moment = self.counter_files_get() @@ -249,7 +247,7 @@ class AppUsage(): int: The total prints. """ - logger("Fetched the counter for total prints...") + logger("Fetching the counter for total prints...") tot_prints = None if self.influxdb is None: @@ -269,7 +267,7 @@ class AppUsage(): ------- None """ - logger("Updated the counter for total prints...") + logger("Updating the counter for total prints...") tot_prints = self.counter_prints_get() + 1 @@ -291,7 +289,7 @@ class AppUsage(): int: The total pages printed. """ - logger("Fetched the counter for total pages...") + logger("Fetching the counter for total pages...") tot_pages = None if self.influxdb is None: @@ -311,7 +309,7 @@ class AppUsage(): ------- None """ - logger("Updated the counter for total pages...") + logger("Updating the counter for total pages...") tot_pages = self.counter_pages_get() + file_info.get('num_pages') @@ -333,7 +331,7 @@ class AppUsage(): int: The maximal simultaneous uploads. """ - logger("Fetched the counter for maximal simultaneous uploads...") + logger("Fetching the counter for maximal simultaneous uploads...") tot_simult_uploads = None if self.influxdb is None: @@ -353,7 +351,7 @@ class AppUsage(): ------- None """ - logger("Updated the counter for maximal simultaneous uploads...") + logger("Updating the counter for maximal simultaneous uploads...") # Get the total tot_simult = self.counter_max_simultaneous_uploaded_get() @@ -381,7 +379,7 @@ class AppUsage(): int: The total size uploaded. """ - logger("Fetched the counter for total files uploaded size...") + logger("Fetching the counter for total files uploaded size...") tot_size = None if self.influxdb is None: @@ -401,7 +399,7 @@ class AppUsage(): ------- None """ - logger("Updated the counter for total size uploaded...") + logger("Updating the counter for total size uploaded...") tot_size = self.counter_size_get() + file_info.get('size') @@ -424,7 +422,7 @@ class AppUsage(): ------- None """ - logger("Rotate the values on the InfluxDB...") + logger("Rotating the values on the InfluxDB...") ### UPLOADS tot_uploads = self.counter_uploads_get() diff --git a/uploads/771-002-042___-___2025-01-23_-_10-34-33___-___test_file_1.pdf b/uploads/771-002-042___-___2025-01-23_-_10-34-33___-___test_file_1.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b3987e27a6680219d10144aba89575ac8470ecca Binary files /dev/null and b/uploads/771-002-042___-___2025-01-23_-_10-34-33___-___test_file_1.pdf differ