Commit graph

6 commits

Author SHA1 Message Date
208762ec38
classes/database.py: Updated table names and added methods to update and disable shipments
classes/tracker.py: Added handling for disabled shipments and improved logging statements
trackbert.py: Added commands to update and disable shipments
2023-08-24 16:05:46 +02:00
0e0b24daba
Update icon path in Tracker class for notify-send command
The commit updates the icon path used in the notify-send command inside the Tracker class. The path to the parcel delivery icon is modified to correctly locate the image file.
2023-08-24 15:35:06 +02:00
a8a7522ff0
Refactor shipment_id assignment in Tracker and trackers/keydelivery.py
The shipment_id assignment has been refactored in the Tracker class and in the keydelivery.py file to set the value as 0 instead of using the tracking_number. This change ensures consistency in assigning the shipment_id across different trackers.
2023-08-24 15:33:09 +02:00
e71a30630d
Refactor event sorting and logging in Tracker class
- Sort events in descending order based on event time.
- Update debug logging message to include event description and time.
2023-08-24 14:48:21 +02:00
1ae1a88975
feat: Add write_event method to Database class
This commit adds a new method called `write_event` to the `Database` class in `database.py`. The method takes an `Event` object as a parameter and adds it to the session before committing the changes to the database. This change simplifies the code in the `create_event` method by making use of the new `write_event` method.

The `write_event` method is used in the `Tracker` class in `tracker.py` to replace the call to `create_event`. This change improves the clarity and readability of the code.

Additionally, in the `Tracker` class, the `api` object is no longer created using `KeyDelivery.from_config`, as the `api` object is no longer referenced in the code. This change is made to remove unused code and improve code quality.

This commit also adds some new import statements to the `Tracker` class in `tracker.py` to support the new changes.

Lastly, two new tracker classes `KeyDelivery` and `PostAT` are added under the `trackers` directory. These new classes inherit from the `BaseTracker` class and implement the `get_status` method. The `KeyDelivery` class makes use of the `pykeydelivery.KeyDelivery` API to fetch tracking events, while the `PostAT` class uses the `postat.classes.api.PostAPI` API to fetch tracking events. The new tracker classes also define the supported carriers and their priorities.

Overall, these changes improve the functionality and structure of the codebase.
2023-08-24 14:46:54 +02:00
fdc6af1059
Add classes for database and tracker
This commit adds new files for database and tracker classes. The database class includes methods for creating shipments, getting shipments, creating events, and getting shipment events. The tracker class includes methods for sending notifications, starting the tracking loop, and initializing the database and API.
2023-08-24 13:31:07 +02:00