Institutionen för datavetenskap Department of Computer and Information Science

Final thesis Intergration of Cloudme to Sonos wireless HiFi speaker system

by

Pavithra velusamy Chandramohan

LIU-IDA/LITH-EX-A—13/012—SE

2013-02-22

Linköpings universitet Linköpings universitet SE-581 83 Linköping, Sweden 581 83 Linköping

Integration of CloudMe to SONOS wireless

HiFi speaker system

BY

Pavithra Velusamy Chandramohan

Supervisor: Daniel Arthursson (Xcerion), Fang Wei-Kleiner (Linköping University)

Examiner: Niklas Carlsson (Linköping University) Table of Contents Preface ...... 5

Acknowledgement ...... 6

Abstract ...... 7

List of Abbreviations ...... 8

List of Figures ...... 8

1. Introduction ...... 9

1.1 Background ...... 9

1.2 Objective and Aim ...... 10

1.3 Limitations ...... 10

1.4 Methods and Environment ...... 10

1.5 Contributions ...... 11

2. Theoretical Background ...... 12

2.1 Cloud Computing ...... 12

2.2Platform and Language ...... 12

2.2.1 Oracle VM VirtualBox ...... 12

2.2.2 C++ and XML ...... 12

2.3 Communication Protocols ...... 13

2.3.1 HTTP and HTTPS ...... 13

2.3.2 SOAP - Simple Object Access Protocol ...... 13

2.3.3 API - Application Programming Interface ...... 15

3. Pre Study ...... 16

3.1 Communication with CloudMe ...... 16

3.1.1 Analyzing the API of Sonos system ...... 16

3.1.2 Matching the attributes of the systems ...... 17

3.2 Conclusion of Pre-study ...... 17

4. Design and implementation ...... 18

4.1 Overview ...... 18

4.2 System architecture and Network architecture ...... 18

4.3 Authentication of CloudMe user from Sonos ...... 21

4.4 Processing all Music data from the cloud ...... 22

4.4.1 Getting all the folder ID from the account ...... 23 4.4.2 Processing the shared folders ...... 24

4.4.3 Request for all the Music from the account ...... 24

4.4.4 Requesting the Album Art and matching to the Music file ...... 24

4.4.5 Organizing the Music data for accessibility ...... 25

4.5 Browsing and searching ...... 26

4.5.1 Browsing Hierarchy ...... 26

4.5.2 Search ...... 27

4.6 Playlist ...... 27

4.7 Content Playback ...... 27

5. User Interface navigation ...... 28

5.1 High level orientation and Authentication ...... 28

5.2 Overview of CloudMe menu ...... 28

6. Discussion ...... 32

7. Conclusion ...... 34

8. Future Work ...... 35

Bibliography ...... 36

Appendix ...... 37

Preface

This report describes a Master thesis performed at Xcerion for Integration of CloudMe to the SONOS wireless HiFi speaker system.

CloudMe is a free and open service to store and make all your files available in the cloud. Having all your files in the cloud makes them accessible through your mobile phone and allows you to quickly share them with friends. The way CloudMe has been designed is mainly to handle media files like Music and photos.

Sonos Wireless HiFi speaker system is home audio for the digital age. The main motivation of these speakers is to play different music in each of the speakers in different rooms. The full Sonos system is connected to Internet via Wi-Fi. It provides audio streaming from the local computer, Spotify and online radios.

Integrating CloudMe to Sonos there is no need of a local computer running all the time to get their music but the user can store any kind of music in CloudMe and access it through devices such as iPhone, android and other controllers.

Linköping, Sweden, February 2013

Pavithra Velusamy Chandramohan

Acknowledgement

I would like to thank everyone at Xcerion for helping me with the thesis work. Special thanks to our supervisor Daniel Arthursson who have been of great help when I had problems and also for giving feedback on the work. I would also like to thank Daniel Jakobsson and Erik Bergfur for helping with problems in the project. My gratitude to examiner Niklas Carlsson and supervisor Fang Wei-Kleiner in Linkoping University, who has been examining my quality of work and progress, which helped me to present my work efficiently.

I can never thank enough my Beloved parents Chandramohan Velusamy and Sumathi Chandramohan who have been encouraging me through all the rough times and motivating me.

I also want to thank Mr. Surendraprabu for being my greatest strength and giving enormous support, encouragement and motivation throughout my master program. Last I would like to thank all my friends for making my master studies in sweden an unforgettable sweet memory.

Pavithra Velusamy Chandramohan

Linköping 2013 Abstract

CloudMe is a cloud computing service used for business and home users. CloudMe facilitates the user to store their personal files like music, video, documents and images. The primary focus of this thesis is on music. The personal music files can be uploaded to CloudMe manually or by using CloudMe sync in any order just like in personal computer. CloudMe offers different services to access the cloud from other devices like smart phones, web browser and the home computer.

Sonos wireless HiFi system is a set of Sonos component interconnected with the mesh network with the primary function to play digital audio. The components include subwoofer, speakers and Bridges in order to connect to wireless speakers. Sonos system is connected to internet through Ethernet or via Wi-Fi. Sonos gives access to music libraries stored in computer, free Internet radio stations and additional music services. The controller for the complete system has various choices as iPhone, Android and other specific Sonos controllers.

However, with Sonos, a computer is considered necessary to be running all the time in order to access the personal music files from the personal computer. Combining CloudMe to Sonos allow the requirement of an always-on computer to be removed. Instead the selected personal music files can be stored with the user‟s private CloudMe account, and the music can be accessed from the through the Internet at anytime.

