diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..cd470a6
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,89 @@
+project(mixcloud CXX)
+cmake_minimum_required(VERSION 2.8.10)
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
+
+# We require g++ 4.9, to avoid ABI breakage with earlier version.
+set(cxx_version_required 4.9)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+ if (NOT CMAKE_CXX_COMPILER_VERSION MATCHES "^${cxx_version_required}")
+ message(FATAL_ERROR "g++ version must be ${cxx_version_required}!")
+ endif()
+endif()
+
+# Set strict and naggy C++ compiler flags, and enable C++11
+add_definitions(
+ -fno-permissive
+ -std=c++11
+ -pedantic
+ -Wall
+ -Wextra
+ -fPIC
+ -DQT_NO_KEYWORDS
+)
+
+include(GNUInstallDirs)
+find_package(PkgConfig)
+
+# We depend on Boost for string trimming
+find_package(
+ Boost
+ REQUIRED
+)
+
+# Search for our dependencies
+pkg_check_modules(
+ SCOPE
+ libunity-scopes>=0.6.0
+ net-cpp>=1.1.0
+ REQUIRED
+)
+
+find_package(Qt5Core REQUIRED)
+include_directories(${Qt5Core_INCLUDE_DIRS})
+
+# Add our dependencies to the include paths
+include_directories(
+ "${CMAKE_SOURCE_DIR}/include"
+ ${Boost_INCLUDE_DIRS}
+ ${SCOPE_INCLUDE_DIRS}
+)
+
+# Do not remove this line, its required for the correct functionality of the Ubuntu-SDK
+set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Tells QtCreator location and name of the manifest file")
+set(UBUNTU_PROJECT_TYPE "Scope" CACHE INTERNAL "Tells QtCreator this is a Scope project")
+
+# Important project paths
+set(CMAKE_INSTALL_PREFIX /)
+set(SCOPE_INSTALL_DIR "/mixcloudscope")
+set(GETTEXT_PACKAGE "mixcloud")
+
+# If we need to refer to the scope's name or package in code, these definitions will help
+add_definitions(-DPACKAGE_NAME="com.ubuntu.developer.boghison.mixcloud")
+add_definitions(-DSCOPE_NAME="com.ubuntu.developer.boghison.mixcloud_mixcloudscope")
+add_definitions(-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
+
+#This command figures out the target architecture and puts it into the manifest file
+execute_process(
+ COMMAND dpkg-architecture -qDEB_HOST_ARCH
+ OUTPUT_VARIABLE CLICK_ARCH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
+
+# Install the click manifest
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION "/")
+install(FILES "mixcloudscope.apparmor" DESTINATION "/")
+
+# Make this file show up in QtCreator
+add_custom_target(hidden_files
+ ALL
+ SOURCES
+ manifest.json.in
+ "mixcloudscope.apparmor"
+)
+
+# Add our main directories
+add_subdirectory(src)
+add_subdirectory(data)
+add_subdirectory(po)
diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user
new file mode 100644
index 0000000..86b00b1
--- /dev/null
+++ b/CMakeLists.txt.user
@@ -0,0 +1,337 @@
+
+
+
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop
+ Desktop
+ {9f526637-a1a3-485f-b2b7-a75f980b8c4f}
+ 0
+ 0
+ 0
+
+ false
+ /home/boghison/Projects/build-MixCloud-Desktop-Default
+
+
+
+
+ false
+ false
+ true
+ Make
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ clean
+
+ true
+ false
+ true
+ Make
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Default
+ Default
+ CMakeProjectManager.CMakeBuildConfiguration
+
+ 1
+
+
+ 0
+ Deploy
+
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ Deploy locally
+
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+
+ mixcloudscope
+ UbuntuProjectManager.UbuntuRunConfiguration.Scopemixcloudscope
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+ 1
+
+
+
+ ProjectExplorer.Project.Target.1
+
+ Ubuntu Device (GCC armhf-ubuntu-sdk-14.10-utopic)
+ Ubuntu Device (GCC armhf-ubuntu-sdk-14.10-utopic)
+ {22bc7e68-9728-4455-b28b-2b16920f71c8}
+ 0
+ 0
+ 0
+
+ false
+ /home/boghison/Projects/build-MixCloud-Ubuntu_Device_GCC_armhf_ubuntu_sdk_14_10_utopic-Default
+
+
+
+
+ all
+
+ false
+ false
+ true
+ Ubuntu SDK Make
+
+ UbuntuProjectManager.UbuntuCMake.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ clean
+
+ true
+ false
+ true
+ Ubuntu SDK Make
+
+ UbuntuProjectManager.UbuntuCMake.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Default
+ Default
+ UbuntuProjectManager.UbuntuCMake.BuildConfiguration
+
+ 1
+
+
+
+ true
+ UbuntuSDK Click build
+
+ UbuntuProjectManager.ClickPackageStep
+ 1
+
+
+ true
+ Upload files to Ubuntu Device
+
+ UbuntuProjectManager.UploadStep
+
+ /home/boghison/Projects/build-MixCloud-Ubuntu_Device_GCC_armhf_ubuntu_sdk_14_10_utopic-Default/com.ubuntu.developer.boghison.mixcloud_0.1_armhf.click
+ /usr/share/qtcreator/ubuntu/scripts/qtc_device_applaunch.py
+
+
+ 127.0.0.1
+ 127.0.0.1
+
+
+ /tmp
+ /tmp
+
+
+ /var/lib/schroot/chroots/click-ubuntu-sdk-14.10-armhf
+ /var/lib/schroot/chroots/click-ubuntu-sdk-14.10-armhf
+
+
+ 2014-11-17T16:46:12
+ 2014-11-17T16:46:12
+
+
+ 2
+ Deploy
+
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ Deploy to Ubuntu Device
+
+ UbuntuProjectManager.DeployConfiguration
+
+ 1
+
+
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ -1
+
+
+
+ false
+ %{buildDir}
+ Custom Executable
+
+ ProjectExplorer.CustomExecutableRunConfiguration
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 2
+
+
+ ProjectExplorer.Project.Updater.EnvironmentId
+ {933be325-2d5b-4358-a163-774b77eeb676}
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 15
+
+
diff --git a/cmake/FindGMock.cmake b/cmake/FindGMock.cmake
new file mode 100644
index 0000000..0fe55b7
--- /dev/null
+++ b/cmake/FindGMock.cmake
@@ -0,0 +1,13 @@
+# Build with system gmock and embedded gtest
+set (GMOCK_INCLUDE_DIRS "/usr/include/gmock/include" CACHE PATH "gmock source include directory")
+set (GMOCK_SOURCE_DIR "/usr/src/gmock" CACHE PATH "gmock source directory")
+set (GTEST_INCLUDE_DIRS "${GMOCK_SOURCE_DIR}/gtest/include" CACHE PATH "gtest source include directory")
+
+add_subdirectory(${GMOCK_SOURCE_DIR} "${CMAKE_CURRENT_BINARY_DIR}/gmock")
+
+set(GTEST_LIBRARIES gtest)
+set(GTEST_MAIN_LIBRARIES gtest_main)
+set(GMOCK_LIBRARIES gmock gmock_main)
+
+set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
+
diff --git a/cmake/FindXGettext.cmake b/cmake/FindXGettext.cmake
new file mode 100644
index 0000000..0ab21a8
--- /dev/null
+++ b/cmake/FindXGettext.cmake
@@ -0,0 +1,131 @@
+# Copyright (C) 2013 Canonical Ltd
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see .
+
+# This package provides macros that wrap the xgettext program.
+#
+# An example of common usage is:
+#
+# set(
+# POT_FILE
+# "${CMAKE_CURRENT_SOURCE_DIR}/${GETTEXT_PACKAGE}.pot"
+# )
+#
+# file(
+# GLOB_RECURSE SRC_FILES
+# RELATIVE ${CMAKE_SOURCE_DIR}
+# ${SOURCE_DIR}/*.cpp
+# ${SOURCE_DIR}/*.c
+# ${SOURCE_DIR}/*.h
+# )
+#
+# xgettext_create_pot_file(
+# ${POT_FILE}
+# CPP
+# QT
+# INPUT ${SOURCES}
+# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+# ADD_COMMENTS "TRANSLATORS"
+# KEYWORDS "_" "N_"
+# PACKAGE_NAME ${GETTEXT_PACKAGE}
+# COPYRIGHT_HOLDER "Canonical Ltd."
+# )
+
+find_package(Gettext REQUIRED)
+
+find_program(XGETTEXT_EXECUTABLE xgettext)
+
+if(XGETTEXT_EXECUTABLE)
+ execute_process(
+ COMMAND ${XGETTEXT_EXECUTABLE} --version
+ OUTPUT_VARIABLE xgettext_version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (xgettext_version MATCHES "^xgettext \\(.*\\) [0-9]")
+ string(
+ REGEX REPLACE "^xgettext \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1"
+ XGETTEXT_VERSION_STRING "${xgettext_version}"
+ )
+ endif()
+ unset(xgettext_version)
+endif()
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+ XGettext
+ REQUIRED_VARS XGETTEXT_EXECUTABLE
+ VERSION_VAR XGETTEXT_VERSION_STRING
+)
+
+function(APPEND_EACH LISTNAME GLUE OUTPUT)
+ set(_tmp_list "")
+ foreach(VAL ${${LISTNAME}})
+ list(APPEND _tmp_list "${GLUE}${VAL}")
+ endforeach(VAL ${${LISTNAME}})
+ set(${OUTPUT} "${_tmp_list}" PARENT_SCOPE)
+endfunction()
+
+function(XGETTEXT_CREATE_POT_FILE _potFile)
+ set(_options ALL QT CPP)
+ set(_oneValueArgs ADD_COMMENTS PACKAGE_NAME COPYRIGHT_HOLDER WORKING_DIRECTORY)
+ set(_multiValueArgs INPUT KEYWORDS)
+
+ cmake_parse_arguments(_ARG "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
+
+ set(_QT "")
+ if(_ARG_QT)
+ set(_QT "--qt")
+ endif()
+
+ set(_CPP "")
+ if(_ARG_CPP)
+ set(_CPP "--c++")
+ endif()
+
+ set(_KEYWORD "")
+ if(_ARG_KEYWORDS)
+ append_each(_ARG_KEYWORDS "--keyword=" _KEYWORD)
+ endif()
+
+ set(_ADD_COMMENTS "")
+ if(_ARG_ADD_COMMENTS)
+ set(_ADD_COMMENTS --add-comments="${_ARG_ADD_COMMENTS}")
+ endif()
+
+ set(_PACKAGE_NAME "")
+ if(_ARG_PACKAGE_NAME)
+ set(_PACKAGE_NAME --package-name="${_ARG_PACKAGE_NAME}")
+ endif()
+
+ set(_COPYRIGHT_HOLDER "")
+ if(_ARG_COPYRIGHT_HOLDER)
+ set(_COPYRIGHT_HOLDER --copyright-holder="${_ARG_COPYRIGHT_HOLDER}")
+ endif()
+
+ add_custom_command(
+ OUTPUT "${_potFile}"
+ COMMAND ${XGETTEXT_EXECUTABLE} --output="${_potFile}" ${_KEYWORD} ${_PACKAGE_NAME} ${_COPYRIGHT_HOLDER} ${_QT} ${_CPP} ${_ADD_COMMENTS} ${_ARG_INPUT}
+ WORKING_DIRECTORY ${_ARG_WORKING_DIRECTORY}
+ )
+
+ _GETTEXT_GET_UNIQUE_TARGET_NAME(_potFile _uniqueTargetName)
+
+ if(_ARG_ALL)
+ add_custom_target(${_uniqueTargetName} ALL DEPENDS ${_potFile})
+ else()
+ add_custom_target(${_uniqueTargetName} DEPENDS ${_potFile})
+ endif()
+
+endfunction()
+
diff --git a/cmake/UseXGettext.cmake b/cmake/UseXGettext.cmake
new file mode 100644
index 0000000..7562d91
--- /dev/null
+++ b/cmake/UseXGettext.cmake
@@ -0,0 +1,99 @@
+# Copyright (C) 2013 Canonical Ltd
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see .
+
+# Example usage:
+#
+# include(UseXGettext)
+#
+# add_translations_directory(${GETTEXT_PACKAGE})
+#
+# add_translations_catalog(
+# GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
+# COPYRIGHT_HOLDER "Canonical Ltd."
+# SOURCE_DIRECTORIES "${CMAKE_SOURCE_DIR}/src"
+# )
+
+cmake_minimum_required(VERSION 2.8.9)
+
+find_package(XGettext REQUIRED)
+
+macro(add_translations_directory GETTEXT_PACKAGE)
+ set(
+ _POT_FILE
+ "${CMAKE_CURRENT_SOURCE_DIR}/${GETTEXT_PACKAGE}.pot"
+ )
+
+ file(
+ GLOB _PO_FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/*.po
+ )
+
+ gettext_create_translations(
+ ${_POT_FILE}
+ ALL
+ ${_PO_FILES}
+ )
+endmacro(add_translations_directory)
+
+macro(add_translations_catalog)
+ set(_oneValueArgs GETTEXT_PACKAGE COPYRIGHT_HOLDER)
+ set(_multiValueArgs SOURCE_DIRECTORIES)
+
+ cmake_parse_arguments(_ARG "" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
+
+ set(_GETTEXT_PACKAGE ${PROJECT})
+ if(_ARG_GETTEXT_PACKAGE)
+ set(_GETTEXT_PACKAGE ${_ARG_GETTEXT_PACKAGE})
+ endif()
+
+ set(
+ _POT_FILE
+ "${CMAKE_CURRENT_SOURCE_DIR}/${_GETTEXT_PACKAGE}.pot"
+ )
+
+ add_custom_target (pot
+ COMMENT “Building translation catalog.”
+ DEPENDS ${_POT_FILE}
+ )
+
+ set(_SOURCES "")
+
+ foreach(DIR ${_ARG_SOURCE_DIRECTORIES})
+ file(
+ GLOB_RECURSE _DIR_SOURCES
+ RELATIVE ${CMAKE_SOURCE_DIR}
+ ${DIR}/*.cpp
+ ${DIR}/*.cc
+ ${DIR}/*.cxx
+ ${DIR}/*.vala
+ ${DIR}/*.c
+ ${DIR}/*.h
+ )
+ set (_SOURCES ${_SOURCES} ${_DIR_SOURCES})
+ endforeach()
+
+ xgettext_create_pot_file(
+ ${_POT_FILE}
+ ALL
+ CPP
+ QT
+ INPUT ${_SOURCES}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ ADD_COMMENTS "TRANSLATORS"
+ KEYWORDS "_" "_:1,2" "N_" "N_:1,2"
+ PACKAGE_NAME ${_GETTEXT_PACKAGE}
+ COPYRIGHT_HOLDER ${_ARG_COPYRIGHT_HOLDER}
+ )
+endmacro()
+
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
new file mode 100644
index 0000000..1996497
--- /dev/null
+++ b/data/CMakeLists.txt
@@ -0,0 +1,22 @@
+configure_file(
+ "com.ubuntu.developer.boghison.mixcloud_mixcloudscope-settings.ini"
+ "${CMAKE_BINARY_DIR}/src/com.ubuntu.developer.boghison.mixcloud_mixcloudscope-settings.ini"
+)
+# Install the scope ini file
+install(
+ FILES
+ "com.ubuntu.developer.boghison.mixcloud_mixcloudscope.ini"
+ "com.ubuntu.developer.boghison.mixcloud_mixcloudscope-settings.ini"
+ DESTINATION ${SCOPE_INSTALL_DIR}
+)
+
+# Install the scope images
+install(
+ FILES
+ "art.png"
+ "logo.svg"
+ "mixcloud.svg"
+ DESTINATION
+ "${SCOPE_INSTALL_DIR}"
+)
+
diff --git a/data/art.png b/data/art.png
new file mode 100644
index 0000000..ecf1cbd
Binary files /dev/null and b/data/art.png differ
diff --git a/data/com.ubuntu.developer.boghison.mixcloud_mixcloudscope-settings.ini b/data/com.ubuntu.developer.boghison.mixcloud_mixcloudscope-settings.ini
new file mode 100644
index 0000000..7d46bf2
--- /dev/null
+++ b/data/com.ubuntu.developer.boghison.mixcloud_mixcloudscope-settings.ini
@@ -0,0 +1,9 @@
+[showNew]
+type = boolean
+defaultValue = true
+displayName = Show New Cloudcasts
+
+[getExtra]
+type = boolean
+defaultValue = false
+displayName = Use double requests to get extra metadata
diff --git a/data/com.ubuntu.developer.boghison.mixcloud_mixcloudscope.ini b/data/com.ubuntu.developer.boghison.mixcloud_mixcloudscope.ini
new file mode 100644
index 0000000..5bd22e6
--- /dev/null
+++ b/data/com.ubuntu.developer.boghison.mixcloud_mixcloudscope.ini
@@ -0,0 +1,13 @@
+[ScopeConfig]
+DisplayName = MixCloud Scope
+Description = This is a MixCloud scope
+Art = art.png
+Author = Firstname Lastname
+Icon = icon.png
+
+[Appearance]
+PageHeader.Logo = logo.svg
+PageHeader.DividerColor = #33475f
+ForegroundColor = #33475f
+PreviewButtonColor = #33475f
+BackgroundColor = #ffffff
diff --git a/data/logo.svg b/data/logo.svg
new file mode 100644
index 0000000..0d665d9
--- /dev/null
+++ b/data/logo.svg
@@ -0,0 +1,59 @@
+
+
+
+
diff --git a/data/mixcloud.svg b/data/mixcloud.svg
new file mode 100644
index 0000000..afe4285
--- /dev/null
+++ b/data/mixcloud.svg
@@ -0,0 +1,34 @@
+
+
diff --git a/data/mixcloud.svg~ b/data/mixcloud.svg~
new file mode 100644
index 0000000..50ec4b6
--- /dev/null
+++ b/data/mixcloud.svg~
@@ -0,0 +1,36 @@
+
+
diff --git a/include/api/client.h b/include/api/client.h
new file mode 100644
index 0000000..3b3eeee
--- /dev/null
+++ b/include/api/client.h
@@ -0,0 +1,118 @@
+#ifndef API_CLIENT_H_
+#define API_CLIENT_H_
+
+#include
+
+#include
+#include
+#include