import static groosh.Groosh.groosh
import static org.codehaus.groovy.groosh.stream.DevNull.devnull
ids = [:]
shell = groosh()
//get all images in this folder and upload it to flickr
//remember the photo id we get from flickr
println "Uploading file $it to flickr"
flickcurl = shell.flickcurl("upload",it,"friend","family")
id = flickcurl.grep(~/.*Photo ID.*/).split(":").trim()
ids[it] = id
println "Photo ID is: $id"
//we need to know the first photo id
firstKey = ids.keySet().toList()
//create a set with the name of the directory we are in right now
//use the id of the first photo as set cover
setName = shell.pwd().text.split("/")[-1]
println "Creating set: $setName"
flickcurl = shell.flickcurl("photosets.create",setName,setName,ids[firstKey])
id = flickcurl.grep(~/.*Photoset.*/).split(" ").trim()
println "Photoset ID is: $id"
//make a backup of the ids in a file for later reference
println "Writing ids to a file"
file = new File(shell.pwd().text.trim() + "/.flickrset")
file << "Photoset:" << id << "\n"
file << it.key << ":" << it.value << "\n"
//the first photo is allready part of the photo set so lets remove it
//add the remaining photos to the photo set
println "Adding photo to set at flickr: $it"
shell.flickcurl("photosets.addPhoto",id,it.value) | devnull()
Friday, March 28, 2008
Groosh (http://groovy.codehaus.org/Groosh) provides shell-like capability for handling external processes for Groovy.
Version 0.3.0 comes with several bug fixes and new features like:
- The error stream of a process is now usable the same way as the output stream (useError()).
- A grep method was added which can be used to filter the lines returned by a process.
- A to List method was added which creates a list out of the lines returned by a process.
- A eachLine method was added which iterates over the lines returned by a process.
- The exit values of a process are now accessible. (Thx to Bill Burdick)
- left shift and right shift operators are overloaded for processes and stream sinks.
- the pipe operator was overloaded to allow chaining of processes
For more information on Groosh and examples of its use see:
Groosh 0.3.0 can be downloaded from
OpenSUSE RPM packages are available from
Friday, March 21, 2008
If you want to use javac in the build process you need to add the build requirement to java-devel. Unfortunately this package is not available in the openSUSE_10.2 and openSUSE_10.3 standard repositories. They are available in the openSUSE_10.2:NonFree and openSUSE_10.2:NonFree repositories, but there is no option in the web interface of the build service which allows to configure this.
You have to use the build service API do change this configuration. Which is in fact very easy because the API is a REST like service which can be used for example with kwrite.
allows you do edit the configuration of the repositories. Just add
<path project="openSUSE:10.3:NonFree" repository="standard">
and you have access to the Sun Java rpms.
for more information on the openSuse build service API.