The main objective of this thesis is to build the given APIs from the Sonos that are required in order to access CloudMe from Sonos. Each API handles specific task to present CloudMe through Sonos to the user. For example an API handles user authentication and another API handles the metadata accessing. All the APIs are implemented in the given server from CloudMe. This integration not only provides access roughly the way the music files are stored in the cloud, but also implemented in a way to accesses via categories like artist, albums, genre, composers and also the playlist stored in the cloud. In order to get this menu view of all the music, the metadata of the entire music library from CloudMe is accessed and programmed to differentiate music options in the menu.

Keywords: CloudMe, Sonos, Cloud Storage, cloud computing, CloudMe + Sonos List of Abbreviations

HTTP- Hyper Text Transfer Protocol

HTTPS- Hyper Text Transfer Protocol-Secure

API- Application Programming Interface

URL- Uniform Resource Locator

Xml- eXtensible Markup Language

WSDL- Web Service Description Language

XSD- XML Schema

SOAP- Simple Object Access Protocol

List of Figures

Figure I SOAP Request Message ...... 14

Figure II SOAP Response Message ...... 15

Figure III Network architecture for the Login API ...... 18

Figure IV General Network Architecture for the Metadata API ...... 19

Figure V Network Architecture for Metadata API Browse by folder option ...... 19

Figure VI System Architecture ...... 21

Figure VII CloudMe folder tree ...... 23 1. Introduction

“Music gives a soul to the universe, wings to the mind, flight to the imagination and life to everything.”

Plato

Music has become a great part in our day today life for relaxation. After a busy day music can be energizing to walk around with in home, and to take where ever you go. In this busy world, who would not like to control the music in the tip of their hands? As in the field of information technology, Cloud Computing is a major and ongoing successful field. Cloud computing is mass storage of information in a remote server, which is accessed through Internet that also helps in various use of web services from your desktop, laptop, as well as your mobiles phones and tablets. This thesis considers streaming music from user‟s personal storage in the cloud that is from the CloudMe to Sonos multi room speakers. This integration provided many advantages including shorter start-up time for your favorite music, lower maintenance and is easy to recover in case of any catastrophe.

1.1 Background

Sonos [1] is a Wireless Hi-Fi system that allows streaming of music from the local source as well as from the Internet sources. The speakers can be placed in multiple rooms within the range of Wi-Fi. There are also components available called bridges that are used for the expansion of the range of Wi-Fi, which allows greater range. Sonos system is also provided with a dedicated controller for navigation of the music in Sonos which are called components. Other than the dedicated controller, there are also applications in android, windows and Apple products which can be used as controllers.

CloudMe [2] provides a service for storing and sharing information on a cloud which make a user‟s files available from anywhere, anytime. Besides availability through a web interface this cloud service is also available on a number of devices including iPhone, Android phones and desktop computers. CloudMe allows the user to store music in a similar way to the folder of a personal computer.

CloudMe and Sonos provide a natural match. Sonos enables us to play music form the local music library as their choice. In the difficult case the user always needs to keep a running computer for Sonos to access the music from. But by enabling CloudMe to Sonos there would be no need for a computer that is needed to access the music from, since the music is from the cloud and the speakers can always access the Internet. The Music can also be played from the CloudMe service and also CloudMe has newly introduced play queue which is used to play and create new playlist.

1.2 Objective and Aim

The main objective of this thesis is to make CloudMe available as a streaming music service from any Sonos wireless HiFi system. Today Sonos support services like Spotify and WiMP, but with the addition of CloudMe, all your own private music could also be available through a Sonos player without the need of having a computer turned on. CloudMe is always on and is a much more natural way of accessing your music library on a Sonos player. The Sonos Music API should be used to access and communicate with CloudMe‟s server API‟s. Since Sonos use SOAP / XML [3] Web Services to communicate, the Sonos SOAP calls need to be translated into CloudMe SOAP calls compatible with the CloudMe API.

The main object is to create categories of music menu in the CloudMe services in Sonos and play music from CloudMe user account. The categories include artist, album, and genre, composers, playlist and Browse by folder options.

1.3 Limitations

The project enables navigating through the cloud stored music, with music being categorized based on a number of criteria and individuality, for example, artist or genre. The solution is flexible and allows the user to browse the music stored in the cloud, similar to how it would browse the file stored in the PC. However, there is no functionality to update or create any music from the Sonos to CloudMe. For such changes the user must make modifications in their personal CloudMe account, and will then be able to see these changes in their Sonos menu. This project does not include options to create and save playlist in the CloudMe service. However, the playlist can be created and stored in the Sonos application as long as the location of the music has not been changed in the Personal CloudMe account.

1.4 Methods and Environment

The server was provided in which the entire API should be included. The provided server was in C++, the following API functionalities were carried on with the same language. The

Platform choice to implement was in Ubuntu 12.10. Since the Sonos application does not run in Ubuntu there was a need for virtualization software to include Ubuntu. Ubuntu was installed in an Oracle VM VirtualBox. So that the Sonos application is in Windows XP and the Ubuntu was in the VirtualBox.

1.5 Contributions

This thesis has three important main objectives. First is the network and communication setup. This task includes few steps as the first to establish the communication between the provided server and the CloudMe server, followed by establishing communication between Sonos System and the provided server. All the communication was set up to support the secure networking.

The second task was to design and implement the APIs in C++ and XML. Implementing APIs are apparently the long process in implementation. While building the APIs the APIs of the Sonos were also studied and matched with intense care. The output of the CloudMe service in Sonos was required to implement exactly as the music library in the Sonos. Music library in Sonos contains the locally stored Music from the computer. Those main menu lists will be discussed in detail in the Design and Implementation chapter.

The last task was the content playback, after listing and navigating all the music from CloudMe to Sonos. That was communicated through a specific API and it included a specific secure networking for the cloud music to playback in Sonos. The secure networking of the content playback was carries out according to the CloudMe design. 2. Theoretical Background

2.1 Cloud Computing

Cloud computing [4] is a great evolution of accessing and synchronizing all the personal data from anywhere and anytime. It provides the ability to organize and mine data from an online resource. It is not only for storage backups but also for sharing the data (text, multimedia, , etc.) in a secured connection with your friends instantly.

2.2Platform and Language

2.2.1 Oracle VM VirtualBox

Oracle VM VirtualBox [5] is an X86 virtualization software package and a cross platform virtualization application that extends the capability of existing computer to a multiple operation system. Oracle VM VirtualBox is installed on an existing host as an application, this host application allows additional guest operating systems, also known as a Guest OS, to be loaded and run, each with its own virtual environment. The host operating system is windows XP and the guest operation system also known as Guest OS is installed with Ubuntu.

2.2.2 C++ and XML

C++ is one of the most popular programming languages and is implemented on a wide variety of hardware and operating system platforms. As an efficient compiler to native code, its application domains include systems software, application software, and high performance server and client applications.

Extensible Markup Language [3] is a set of rules for encoding documents in machine- readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all open standards.

The developing language is C++ and XML in Ubuntu. 2.3 Communication Protocols

2.3.1 HTTP and HTTPS

The Hypertext Transfer Protocol is a networking protocol for distributed, collaborative, hypermedia information systems. HTTP is the base of data communication for the World Wide Web. HTTP functions as a request-response protocol in the client-server computing model. The response contains completion status information about the request and may also contain requested content in its message body. HTTPS is basically the use of HTTP enhanced by a security mechanism, which is usually SSL.

2.3.2 SOAP - Simple Object Access Protocol

Except for the network manager a protocol to encapsulate the messages and define them correctly is necessary. The communication between a client and a remote server can be implemented in several different ways, with a few different protocols. One of these protocols is called SOAP and acts as a person asking a question requiring an answer. A SOAP question is built on XML which are structured as several layers upon each other with a structure very similar to an ordinary folder tree, with parents and child nodes. A basic XML structure can be viewed in figure.

For this message to be transferred correctly something more than just this XML structure is required, and there‟s here where SOAP is used. SOAP packages the XML message inside an envelope, very much like an ordinary envelope, includes the headers required by the server, and transports the message between a client and a web service. The headers include information the requesting client and any other information required for the specified request to be transferred to the correct host.

A SOAP envelope can be transported over any protocol, HTTP is one of them and is used in this applications. SOAP is also language and platform independent.

As shown in the Figure the soap message consists of SOAP HTTP Binding, SOAP Envelope, SOAP Header and SOAP Body. There is Soap request and Soap response the Soap response. The HTTP binding SOAP request could be an HTTP POST or an HTTP GET. The HTTP POST is widely used in this thesis. And that contains to headers as content type and content length. The root element of the SOAP message is the Envelope. This element has the xml document of the SOAP message and this element includes name spacing. The header of the SOAP message is optional and it contains authentication information and other credentials. The headers are mostly application specific. The SOAP body contents is the actual message that the end point is expecting and this includes namespace.

POST /InStock HTTP/1.1 Host: www.example.org

Content-Type: application/soap+xml; charset=utf- 8 Content-Length: nnn

xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap- encoding">

IBM

Figure I SOAP Request Message (Example from w3school)

HTTP/1.1 200 OK

Content-Type: application/soap+xml; charset=utf- 8 Content-Length: nnn

xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

34.5

Figure II SOAP Response Message (Example from w3school)

2.3.3 API - Application Programming Interface

An application programming interface is an interface used by software components to communicate with each other [6]. In this case the software components will be Sonos and CloudMe. An API in any software will have certain specifications that decide its own data structure, etc. Most likely the API will be the building blocks of a program and with certain changes and well-designed calls, the programming is made easy. A cloud storage API is nothing but an API that is used to connect the application to a cloud-based storage system, so that a user can send data to it and access and work with data stored in it. 3. Pre Study

In order to start designing and implementing the project there needs to be some analysis and study that should be done in order to proceed ahead. So I started with the study of the server code in which I should merge my methods for the API calls and then the Analysis of the provided Sonos API. After the individual analysis of different system the next important step is to match the attributes and elements. Below is the detailed description of the following three topics

 System description of CloudMe    System description of Sonos    Analyzing given server 

As mentioned before the given server code needs to be fully analyzed to start building the methods for interfacing. The understanding of all classes and functions that was required to build the methods was the next step. This was done step by step by testing and debugging the different function calls. Since Sonos connections are fully secured the server was decoded to accept and respond to the secured connection. This was achieved by installing SSL.

3.1 Communication with CloudMe

