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

downloader writing some files with two dots in name #45

Open
Sp4rky001 opened this issue Jun 3, 2022 · 1 comment
Open

downloader writing some files with two dots in name #45

Sp4rky001 opened this issue Jun 3, 2022 · 1 comment

Comments

@Sp4rky001
Copy link

Hello, I created the automation according to the README.md file but some are written with two dots before the extension.
Screenshot 2022-06-02 174236

I've even tried to run a replace function to try to alleviate this but it didn't work.

service: downloader.download_file
data:
url: '{{ trigger.event.data.url }}'
filename: '{{ trigger.event.data.label | replace(''.'','''') }}.mp4'

Any suggestions?

@sfjes
Copy link

sfjes commented Jun 10, 2022

You could filter it out, like below. I can't confirm the issue but I do some extra filtering to cleanup the names a bit. The relevant bit would be the \.{2,} pattern.

filename: >
  {{ trigger.event.data.camera_name | regex_replace(find=" ", replace="_", ignorecase=False) }}_{{
    (trigger.event.data.label + '.mp4') | regex_replace(find="(\.{2,}|[&;><`\|\\\$!]+)", replace=".", ignorecase=False) }}

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