Raspberry Pi-Fi Wiki


Other than HTML and Javascript this project is written entirely in Python. This page will provide details of the basic overall structure and how it is split into modules.

Cloud Web Interface

The cloud-based web interface is split into the following modules:

Custom Framework

Custom Framework contains some additions to the webapp2 framework that provides:


The models module contains all of the datastore models that will be used. These models include:

API Handlers

This module provides handlers for each of the API functions. The API will only be used for communication between the Raspberry Pi and the Cloud Service initially but may be developed further in the future. Examples of functions provided by the API include:

Frontend Handlers

This module will handle any requests made on the front-end by a user. As an addition to this, the module will also handle requests from the JavaScript that will be used on the front-end for updating the current status and sending commands to devices.

Settings Handlers

The settings handlers module provides functions for dealing with requests to settings related pages. This includes:

Raspberry Pi Code

Although there are modules that are only executed on either a slave or master device, other modules are shared and used by both. Therefore all of the Raspberry Pi modules will be listed together.

PiSync Launcher

The PiSync Launcher is executed on both the master and slave devices and is used to start the application. It provides the following functionality:

Master & Slave modules

Either the master or slave module is called by the launcher depending on the configuration loaded, the automatically detected device type, or the argument given by the user. These modules provide the following functionality:

Group & Device Enroll modules

These modules handle the enrollment of new devices with the cloud server. They are called by the Launcher if no appropriate configuration is found. The group enroll module is called when a new master device is being set-up and provides the following functionality:

The device enroll module is a remote object hosted on the master device and is called when a new device enters the network. It provides the following:

Player Module

This module consists of three classes for playing audio files (MP3s) on each device. The three classes are the base player, and a master and slave player. The master and slave player are both children on player class, all shared functionality is within the player class while the master and slave player classes add the synchronisation capabilities.

The players are capable of playing lists of audio files provided by the cloud interface and can play these either by themselves or synchronised to the master player resulting (party mode). Standard controls such as play, pause, stop, skip and volume are also provided by these players and can be controlled via the cloud interface

Auto-Mount module

The auto-mount module listens for new storage devices (such as a USB flash drive) being added to the device and will attempt to mount any that are added, making them available to use. This module uses udev to listen to and mount the devices and does not require Superuser rights to do so. The devices mounted by Automount have an ID generated using the serial number of the drive and each partition number. The module then calls a 'callback function', provided during setup, with the ID number.

Music Scan Module

The music scan module is used to recursively scan a directory (usually a storage device) for music. It provides the following functionality: