summaryrefslogtreecommitdiff
path: root/music.h
blob: 7f1c8132123432fb3aa3410d1d0f9ec0417d3c4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef MUSIC_H
#define MUSIC_H

#include "http.h"

#include <boost/filesystem.hpp>
#include <vector>
#include <iostream>

namespace fs = boost::filesystem;

class MusicListing {
	public:
		typedef boost::shared_ptr<MusicListing> p;
		fs::path path;
		virtual void render(HTTPRequest& req, HTTPResponse& res) = 0;
};

class MusicTrack : public MusicListing {
	public:
		MusicTrack(const fs::path path);
		virtual void render(HTTPRequest& req, HTTPResponse& res);
};

class MusicDirectory : public MusicListing {
	public:
		typedef std::vector<fs::path> PathListings;
		PathListings directories;
		PathListings tracks;

		MusicDirectory(const fs::path root);
		virtual void render(HTTPRequest& req, HTTPResponse& res);
};

namespace music {
	void init(std::string root);
	MusicListing::p get(const std::string path);
};

#endif