- Posted by sondreb on November 17, 2008
-
Abstract: Learn how to use Windows Live Mesh to carry your Flickr photos with you on your Windows Mobile phone.
For years I’ve relied on Flickr as my service for hosting photos that I’m willing to share with friends and others. Yet there has never been a good way of downloading all the Flickr photos, there has been some third party tools that used the Flickr API (I’ve developed one myself) – but these have been “shut down” by Flickr due to privacy and copyright issues.
What do I mean with the title, “Bring your photos to the party”?
It’s fine to put your photos on Flickr, but sometimes there is that special photo you want to show to someone while you’re on the bus or at a party. Yet, you don’t have internet connection or a computer easily available. That’s why I made this solution that uses Flickr .NET API and Live Mesh to do synchronization between your mobile and PC.
Installing Windows Live Mesh
If you don’t have Windows Live Mesh on your computer yet, it’s about time to get it. Live Mesh is a new tool from Microsoft that allows you to easily sync, share, and access the information you care about. You can share your photos, documents, videos, settings or whatever file you have laying around. In the future, you will be able to install and developer your own custom applications against the Live Mesh.
Open the Live Mesh site in your web browser to sign in and download the Live Mesh Client.
https://www.mesh.com/
From this website, you can register the current machine and you can access the other machines remotely. There is additionally a Live Desktop which is a rich Silverlight client that runs in the web browser and gives you access to all your content wherever you are. On holiday and need to upload some travel photos? No problem, just hit the Live Mesh website and upload without any installation (as long as you have the Silverlight plugin).
Getting Live Mesh on your Windows Mobile
If you have a Windows Mobile device, you can install the rich client directly on your mobile phone by visiting https://m.mesh.com/ and logging in with your Live ID. If you access the web site, you can choose to install the client or use the mobile version of the web interface. This means you can access Live Mesh using any device that has a web browser, for example a Nokia or Apple iPhone.
Notice: Currently Microsoft have only opened up Live Mesh Mobile for customers in the US or UK. So to access the mobile client, you need a Windows Live ID that is registered in the US or the UK.
Update: Live Mesh Mobile is now accessible for everyone that activates it using a specially formed URL. Read about it here.
Configuring Folders
Feel free to configure your shared folders how you’d like. By default, Live Mesh Mobile will create a folder called “Mobile Pictures” that maps to your local pictures folder on your phone. This is fine and I would just leave it like that, this means all the photos you capture with the phone camera will be synchronized with your PC. My suggestion is to create a sub-folder within the Mobile Pictures called Flickr. This is the location where we will download photos from the Flickr photo service.
Example path on my computers: C:\Users\Sondre\Desktop\Mobile Pictures\Flickr
Getting Photos from Flickr
To get content from Flickr you can use their open web API directly, or you can utilize an existing .NET API developer by Sam Judson called Flickr.Net.
So to get started, let’s launch Visual Studio and create a new project. You can use your favorite UI framework to do this, be it a Console Application, Windows Presentation Foundation or in my case, Windows Forms.
With your project created you can continue by adding a reference to the newly downloaded FlickrNet.dll that you found on the CodePlex site.
Next step is to write some code that integrates with the authentication mechanism of Flickr. This is not a necessary step if you are developing this for your own project – but since there might be someone that want to download the example program from this post and just run it, we need to do the following.
Apply for Flickr API key
Flickr has started with two types of API keys, non-commercial and commercial keys. For this project we’ll apply for a non-commercial. Visit the website and apply for an key: http://www.flickr.com/services/api/keys/apply/.
On the next step Flickr asks us to fill out some details on our project.
When the submit is completed you will receive your API key and secret. These two values are important to make your communication with the Flickr API work.
There are plenty of examples on how to do the authorization of your custom application. I won’t go into the details in this post, but in the source code for this project I have done some code that will handle everything for you. All you need to do is configure your API key and secret in the FlickrService.cs file.
Edit the two following lines with your own key and secret:
private static string _apiKey = "645f3f0d9c98xxxxx1fbed70d341";
private static string _sharedSecret = "bfc2bfxxxxx1b9";
Running the Flickr2Mesh Application
When you first launch the Flickr2Mesh application, you can choose which folder you have enabled Live Mesh to synchronize. Then you need to authenticate the application to allow Read permission to your photo albums. While this step is not absolutely necessary, it will allow the application to download photos that have been tagged with access only to yourself, your friends or your family. For the purpose of this post, we do not support custom user name to be filled out in the application. Please respect the copyright of individual photographers and respect the policy of Flickr if you decide to extend the Flickr2Mesh application with the ability to download anyone's photos.
So the first step is to decide which folder the application should download all your photos. The next step is to click the authentication link at the bottom to authorize the application to access your photos.
When you click the Authorize button your default web browser will open Flickr.com and you should login with your credentials. After you’ve logged in, you will be presented with a page to confirm the authorization of Flickr2Mesh.
Once accepted the agreement, you can go back to the Flickr2Mesh application.
Click the Complete button to finalize the steps of authenticating Flickr2Mesh.
Flickr2Mesh is now fully authenticated and you should see your Flickr user name display at the bottom of the application. The download button becomes enabled and you can start downloading all your Flickr photos in Small, Medium, Large or Original. By default it’s set to Small which is a good size for mobile phones. If you have one of those fancy new mobiles with 800x480 pixels, I suggest you go with the Medium settings or even the Large. If the application doesn’t find the specified size of an photo, it skips that download.
For the purpose of this post, I won’t add any addition filters than the photo size. If you have a huge library of photos on Flickr, I suggest you add additional filters like search text, specific photoset or some properties that you can filter on with the Flickr API. My suggestion is making a photoset where you put all your Mobile photos.
Now Flickr2Mesh will proceed to download all your photos in the size you selected into the folder of your choice. On your task bar you might start to see the Live Mesh icon start to animate. This means it’s currently synchronizing the photos are you are downloading from Flickr.
If you want to start using the Flickr2Mesh application right now, you can download the finished application from the link here. The full source code is also available for those who want to dig deeper into the Flickr integration and extend it with your own features.
Source Code
Instead of doing a walkthrough on how to write the application from scratch, you can download the compiled binary or the source code. The application is pretty simple but fully functional. It’s a starting point that you can easily extend to do additional actions with the Flickr photo service. Source is licensed under Creative Commons Attribution, that means you can do (almost) whatever you want with it.
What’s next?
Remember that Live Mesh currently supports up to 5GB of online storage. If you go beyond this size, files will no longer be available on the Live Desktop but they will continue to sync between your computers and mobile phone. Microsoft have said earlier that you will be able to specify if a shared folder should be uploaded to the cloud or just work with a Peer-to-Peer (P2P) mechanism between your PCs. So far I have not seen an option to turn off online sync.
Hopefully Microsoft will open up Live Mesh Mobile to the rest of the world soon (it is now available for anyone), that way everyone can experience the benefits of having a rich Live Mesh client everywhere you go.
Hope this introduction to Windows Live Mesh and Flickr Photo Service has been useful and check back later for more Live Mesh development.
Flickr2Mesh by Sondre Bjellås is licensed under a Creative Commons Attribution 3.0 Unported License.
