1 |
douglas |
475 |
// Media File |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#include "MediaFile.hpp" |
8 |
douglas |
476 |
|
9 |
douglas |
489 |
#include <menes-dbi/resultset.hpp> |
10 |
|
|
|
11 |
douglas |
485 |
MediaFile::MediaFile(_H<dbi::Connection>& connection, const api::Path& path) : connection(connection), path(path) |
12 |
douglas |
476 |
{ |
13 |
douglas |
488 |
_H<dbi::ResultSet> info(connection->Parse(_B("SELECT artist, title, album, genre FROM files WHERE path = ?"))->Execute(path.GetPath())); |
14 |
|
|
|
15 |
|
|
if (info->MoveNext()) |
16 |
|
|
{ |
17 |
|
|
artist = info->GetString(_B("artist")); |
18 |
|
|
title = info->GetString(_B("title")); |
19 |
|
|
album = info->GetString(_B("album")); |
20 |
|
|
genre = info->GetString(_B("genre")); |
21 |
|
|
} |
22 |
|
|
else |
23 |
|
|
throw; |
24 |
douglas |
476 |
} |
25 |
douglas |
478 |
|
26 |
douglas |
485 |
MediaFile::MediaFile(_H<dbi::Connection>& connection, const api::Path& path, const ext::String& artist, const ext::String& title, const ext::String& album, const ext::String& genre) : connection(connection), path(path), artist(artist), title(title), album(album), genre(genre) |
27 |
douglas |
478 |
{ |
28 |
|
|
// XXX: implement |
29 |
|
|
} |