Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize timeformat in filenames #32

Closed
marvin226 opened this issue May 17, 2022 · 4 comments
Closed

Customize timeformat in filenames #32

marvin226 opened this issue May 17, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@marvin226
Copy link

Hello,
thank you for your great work! pytr is a really helpful tool!

I think it would be great if we could format the datetime within the filename.
My problem with the slash as time delimiter is that OneDrive cannot upload files containing a slash.

I just quickly looked into the code and thought one could parse the date and time to format it according to a user defined format, e.g. provided by another argument like --timeFormat with a default value of the existing behavior or an ISO format.

What do you think about it? If you need any support, I would be happy to help.
Thank you!

@marzzzello marzzzello added the enhancement New feature or request label May 17, 2022
@marzzzello
Copy link
Collaborator

I was wondering why your date contains slashes. Seems like the date from trade republic is different depending on your locale.
I guess you use English locale. But I found a better way to get the date anyway, so I'll implement that.
https://github.com/marzzzello/pytr/blob/1a798f1581ac1a7f273c60bc5eb6274ee8a97cf2/pytr/dl.py#L80-L81

@marvin226
Copy link
Author

Thanks for your quick response. I have to clarify that the time contains slashes.

Here are two example filename's located in PATH/Abrechnungen:

  • 2019-11-21 22/38 Kauf TITLE.pdf
  • ...
  • 2022-04-01 12/05 TITLE.pdf

I wrote datetime because I thought about parsing your mentioned iso_date together with the time with datetime. But for sure one could just replace the slash with a colon too :)

@marzzzello
Copy link
Collaborator

Interesting. My files all use : instead of /

@MartinScharrer
Copy link
Contributor

Note that with the changes in pull request #55 the local file name is stored as part of the event JSON. It would be possible to write another python script which then goes through them and renames the files as the user pleases. I am planning to generate some import data for Portfolio Performance from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants