erlsmug — an Erlang client for the SmugMug API
Like many others, I’m intrigued by the promise of Erlang but my development efforts to date have been limited to small script-like examples and the odd server from the Programming Erlang book. I wanted to develop something much richer on my own and perhaps even something of value. Since I’m already the author of a high-performance SmugMug client for Python I figured writing a similar library would be a proper way to compare and contrast the two languages and approaches to concurrency.
So, without further ado, I present erlsmug, an Erlang client for the SmugMug API. The project is a whopping day old but I can already log in and query my albums and images. I’m excited to see some benchmarks between my Python and Erlang clients — the Python client makes use of PycURL which is concurrent, rockstar fast and easy to use.
Some issues I’ve already encountered:
- The
inetsapplication seems to hang if I try anhttpsurl. - Copying examples of OTP applications is harder than one would think because each is just a little different.
- How come the
.appdoesn’t automatically start the applications declared as dependencies? It looks like most of the examples I looked at code.google had astart/0helper function which started the appropriate applications. Is this best practice? - I’m still a little confused about the
Statemaintained for the server. I’m using it to keep the session id after logging into SmugMug but what if multiple credential could be used simultaneously? I’m sure there’s something I’m just not getting.
That’s it for now. I’m going to have to talk to Martin to clear up some questions and learn more about Erlware.
Ahh, yes, we should jump on the phone and go through this. With a little work we can make the dev experience here much more pleasant.
You should not have to copy OTP apps. Sinan can manage those deps for you. Even if you use make you should still not have to copy apps they can be just “plugged in” via a release structure.
From the sounds of it you are not using OTP releases. Using them will solve your app start problem. If you look in the .app file you may or may not see a ‘mod’ tuple. It is that tuple that tells the application framework how to start your app if applicable.
In terms of the questions surrounding State, I need to know what sort of process you are keeping state in, is it a gen_server?
We can talk later. I am glad to help, the app sounds pretty nifty and useful. Smugmug is a nice site and Erlang folks should get to use it too :)
@Martin,
In the gen_server init/1 I create a session with SmugMug and store the session id as the State variable.