test_cgi.pl
This is an incredibly simple (and awful) script to show new programmers the OAuth steps required to connect to LOVEFiLM. Please use it as a guide only as programming style has moved on since the 90's, however it does keep the dependancies down.
Also, it will only work for one user.
Having a checkout/download version of the code, I setup apache to have a virtual server with its cgi-bin set like this
ScriptAlias /cgi-bin/ /the/full/path/WWW-Lovefilm-API/examples
The lib dir is at /the/full/path/WWW-Lovefilm-API/lib, and the required package WWW::Lovefilm::API can be found in there. Hence you don't have to install the package to run it since it is relative and it will be found.
Make sure "vars_tokenless.inc" in the examples directory has your consumer_key and consumer_secret set for your app.
This is a cheap way of storing state when the user gets redirected.
This appends any new key values onto the existing state.
return a hash of representing the stored state
Assume the user has accepted a use signup, hence get the access_token, store it, then display the titles they have at home.
Create a link for the user to click on that will take them to the LOVEFiLM site. In the link is the oauth_token (request token) which we asked the LOVEFiLM API for first, hence when the user goes to their website they know our app sent them.
This function will only work if the user has given permission to your app to access your account at LOVEFiLM.
The images for a given film (title) are split into different directories so we can't construct a URL by just knowing the ID of the title.
This function performs an API call to get the href of the correct image size.
To install WWW::Lovefilm::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Lovefilm::API
CPAN shell
perl -MCPAN -e shell install WWW::Lovefilm::API
For more information on module installation, please visit the detailed CPAN module installation guide.