pytr-org / pytr

Use TradeRepublic in terminal and mass download all documents
https://pypi.org/project/pytr/
MIT License
422 stars 74 forks source link

more date and time variables for the file name #113

Open b166er opened 2 months ago

b166er commented 2 months ago

Is your feature request related to a problem? Please describe. I would like to create some folders with year and as subfolder month, for this I need a separate variable for month. Furthermore, I would like to have the variable with the time without separator 23.59 => (2359), would be great if we also get a separate variable or separate the hours and minutes into separate variables, so that the user can decide for himself what the file name should look like.

Describe the solution you'd like var naming is just a example, you can provide better naming, my suggestion only applies to the number of variables and the high granularity

time vars:

{iso_time} => 01-02 # already exists 
{time_HM} => 0102
{time_HMS} => 010203
{time_H} => 01
{time_h} => 1
{time_M} => 02
{time_m} => 2
{time_M} => 02
{time_m} => 2
{time_S} => 03
{time_s} => 3

date vars:

{date_Y} => 2024 # already exists: {iso_date_year}
{date_y} => 24
{date_M} => 01 # already exists: {iso_date_month}
{date_m} => 1
{date_D} => 02  # already exists: {iso_date_day}
{date_d} => 2
{date_Q} => 3 # nice2have

Additional context my current local modification is

diff --git "a/pytr/dl.py" "b/pytr/dl.py"
index 31708d0..9fccb07 100644
--- "a/pytr/dl.py"
+++ "b/pytr/dl.py"
@@ -97,6 +97,7 @@ class DL:
         variables['iso_date_month'] = timestamp.strftime('%m')
         variables['iso_date_day'] = timestamp.strftime('%d')
         variables['iso_time'] = timestamp.strftime('%H-%M')
+        variables['time_HM'] = timestamp.strftime('%H%M')
+        # and so on...

         filepath = self.file_destination_provider.get_file_path(
             event_type, event_title, event_subtitle, section_title, document_title, variables)

for using in my yml-config: filename: "{iso_date}.{time_HM} {event_title}"