Skip to content

maximtrp/randpaper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

randpaper

randpaper is a Python script to download photos tagged with a specified keyword (or a random one from the predefined list) from Pexels website.

To use it you must obtain an API KEY from Pexels. Put it into api.key file near randpaper.py script or insert it below using an API_KEY variable.

Requirements

randpaper uses the following Python packages from the standard library: json, random, glob, os, shutil, sys, getopt. You must also install requests package.

Usage examples

Download a photo tagged with a random keyword (from the predefined list) and put it into ~/Pictures/Wallpapers/ directory:

$ chmod +x randpaper.py
$ ./randpaper.py -p ~/Pictures/Wallpapers/

Download two photos:

$ chmod +x randpaper.py
$ ./randpaper.py -p ~/Pictures/Wallpapers/ -n 2

Download two popular photos:

$ chmod +x randpaper.py
$ ./randpaper.py -p ~/Pictures/Wallpapers/ -n 2 -a

Using with i3

I personally use this script with i3 to get a random photo and set it as a wallpaper.

Using feh and randpaper from a command line:

$ feh --bg-fill $(./randpaper.py -p ~/Pictures/Wallpapers/ -k tech)

Setting a keyboard shortcut inside i3 config file:

bindsym $mod+Print exec --no-startup-id "feh --bg-fill $(~/Programming/randpaper/randpaper.py -p ~/Pictures/Wallpapers/)"

Limits

Pexels API imposes certain limits on requests number per hour and month: 200 and 20000.

Releases

No releases published

Packages

No packages published

Languages