Flexget / Flexget

The official FlexGet repository
http://www.flexget.com
MIT License
1.73k stars 471 forks source link

Convert timestamp to Date Object #2106

Closed samuelmaurer closed 6 years ago

samuelmaurer commented 6 years ago

I have a task which gets entries from "from_rtorrent". In an if_statement i want to reject entries which are 7 days younger than "timestamp.finished". Problem is, that the field "timestamp.finished" from rtorrent contains a Unix Timestamp and the statement "now" and "timedelta()" are Date Objects. Is there a way to convert the field "timestamp.finished" to a Date Object?

Config:

Clean_WEB:
    manual: yes
    disable:
      - seen
      - seen_info_hash
      - retry_failed
    from_rtorrent:
      uri: '{? rtorrent.site ?}'
      username: '{? rtorrent.usr ?}'
      password: '{? rtorrent.pwd ?}'
    if:
      - "'path to Series' in path": accept
      - timestamp.finished > now - timedelta(days=7): reject
    rtorrent:
      uri: '{? rtorrent.site ?}'
      username: '{? rtorrent.usr ?}'
      password: '{? rtorrent.pwd ?}'
      action: update
      custom1: del_cue

Log:

Error occurred while evaluating statement `timestamp.finished > now - timedelta(days=7)`. (can't compare datetime.datetime to int)

Additional information:

liiight commented 6 years ago

Did you try using the age plugin? https://flexget.com/Plugins/age

Also, this isn't really an issue but a question so it belongs in the forums

cvium commented 6 years ago

Use jinja filters https://flexget.com/Jinja