cuth / unsplash-wallpaper

Use an image from unsplash.com as your background image from a simple command.
MIT License
266 stars 24 forks source link

Feature request: no random name #19

Closed scips closed 6 years ago

scips commented 6 years ago

Dear,

With my intensive usage of the application I start to have disk space issues. So I'm thinking about using unique name for picture instead of random name.

Why, because I'm running the application 24/7 every 5 minutes and after a week I'm about: 10k picture... but I'm taking picture from a collection of 192 pictures (and counting) so I got about 50 times each picture.

If I can have a parameter such as --skip-if-already-downloaded and --use-picture-id-as-filename I could overcome this problem.

Please consider this as a discussion for a future pull request I'll make if it make sens.

Regards,

Sébastien

cuth commented 6 years ago

These are great ideas. If I can figure out --use-picture-id-as-filename I'll just implement it always, no flag needed.

scips commented 6 years ago

Ok we can find a kind of file name by using res.request.uri.pathname which seems unique. The first call at source.unspash.com always result in an header location to a constant pathname and as in your code you follow redirections you are pretty sure to always have res.request.uri.pathname linked to a specific picture. However I'm not completely certain that if you request a picture with size 1080 and with size 720 you want to have it overwritten, which will be the case if we want to keep small filenames. That's why I was suggesting an option. But I'll make a proposal without the option and see if it's ok for my usage then I'll propose a PR.

cuth commented 6 years ago

I'm okay with overwriting regardless of the size.