ssimunic / Daily-Reddit-Wallpaper

Change your wallpaper to the most upvoted image of the day from /r/wallpapers or any other subreddit on system startup
http://ssimunic.github.io/Daily-Reddit-Wallpaper/
GNU General Public License v3.0
306 stars 51 forks source link

Do not download files that already exists #20

Closed dolohow closed 8 years ago

dolohow commented 8 years ago

As this program fetches wallpapers daily, there is no reason to do that when the program is invoked twice the same day.

By verifying whether the wallpaper file already exists we can conclude that the program was already run during that day.

ssimunic commented 8 years ago

User can still specify to run the program every hour and this wouldn't allow then the wallpaper to be changed, however, there is some tweaking that needs to be done.

dolohow commented 8 years ago

So maybe we could store the information in ~/.cache when we fetched last time along with pictures?

remggo commented 8 years ago

Maybe store the URLs of the last fetched images (e.g. 3 URLs should be enough)

dolohow commented 8 years ago

And where you want to put that file? I could use a shelve module for that.

ssimunic commented 8 years ago

Instead of saving picture as subreddit name + date, we could add hour into date so it doesn't override existing one, if 'hourly' option is used.

dolohow commented 8 years ago

Could it happen that for example at 1am and 2am the wallpaper could be the same?

ssimunic commented 8 years ago

@dolohow , yeah, wallpaper on the subreddit could be the same. Then another option is to save reddit post ID in filename and if it is same, just don't download it

dolohow commented 8 years ago

I would go with that option and let's forget about the date, we already have ctime, let's say wallpaper-ID.jpg. What do you guys think?

remggo commented 8 years ago

subreddit-ID.jpg would do the Trick

ssimunic commented 8 years ago

@dolohow @remggo Good suggestion. We should go with this one.

dolohow commented 8 years ago

I will try to prepare appropriate PR for that.

dolohow commented 8 years ago

@ssimunic Please review this new approach.

Thanks

ssimunic commented 8 years ago

@dolohow Good job!