varietywalls / variety

Wallpaper downloader and manager for Linux systems
http://peterlevi.com/variety
GNU General Public License v3.0
1.18k stars 140 forks source link

Feature request: show date/time taken or as fallback file name in corner of screen #573

Open eternalbit opened 2 years ago

eternalbit commented 2 years ago

Version of Variety you are using 0.8.9

Is your feature request related to a problem? Please describe. Not related to a problem.

Describe the solution you'd like I'd like Variety to show the EXIF time stamp (or in case there is none the file name without "IMG_" and extension instead) in the bottom right corner of the screen.

So I don't have to click on the icon to know when the photo was taken.

Even more beautiful would be to be able to customize the date format to something like "01 Mar 2022, 14:23"

Additional context

eternalbit commented 9 months ago

I've adapted the FortuneSource.py quotes plugin (/usr/lib/python3.11/site-packages/variety/plugins/builtin/quotes/FortuneSource.py) to actually do this by simply changing the get_random() function to the following (and copying the plugin to ~/.config/variety/plugins and giving it a new ID/name):

def get_random(self):
    wp_filename = subprocess.getoutput(["cat /home/user/.config/variety/wallpaper/wallpaper.jpg.txt"])
    exif_return = subprocess.getoutput(["exiftool -createdate " + "\"" + wp_filename + "\""])
    exif_return_array = exif_return.split(":")
    date_raw = exif_return_array[1] + "-" + exif_return_array[2] + "-" + exif_return_array[3] + ":" + exif_return_array[4] + ":" + exif_return_array[5]
    date_formatted = subprocess.getoutput(["date +\"%a. %d %B %Y, %k:%M\" --date=\"" + date_raw + "\""])
    return [
        {"quote": date_formatted, "author": None, "sourceName": "EXIF Date", "link": None}
    ]

Yeah, it's probably ugly code since I'm not a Python programmer, but it works, yeah ... EXCEPT: there's some quote caching feature in QuotesEngine.py which caches the already used "quotes" and then randomly chooses one from them, instead of directly taking the "quote" returned by the plugin.

So, for it to actually display the correct "quote"/EXIF info, I'll have to somehow disable the caching feature or make sure, the cache is emptied after each run of the plugin, so that there's only the "quote" from the current call of the plugin available. Not sure yet how to do this though.