Once the analysis of the server and the function calls it was time to test the communication with the CloudMe server with different and required API calls. [7] The first API call was the authentication of the user. For a successful API call there should be perfect and accurate message format that the server should recognize and give back the accurate response. The given code was required to be analyzed for the purpose of constructing the SOAP call. The SOAP request was implemented step by step form the header to body with the elements and attributes needed for the API call. Creating a test account in the CloudMe, the result of the call was successfully received and the methods were ready to be implemented.

3.1.1 Analyzing the API of Sonos system

Provided the Sonos Sample Server Code the study was made flexible to know more about Sonos system and its functionalities. Study of the API of the Sonos systems is very important so that we know which request is expected when a specific action is performed. The Sonos API mainly covered some functional areas like authentication, Browsing and search and the media transport [8]. The API for authentication was researched and was understood that users will be identified by CloudMe providing some specific credentials that can be recognized on the further calls to the server. Browsing is considered as the most important phase since it defines the structure of how CloudMe is presented in Sonos. The search functionality was also studies with the browsing. After the user starts browsing there will be an endpoint where the user will need to play the music, so there was a study on which format the music is accepted in the Sonos that is already there in CloudMe. Thus the study of Sonos API was carried out to start the matching of attributes.

3.1.2 Matching the attributes of the systems

Since both the API handles with Music does not mean that the data structure and the attributes are the same. The attributes of the metadata of the Music is used for browsing and navigation. Matching those attributes and studying how those attributes are handled in both the environment is essential for hierarchical search of the Music.

3.2 Conclusion of Pre-study

The conclusion of the pre-study was that even though some parts needed more investigation a good base was built for the continuing of the thesis work. A few minor questions were still unanswered but with the most important investigations completed the implementation could begin. 4. Design and implementation

4.1 Overview

The design was on the whole done step by step with the implementation. The first design was on track with adding CloudMe in the Music list. That was done with the help of Sonos instructions and was networked to the local IP address. The next step was to authenticate the CloudMe user from the Sonos system and check with the user credentials. Once that system is setup the Browsing and the hierarchical user interface implementation was focused which was the most important idea of this project. Then other functionalities like search, playback content and image which had to be displayed was implemented. These entire requests are handled by the methods created which is the response to the Sonos API. Following is the final system and network architecture to develop the interface.

4.2 System architecture and Network architecture

A new architectural design was structured when this thesis work was started. This thesis work is mainly building the basic six APIs. Those API were SessionId, Metadata, MediaMetadata, MediaURI, Lastupdate, Extendedmetadata, setPlayedSeconds. Each API has there one need of communication to the CloudMe service. Certain API needs only communication to the service if necessary. Later sessions in the Design and implementation parts describes briefly about all these steps. Figure III shows the network architecture according to each API of this thesis.

Figure III Network architecture for the Login API

Certain API request does not need to access the CloudMe services. Example artist information is accessible without a request to CloudMe since we have the information from Login process.Figure IV shows general network architecture for the Metadata API, it shows that certain metadata requests does not need to access the CloudMe services. The server in which the API is built servers those request. In other case, such as in the case of the Browse by folder option, the CloudMe service is accessed and must be included in the network architecturefor the Metadata API. This is illustrated in Figure V.

Figure IV General Network Architecture for the Metadata API (with exception for the Browse by folder option)

Figure V Network Architecture for Metadata API Browse by folder option

The structural representation of getting the metadata from the CloudMe services after while the API for Log is shown below in the Figure VI. The flow chart starts with getting the full folder tree of the user and is queried for mp3 format music files and for images related to the albums and are matched. Then the same similar query formats was used for querying the Playlist from the account. CloudMe services allows a user to share a folder with friends, in that case the folder tree is also shared and cannot be found in the original folder tree. A separate request is put through for accessing that folder tree if the flag is set as shared.

The Metadata API is the vast and the most important API of this thesis. This API is important because of the management of all different categories. Apart from the categories the paging is also a major step. Sonos accepts only hundred entries of music data per request and the following request is issued from Sonos as the user scrolls down .The total number of entries are included in the message Sonos issues request only based on the total entries of music available. All the Music lists are matched according to the id given.

Artist Artist album Album Tracks

Album Album tracks

Composers Composer album Album Tracks

Genre Genre albums Album Tracks

CloudMe

Tracks All Tracks

Playlist List of Playlists Playlist Tracks

Folders (or tracks

if available)

Browse by folders Music Folder

Folders (or tracks Folders (or tracks

if available) if available)

Figure VI System Architecture

4.3 Authentication of CloudMe user from Sonos

The authentication works in two ways in the Sonos interface.

 New CloudMe user: In this case of a new user of the CloudMe the user is directed to a page from the Sonos interface. In that page the user can create a new account with 3 Giga Byte of storage free for all users and more storage is enabled with charges according to the limit. Then the user can upload the Music form their personal computer by using the CloudMe sync, which enables the Music specified in certain folders to upload to CloudMe as in the same order stored in the personal computer. Or the user can choose to upload the Music manually.

Then the process continues same like the existing user.

 Existing CloudMe user: In the case of the existing user, the CloudMe user gets an authentication reply about the credentials they have entered and if these are valid or not when logging in from Sonos. If the credentials are entered accurate the CloudMe replies with a unique session id for the particular user. That session id is used to identify the user in the upcoming request from the Sonos user.

