HoverHell / RedditImageGrab

Downloads images from sub-reddits of reddit.com.
GNU General Public License v3.0
312 stars 80 forks source link

Add Python3 compatibility + a few minor changes #86

Open deliberist opened 5 years ago

deliberist commented 5 years ago

Hi, I love you project! I needed the exact same thing to use images from Reddit as desktop wallpapers, but I'm running a system without Python2. I updated the code so that it can run under Python3. I do not believe I broke anything if yourself (or anyone else) has to still run the code with Python2. But I was not able to test that (sorry!).

If interested, I use this script to update my wallpaper given that all my downloaded Reddit pics are in a "backgrounds" directory in the RedditImageGrab project.

#!/usr/bin/env bash

set -o errexit
set -o nounset

LOG_FILE=${HOME}/.fehbg.log

function log() {
  date "+%Y/%m/%d %H-%M-%S: ${*}" | tee -a ${LOG_FILE}
}

WALLPAPER_DIR="${HOME}/Development/RedditImageGrab/backgrounds"
WALLPAPER_FILE="$(find "${WALLPAPER_DIR}" -type f | sort -R | head -n 1)"
WALLPAPER_CMD="feh --bg-scale ${WALLPAPER_FILE}"

log ${WALLPAPER_CMD}
eval ${WALLPAPER_CMD}

Feel free to reject the pull-request if something is broken when running with Python2 and I'll look into fixing it.

Thanks! And again, great project!

rachmadaniHaryono commented 5 years ago

@rbprogrammer you may have better chance merging it with @jtara1 repo because it is more updated and adapted to python 3 already

see also other pr like #82