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

Filter "created" does not output date and time #181

Closed
wintuxx opened this issue Feb 10, 2022 · 12 comments
Closed

Filter "created" does not output date and time #181

wintuxx opened this issue Feb 10, 2022 · 12 comments

Comments

@wintuxx
Copy link

wintuxx commented Feb 10, 2022

Hello all,
In my config I try to rename the files with the filter "created" and move them to a certain folder.

Unfortunately, no values are output in the variables used.

VID-{created.year}{created.month}{created.day}.{created.hour}-{created.minutes}.{extension.lower}

VID-.-.<built-in method lower of str object at 0xb65aad00>

The file name should then look like this:
Example:
VID-20220210-06-20.mp4

here my config:

  - locations:
      - *downloads
    filters:
      - extension:
          - mp4
          - avi
          - mpeg
          - mpg
          - mov
          - mkv
          - flv
          - m4v
          - 3gp
          - wmv
      - name:
          case_sensitive: false
      - created
    actions:
      - move: '/srv/mergerfs/Pool/Videos/VID-{created.year}{created.month}{created.day}.{created.hour}-{created.minutes}.{extension.lower}'  
    subfolders: false
@wintuxx
Copy link
Author

wintuxx commented Feb 10, 2022

Oh i have not seen #177. I have checked my test files and found that they do not have a date of birth.
So i changed to lastmodified, but it still not work how I like.
but now i get this error:
20220209_202712_03.mp4
- (echo) 2022-02-09 20:27:24+01:00
- (move) Move to /srv/mergerfs/Pool/Videos/VID-202229.20-.<built-in method lower of str object at 0xb5bf8b20>

@tfeldmann
Copy link
Owner

Please try again with {extension.lower()} - I'll update the docs to clear that up!

@tfeldmann
Copy link
Owner

And please note that the created.day and created.month variables are not padded - I like to use {created.strftime('%Y-%m-%d')} because of this

@wintuxx
Copy link
Author

wintuxx commented Feb 10, 2022

@tfeldmann How do i get the timestamp in the filename?

@tfeldmann
Copy link
Owner

You can use "{created.timestamp() | int}"

@wintuxx
Copy link
Author

wintuxx commented Feb 10, 2022

      - *downloads
    filters:
      - extension:
          - mp4
          - avi
          - mpeg
          - mpg
          - mov
          - mkv
          - flv
          - m4v
          - 3gp
          - wmv
      - name:
          case_sensitive: false
      - lastmodified
    actions:
      - echo: "{lastmodified}"
      - move: '/srv/mergerfs/Pool/Videos/VID-{lastmodified..strftime('%Y-%m-%d')}-{lastmodified.timestamp() | int}.{extension.>#      - move '/srv/mergerfs/Pool/Videos/{lastmodified}.{extension.lower}'
    subfolders: false

now i get the following error:
ScannerError: while scanning for the next token
found character '%' that cannot start any token
in "", line 75, column 71:
... os/VID-{lastmodified..strftime('%Y-%m-%d')}-{lastmodified.timest ...

The should named VID-Date-Time.extention.

@tfeldmann
Copy link
Owner

Try putting the move argument in double quotes, otherwise it clashes with the string in the placeholder: move: "/srv/me..."

@tfeldmann
Copy link
Owner

And it should be {extension.lower()} instead of {extension.lower}

@wintuxx
Copy link
Author

wintuxx commented Feb 10, 2022

Did not work :/

ValueError: Invalid action {'move':
"/srv/mergerfs/Pool/Videos/VID-{lastmodified..strftime('%Y-%m-%d')}-{lastmodified.timestamp() | int}.{extension.lower()}"}
(expected name or number)

@tfeldmann
Copy link
Owner

You have two .. there:

{lastmodified..strftime('%Y-%m-%d')}

@wintuxx
Copy link
Author

wintuxx commented Feb 10, 2022

Now it works! Thx for your kind support.

By the way, i love your tool.

@wintuxx wintuxx closed this as completed Feb 10, 2022
@tfeldmann
Copy link
Owner

Thank you! :)

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

No branches or pull requests

2 participants