Once the user request is received apart from the authentication part the data about the music is also processed to make the navigation process easier when the CloudMe is browsed from the Sonos. So the authentication may take longer time than the usual authentication process because of the processing of all the data. The data from the cloud is stored in the temporary memory. Since the data stored in the temporary memory is only the metadata about the media, that is music and not the media itself. So there is considerably no issue with the storage. The data is stored and processed according to the request received from Sonos. These steps will be described in detail below.

4.4 Processing all Music data from the cloud

One may wonder why the Music data has to be processed in the temporary memory of the server and why not give a request to CloudMe to access the data every time there is a request from the Sonos. The reason for this is because the User interface is designed in such a way that the user is able to browse according to artist, album, etc. So in that case a music data can be stored anywhere in the user account. So giving the request every time may cost a lot of time for each request.

Processing all the Music data from the cloud is not an easy task. It includes the proper organization of all data to a specific user and accessing those data according to the relevance. This process includes request to access the entire folder id from CloudMe account of a user and followed by the querying those folder id using another API request to access only the data of the Music. There is also a feature in CloudMe that enables the user to share the folders to another user. So the feature of shared music will also be discussed in the following section.

4.4.1 Getting all the folder ID from the account

Initially to get all the Music data we must know where the Music is stored in the cloud. The cloud is not a disorder of all data. There is a specific way that the Music is stored in CloudMe. The music folder is structured in the Documents folder which is in the root folder and then the Music folder in the CloudMe is identified. After the Music folder the user has the flexibility to store as needed like in their desktop. So the Users are highly recommended to store the Music in the Music folder in their account.

By using an API request the folder tree is accessed and the folder id of all the folders is gathered for a specific user account. The folder tree only shows the folder id, the name of the folder id and the accessibility type. The folder tree does not show any information about any files stored or how many files stored. So the folder tree is a tree of the folders present in the user account. Following is a simple example of the folder tree.

Figure VII CloudMe folder tree 4.4.2 Processing the shared folders

As mentioned before CloudMe enables the user to share certain folders or documents to their friends. All the shared files and folders are stored once and the shared users are provided with link of the folder tree and the files.

So if a folder is marked as shared the folder does not enumerate future in the folder tree. There should be a separate request given requesting the folder tree for the specific folder and so. This request can be recursive, since the folder shared may already contain several shared folders inside. Following is a pictorial representation of the shared folders.

4.4.3 Request for all the Music from the account

In this stage all the folder id of the account is retrieved and the next step is to retrieve the data from each of the folder. Since CloudMe enables user to store all types of data, a folder may contain various files like video, music, images, documents and more, the query request sent must request specifically for the music entities. The metadata for music may have various attributes. The CloudMe browsing in Sonos is constructed using these attributes as a backbone. The attributes a Music file possess are, Title, Name, Album, Genre, Composer, Duration, Track, Rate, length, Link to the media, Published date and updated date.

Some music file may contain all the specified attributes and more. An attribute is not limited to only one entry but also to multiple entries. The attributes which are essential are the title and the link to the media. Other attributes are now always varies from where the music is taken.

Note that the music files consist of all the attributes except the image of the music file. The album art will be discussed in the following sections and will be briefed about how the album art is matched to the particular music.

4.4.4 Requesting the Album Art and matching to the Music file

When all the music Meta data is queried all information about a particular Music is retrieved but not the Album Art. Since an album art is an image file and it contains its own Meta data. Storing that image Meta data for all the Music files in the same folder is a repetition and also it consumes more storage. The Album art is mostly stored in the same folder as the Music is stored. One album or a folder containing music files can contain only one album art to be displayed.

So apart from retrieving information about the entire Music meta data in CloudMe the algorithm is designed to retrieve all the images named as “Folder.jpg” and with the use of the folder id present in the meta data of the image, all the music in a particular folder is assigned the same image. The image name will be automatically stored as “Folder.jpg” when the user uploaded the Music to CloudMe or when the user shares the Music files from a friend. The Album Art is not visible in the Sonos music list if the name is changed or if there is no image file in the folder.

All the music in the playlist is compared with the Music file title in the database and the corresponding album art is assigned to the specific Music file. Usually when a music is added to the playlist the image corresponding to that music is not added in the playlist since there are a lot of Music that are accumulated from different albums. So there is no option of getting album art from the data provided in the playlist. Since all the Music in the playlist should already be present in the CloudMe Music folder, the Meta data of the music in playlist is the same as in the Music in the music folder of CloudMe. So by comparing the Meta data the Album Art for the Music in the playlist are associated.

4.4.5 Organizing the Music data for accessibility

As mentioned before the Music Meta data are taken from the cloud and are stored in ordered to filter the information. Once the Meta data is retrieved the artist, album, genre, composer names are pushed back in a vector variable for each type. After the entire music data are retrieved the vector variables are checked for repetitions and are removed. So the name of a specific artist or album does not repeat. When the user clicks the type there should be a flexible way to make sure there is a minimum waiting time to process the specific list from the pile of Meta data. As the list of all artist, album, genre, composers are made available for the users who log in from Sonos, there is also another type called playlist which is performed with some kind of similar methodology, this will be described later in the following section. 4.5 Browsing and searching

4.5.1 Browsing Hierarchy

As we know all request from Sonos are indicated with the specific API (w3school API). For example, when the user logs in the API is different as when the user wants to search for the music. So basically the entire Browsing falls with the same API. Each soap response from the server gives two important attributes by with the repeated request is created. The two important attributes which the message has an id and a title. The title is used to display in the user interface that is what the user wants to see, whereas the id is used to recognize which category the hierarchy falls. The below shown figure will explain how the hierarchy is subjected. The entire Browsing falls in two categories. The first is the category which needs to use the metadata which we collect when the user logs in, so that the list of all the album, artist, etc could be listed in the user interface. The second is the category in which the navigation needs to follow the hierarchy as the way the user stores the music in their CloudMe account, in other words as the user stored the music in the virtual desktop.

