Меняем обои при каждом билде Android проекта
- task pashalka(type:Exec) {
- def baseUrl = "https://api.500px.com/v1/photos/"
- def consumerKey = "tHw2EVIztsWfQvHjs1qpauZxSH2IjvvgH"
- def jsonUrl = baseUrl + "?consumer_key=" + consumerKey + "&image_size=2048"
- def path = ""
- try {
- def response = ['/usr/bin/curl', jsonUrl + '&only=People&page=' + new Random().nextInt(5)].execute()
- def json = new groovy.json.JsonSlurper().parseText(response.text)
- path = json.photos[new Random().nextInt(19)].image_url
- } catch (Exception e) {}
- commandLine "/usr/bin/gsettings", "set", "org.gnome.desktop.background", "picture-uri", path
- }
- preBuild.dependsOn pashalka
Работает только на linux дистрибутивах с оболочками основанными на GNOME.