attachment-downloader icon indicating copy to clipboard operation
attachment-downloader copied to clipboard

jinja2 for date-after and date-before

Open viktordino opened this issue 1 year ago • 5 comments

Good job!

  1. You can customise the download filename using a jinja2 template for the argument --filename-template. Is it possible a jinja2 template to add for argument --date-after. Example: --date-after="{{date.strftime(%Y-%m-%dT00:00:00')}}"
  2. How can I access from the Python programming language to attachment-downloader as in yt-dlp. Example:
import yt_dlp
ydl_opts = {
    'format': format_selector,
}
  1. I'm new to python, please forgive me if the questions are inappropriate. Thank you!

viktordino avatar Feb 28 '24 16:02 viktordino

Hi @viktordino

What the use-case/justification for needing the date after exposed in the filename template?

Unfortunately I don't understand you 2nd question? Are you asking how you can use attcachement-downloader from within another python script?

I'm new to python, please forgive me if the questions are inappropriate. Thank you!

No problem at all! We all have to go through the learning process at some point!

Cheers, James

jamesridgway avatar Mar 01 '24 21:03 jamesridgway

1.Unfortunately I don't understand you 2nd question? Are you asking how you can use attcachement-downloader from within another python script? I found the answer to the question: Attachment downloader is designed to be used as a command line application, it's not designed to be used as a library within a script. jamesridgway/attachment-downloader/issues/19 2.If I don't select Date Filtering, what period does the loader select? How can you use a variable with today's date in an argument? Example: --date-after datetime.now()

viktordino avatar Mar 03 '24 13:03 viktordino

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Apr 04 '24 01:04 github-actions[bot]

2.If I don't select Date Filtering, what period does the loader select? How can you use a variable with today's date in an argument?

If you don't specify a date filter, no date filter will be applied whatsoever and everything that matches any other criteria

With regards to how you would pass in the current date, that depends on how you invoke the library. If you use it as a CLI tool as intended they you're probably better off trying to use your shell environment to pass in the value.

For example, if you're working on linux then you'd want to do something like this:

attachment-downloader --host imap.example.com --username [email protected] --password pa55word --date-after "$(date +"%Y-%m-%dT%H:%M:%S")" --output ~/Downloads

In the above example "$(date +"%Y-%m-%dT%H:%M:%S")" is used to return the current time in the format that attachment-downloader expects

jamesridgway avatar Apr 07 '24 20:04 jamesridgway

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar May 09 '24 01:05 github-actions[bot]