We can first see the first category then the following one below.

In the first category of processing the available metadata, the API message is usually represented with the id as mentioned earlier. The id for the entire request is set by the path. For example if the user wants to browse CloudMe ->artist-> Bob Marley-> One love (album),the id is formulated in such a way that the server understands that the user is requesting for the specific album in the artist category. The category is formulated as switch cases as the requests are received.

The following example shows how the id is identified for the exact path and the correct response.

Example Artist, Bob Marley, One Love: In this case Music from the specific artist and an album is requested. After this point the list of music is displayed and that will be the endpoint. When the endpoint, i.e. the music is requested there is another API for the content to playback. 4.5.2 Search

The search option is implemented by letter by letter search, for example if the user searches for B the search option lists Bob, Beethoven, Barbara and so on, then after the user hits Bo the search option lists Bob only. The search options vary mainly three kinds. Those kinds are artist, album and tracks. All searches will only consider listing information from CloudMe if the option in the Sonos is set to CloudMe. Once any option in the list of the search is clicked the control returns to the tree of the actual Music folder or the track. If the search is in artist Eg Bob Marley, the control returns to all the albums in Bob Marley. This Part of the control shift is already present in Sonos.

4.6 Playlist

The playlist is totally carried out with the different request to CloudMe services. The Playlist consists of a separate XML file and the name and document id of the music are listed in that XML file. The Music information from the file of a specific list is taken and is compared with the specific user’s metadata for the album art and other information. In this way the playlist can be listed with the album art for music.

4.7 Content Playback

The Browsing hierarchy always ends with the endpoint as a music file. This part the API is different from that of the Browsing API. This API is used only for getting the URL and the Album art of the Specific Music.

The URL is much secured and changes in a considerable amount of time for the security reasons. And the updates are also carried out with another API. If Sonos finds the URL as invalid, it sends another request for log in to check if the user is correct and changes any URL format according to CloudMe services. 5. User Interface navigation

This section briefly describes about the user interface and navigation for the implemented integration of CloudMe. The processes are discussed step by step and for the deep understanding please refer the figures in the Appendix.

5.1 High level orientation and Authentication

When the Sonos user initiates the system the CloudMe is present in the more music option in the Sonos main list options. On clicking CloudMe there shows the authentication popup, in which a user can go in the link to create a new account. Existing users can skip this step. After creating the account the user needs to enter the login credentials. On checking the credentials the user is verified in CloudMe. If the credentials are correct the Pop up disappears and the CloudMe appears in the Sonos main music list. This is the basic step for a user to authenticate. After setting up this method every time the user starts the Sonos the specific user account is automatically logged in. So this setup is done only once while getting started with CloudMe in Sonos other than when changing to another user.

5.2 Overview of CloudMe menu

As mentioned above the CloudMe menu consists of flexible way of searching the music we wish for. The following section illustrates in detail about the contents found in various options.

 Main Menu: After a successful authentication process the CloudMe appears in the Main Music list. After clicking on CloudMe the following options appear: Artist, Album, Genre, Composer, Playlist, Tracks and Folder. These options let the user to browse the music of their choice. In this option the music cannot be played by clicking Play now. The Music can be listed by other enumerations to the next level since the music is sorted accordingly. There is no album art that is displayed in this option because these options are too generic and the music folders inside the enumeration include numerous numbers of arts to be included.

 Artist: The first menu is the artist in the CloudMe. The navigation hierarchy is designed as the user clicks the artist and there list all the artist of the music. Listing of the artist is not based on the name of the music or any online hierarchy. The listing is only based of the

provided metadata information of the music. If there is no metadata about the artist of the music the music is not listed anywhere in the artist. This option also does not include the album art since there are numerous album created by an artist and each album consists of a specific album art. Once clicking a specific artist name the browser goes to the name of the albums of that artist and another option as “ALL”. The option “ALL” has all the music of the specific artist from all the albums irrespective of the order. Even if there is no metadata information of the album name of the specific artist, the music can be seen in the ALL option. In this option the album art is displayed for each music title which is the end point of this specific enumeration. The next options will be the list of albums created by that specific artist and this included the album art. On each album there is the list of music in that album which is the end point. Since an album consists of one album art for all music, the art is presented in the top of the list in Complete Tracks.

 Albums: On the album menu all the album in the metadata from a user‟s cloud are listed. Since each album might contain its own album art, the art is presented before the name of each album that is listed. Each album navigates to the list of music in that album which is the endpoint of the enumeration. Information of each album can be found in the right hand popup menu which will be further discussed in the extended metadata points below. The menu also has the option to play entire track in that album.

 Genre & Composer: The Genre and the composers options are almost similar to the artist option discussed above. The Genre is the category of artistic composition as in music. This is characterized by the similarities in the form, style or subject. And as mentioned before the enumeration of the end point music is always based on the metadata that is in the Music stored in the CloudMe. This option includes album art only from a specific album enumerates like in artist option. In the composers menu the composers are listed which are found in metadata of the music stored in the user account. Since an album will contain the same composer the composer is enumerated to the albums of the specific artist. And the album consists of the album art for the specific album and this is also similar to the artist and genre option seen above.

 Tracks: The tracks option enumerates to all the tracks in the account regardless of any absence of metadata that is stored in the music file. The track is listed with the title of the music that is visible in the desktop. But in some cases the name of the music provided in the metadata is displayed. Some tracks might contain the second line of the display about the album name. All the tracks can also be played by utilizing the option given above called

“ALL TRACKS”. Each music displays its own album art and the list of music random and is not in alphabetical or in any other order. The music from the same album could be found anywhere in the list of tracks.

 Playlist: The playlist lists all the playlist title which is stored in the CloudMe account. The playlist can be created in the CloudMe account if the user needs the playlist in the Sonos interface. The user cannot create any playlist directly in the CloudMe interface in the Sonos. The songs in the playlist only work if the music are stored in CloudMe account. The tracks in a specific playlist are displayed with the title of the music.

 Browse by Folder: The Folder option in the CloudMe account enumerates exactly the way the music is stored in the user account. The enumeration starts from the user account‟s

Music. The Music is found in the Documents in the user account. So the user is highly recommended to be stored in the Music folder. The music files uploaded before the music folder will not be shown in the interface. This enumeration shows the album art is any album art is found in a folder. As mentioned above the album art should be named as “Folder.jpg”.

The endpoints of this enumeration will always be a music file unless if any folder is empty.

 Extended Metadata: The extended metadata shows the information about the artist or album and also the tracks. This option which includes the information caption is shown in the right side of all the artist, album, genre, composers and as well as for all the music files. The option for artist and album includes an option which shows all the music from the specific artist or album or the users choice. The album art is also specified in this option if present in cloud data.

 Search: The search is enabled by letter by letter search. And the search option is categorized in a way the user can switch in to the album, artist and track options to search for the specific word. From the search options the enumeration is preceded according to the album or artist or track clicked. 6. Discussion

Since all the specifications were given about the server in which the API should be built the Platform selection is considered as given to access the CloudMe service. However the main challenge was the initial setup of the environment in terms of network. Certain API calls from Sonos are secured and some are not secured. For example the initial API call for user authentication should be secured since it consists of user credentials. The request has to go through windows and then to the Virtual Ubuntu. The setup took more time than planned because of the deep analysis of each of the network connections of the systems.

Once that setup was done the API calls from Sonos was easily understandable as mentioned in Sonos guide. However there was a slight misunderstanding on enabling CloudMe icon in Sonos. The problem was once after setting up the authentication calls from Sonos, which was successful. The next request for metadata was not issued from Sonos. After experimenting with numerous options the problem was found that Sonos allows social messaging in one of their options and disabling that option was the solution. According to the perfect procedure of setting up the system was given in Sonos, the request from Sonos was easily predicted. As we know that Cloud Computing is managing and presenting a large mass of user data to the user. There was a lot of redesign which was needed to get an optimized solution. The design needs to fulfill the expectations of the access speed and accuracy. There was a big misconception on how hierarchy of the Music folders falls according to the users. There are numerous numbers of possibilities for how the user downloads their music files. The user can download music from any source, as there are different options as Internet and buying a CD. So metadata of the Music files are not expected to be the same for the same Music downloaded from a different source.

Some users may have their personal music library as artist in the first folder tree and then the albums of that specific artist in the upcoming subfolders. And the other most option is to know all Music files have their own Metadata and the Metadata includes all information about the artist, album and so on. But the final design proposal favored according to the metadata of the Music files. The main limitation in this method is the storage space for the metadata stored locally, however it is not the entire music file so this is considerably low storage space needed.

The metadata does not strictly follow how many attributes a Music file should possess. So in some cases the attributes are considerably more, so according to the advice of supervisor the attributes where cut out for the minimum as two entries. The best example for this situation is the artist field in the set of attributes always tend to have the same artist name but as in different forms.

According to the prior method by assuming the user will upload the Music according to their artist and with albums of the specific artist in the sub folders, does not need any other storage space but it consumes more time for the CloudMe service. That is because the server has to request CloudMe server every time a link is clicked in Sonos in the Browsing hierarchy. The next challenging phase was to playback the Music content. Since this part of the API is quite secured and there was no clear instruction or any predictability. The timeout and other functions like set played seconds was carried out very carefully since it is secured.

Later after all the Metadata API was implemented another challenge was the content playback. Since we know that the URL of the Music file is much secured. So the URL needs a separate authentication when it is set to be played in Sonos. However, there were some possibilities to send the authentication details through the API response and that was time consuming to figure out. The solution was to have a session identification which was newly introduced in CloudMe for identifying every user of CloudMe. The session identification for a particular user is used to identify the specific user and also those random values changes once every given time. Though making it more secured.

Network measurements have also been used to understand many different open and proprietary communication protocols, including both voice [10] and video [11] protocols. Future work could include a deeper analysis of the traffic generated between the application and the cloud.

In this paper we have used CloudMe to support Sonos. Other potential solutions could include hybrid solution that leverage server, cloud, and peer-to-peer resources, such as to minimize the overall delivery costs [12]. While the most cost efficient approach to deliver uninterrupted service to the Sonos clients remains an open problem. It should be noted that some other music services, such as Spotify [13] already take a hybrid approach, leveraging peers to offload the Spotify servers. Another interesting aspect for future work is the energy aspects [14]. For example as we know energy constrain is one of the important thing than many other aspects. So the option of cloud computing in Sonos might give the user more energy saving. And apart from this cloud computing also provides many advantages including shorter start up time. 7. Conclusion

As stated in the introduction the goal of the thesis was to implement API to enable CloudMe to Sonos. The goal was partitioned in to three priority tasks, each of which has been successfully completed. The major steps are discussed below.

The first goal was to setup the test environment that allows all the network and systems aspects to be account for. Although it took the most amount of time and with various disrupted plans it was successfully achieved before the main objective of the implementation was started. The main lessons included a deeper understanding of FastCGI and secured networking (including those of HTTPS). The second main goal was to build the API, and handling the tree of request which has to be managed in a single API, that is the Metadata API which is for the Browsing hierarchy. The third goal was content playback which is at the endpoint of the library hierarchy that included that the user at this point always should be able to play the music file.

The main lesson learnt was on the management of the cloud data. This helped to make a clear view of optimizing the cloud data in a way to present the data to the user as fast as possible. The main focus is how the data stored in the cloud has to be delivered to the users.

So the CloudMe service is successfully included in Sonos and the user can enjoy the Music without any extra resources such as PC, running all the time. Even though the solution has obvious limitation the thesis has met the main three goals of the thesis. After all, who would not love to hear your favorite Music just after entering your home? 8. Future Work

As mentioned in the limitations of the introduction chapter, all the APIs are designed in such a way that the Sonos interface can access only the music present in the CloudMe user account. The same situation is applicable to the playlists. So the future work can be extended to more user interaction from the end point. The APIs can be upgraded to accept the user uploading other music from the local library to the CloudMe account through Sonos. Another work could be the creation and the accessing the playlist that the user creates in the Sonos interface, of course with the music files present only from the CloudMe. The favorite options can be enabled, which includes a bookmark and an option in the menu for the favorite music which a user mentions. In order to optimize the solution one should always consider the time needed to access all the cloud and also the storage optimization techniques. With these two entities in consideration the programming and servicing the cloud data will be much feasible. As discussed in chapter 6 in Discussion topic, there are also many potential optimizations that can be done to make the cloud storage and the delivery mechanism more efficient and less costly. Bibliography

[1] Sonos. [Online]. www.sonos.com

[2] CloudMe. [Online]. http://www.cloudme.com

[3] w3school XML. [Online]. http://www.w3schools.com/xml/

[4] Armburst, Michael; Fox, Armando; Griffith, Rean; Joseph, Anthonyd; Katz, Randy; Konwinsky, Andy; Lee, Gunho; Patterson, David; Zaharia, Matei;, "Communications of the ACM," vol. 53, no. 4, pp. 50-58, Apr 2010.

[5] Oracle VM VirtualBox. [Online]. https://www.virtualbox.org/

[6] w3school API. [Online]. http://www.w3schools.com/soap/soap_example.asp

[7] CloudMe "WebDAV". [Online]. http://www.cloudme.com/en/webdav

[8] MusicPartner Sonos. [Online]. http://www.musicpartners.sonos.com/

[9] wireshark. [Online]. http://www.wireshark.org

[10] Rao, A; Legout, A; Lim, Y-S; Towsley, D; Barakat, C; Dabbous, W, "Network characteristics of video streaming traffic," in Proc. CoNex, Tokyo,Japan, 2011.

[11] S Baset and H Schulzrinne, "An Analysis of the Skype Peer-to-Peer Internet Telephony Protocol," in Proc. IEEE INFOCOM, Apr. 2006.

[12] N Carlsson, G Dan, D Eager, and A Mahanti, "Tradeoffs in Cloud and Peer-assisted Content Delivery Systems," in Proc. IEEE International Conference on Peer-to-Peer Computing (P2P), Tarragona, Spain, Sept 2012.

[13] G Kreitz and F Niemelä, "Spotify--Large Scale, Low Latency, P2P Music-on-Demand Streaming," in Proc. IEEE P2P, Delft, Neatherlands, Sept. 2010.

[14] K Kumar, "Cloud Computing for Mobile Users: Can Offloading Computation Save Energy?," vol. 43, no. 4, pp. 51-56, April 2010. Appendix

CloudMe in More Music: CloudMe service is found in more music option before user

authentication.

Authentication of CloudMe user in Sonos: once the user authenticates with their correct

login the CloudMe is always found in the main menu.

Main Menu in CloudMe: The overview of the main menu of CloudMe.

Album interface enumeration: The album is displayed with the album art for the specific album and the album contains its tracks with a single picture of album art because of repetition.

Artist interface enumeration: Consists of a list of artist name of the music stored in the cloud. If an artist art is specified it‟s found near the artist name. Artist option usually levels down

to the album of that specific artist.

Genre interface enumeration: This option leads to the album of the same Genre type. And also contains an option called “ALL” to play all the tracks in that genre.

Composers interface enumeration: this option works exactly like Genre option seen

above.

Tracks interface: This option contains the entire track from the user account, irrespective of any artist, album or any other criteria. Also contains an option for playing queuing entire list.

Browse by folder interface: This option exactly portraits the way the user stored the tracks in the CloudMe database.

Extended metadata option: This feature enables the user to see more information on a specific artist and leads to the tracks unique for that artist. This option is applicable to album and tracks, in this case only the information in the album and tracks are available and may not be able

to browse according to album or track.

Search option: This search option enables letter by letter search and the search word for

album, artist and the tracks are implemented.