Adding namespace Database

This commit is contained in:
emeric
2014-06-27 16:23:13 +02:00
parent e6c8dd996a
commit 7fd546eb44
24 changed files with 98 additions and 64 deletions
+4 -4
View File
@@ -35,7 +35,7 @@ Grabber::getFromInputFormatContext(const Av::InputFormatContext& input)
std::vector<CoverArt> std::vector<CoverArt>
Grabber::getFromTrack(Track::pointer track) Grabber::getFromTrack(Database::Track::pointer track)
{ {
std::vector<CoverArt> res; std::vector<CoverArt> res;
@@ -57,7 +57,7 @@ Grabber::getFromTrack(Track::pointer track)
} }
std::vector<CoverArt> std::vector<CoverArt>
Grabber::getFromRelease(Release::pointer release) Grabber::getFromRelease(Database::Release::pointer release)
{ {
if (!release) if (!release)
return std::vector<CoverArt>(); return std::vector<CoverArt>();
@@ -66,9 +66,9 @@ Grabber::getFromRelease(Release::pointer release)
// Check if there is an image file in the directory of the release // Check if there is an image file in the directory of the release
// For now, just get the cover art from the first track of the release // For now, just get the cover art from the first track of the release
Wt::Dbo::collection<Track::pointer> tracks (release->getTracks()); Wt::Dbo::collection<Database::Track::pointer> tracks (release->getTracks());
Track::pointer firstTrack; Database::Track::pointer firstTrack;
if (tracks.begin() != tracks.end()) if (tracks.begin() != tracks.end())
firstTrack = *tracks.begin(); firstTrack = *tracks.begin();
+2 -2
View File
@@ -16,8 +16,8 @@ class Grabber
public: public:
static std::vector<CoverArt> getFromInputFormatContext(const Av::InputFormatContext& input); static std::vector<CoverArt> getFromInputFormatContext(const Av::InputFormatContext& input);
static std::vector<CoverArt> getFromTrack(Track::pointer track); static std::vector<CoverArt> getFromTrack(Database::Track::pointer track);
static std::vector<CoverArt> getFromRelease(Release::pointer release); static std::vector<CoverArt> getFromRelease(Database::Release::pointer release);
}; };
} // namespace CoverArt } // namespace CoverArt
+5
View File
@@ -1,5 +1,7 @@
#include "AudioTypes.hpp" #include "AudioTypes.hpp"
namespace Database
{
Artist::Artist(const std::string& name) Artist::Artist(const std::string& name)
: _name(name) : _name(name)
@@ -35,3 +37,6 @@ Artist::getAll(Wt::Dbo::Session& session, int offset, int size)
{ {
return session.find<Artist>().offset(offset).limit(size); return session.find<Artist>().offset(offset).limit(size);
} }
} // namespace Database
+3 -3
View File
@@ -11,12 +11,12 @@
#include <Wt/WDateTime> #include <Wt/WDateTime>
namespace Database {
class Track; class Track;
class Release; class Release;
class Artist; class Artist;
class Artist class Artist
{ {
public: public:
@@ -215,7 +215,7 @@ class Track
Wt::Dbo::collection< Genre::pointer > _genres; // Tracks in the release Wt::Dbo::collection< Genre::pointer > _genres; // Tracks in the release
}; };
} // namespace database
#endif #endif
+3
View File
@@ -10,6 +10,8 @@
#include "transcode/InputMediaFile.hpp" #include "transcode/InputMediaFile.hpp"
namespace Database {
Database::Database(boost::filesystem::path dbPath, MetaData::Parser& parser) Database::Database(boost::filesystem::path dbPath, MetaData::Parser& parser)
: _db(dbPath), : _db(dbPath),
_metadataParser(parser) _metadataParser(parser)
@@ -428,3 +430,4 @@ Database::processVideoFile( const boost::filesystem::path& file)
} }
} }
} // namespace Database
+3
View File
@@ -5,6 +5,8 @@
#include "FileTypes.hpp" #include "FileTypes.hpp"
namespace Database {
class WatchedDirectory { class WatchedDirectory {
public: public:
@@ -64,3 +66,4 @@ class Database
MetaData::Parser& _metadataParser; MetaData::Parser& _metadataParser;
}; };
} // Database
+7 -7
View File
@@ -10,13 +10,13 @@ _path(db),
_dbBackend( db.string() ) _dbBackend( db.string() )
{ {
_session.setConnection(_dbBackend); _session.setConnection(_dbBackend);
_session.mapClass<Genre>("genre"); _session.mapClass<Database::Genre>("genre");
_session.mapClass<Track>("track"); _session.mapClass<Database::Track>("track");
_session.mapClass<Artist>("artist"); _session.mapClass<Database::Artist>("artist");
_session.mapClass<Release>("release"); _session.mapClass<Database::Release>("release");
_session.mapClass<Release>("release"); _session.mapClass<Database::Release>("release");
_session.mapClass<Path>("path"); _session.mapClass<Database::Path>("path");
_session.mapClass<Video>("video"); _session.mapClass<Database::Video>("video");
try { try {
_session.createTables(); _session.createTables();
+3
View File
@@ -12,6 +12,8 @@
#include "VideoTypes.hpp" #include "VideoTypes.hpp"
namespace Database {
class Path class Path
{ {
public: public:
@@ -71,6 +73,7 @@ class Path
}; };
} // namespace Database
#endif #endif
+3
View File
@@ -1,5 +1,6 @@
#include "AudioTypes.hpp" #include "AudioTypes.hpp"
namespace Database {
Genre::Genre() Genre::Genre()
{ {
@@ -44,3 +45,5 @@ Genre::getAll(Wt::Dbo::Session& session, std::size_t offset, std::size_t size)
{ {
return session.find<Genre>().offset(offset).limit(size); return session.find<Genre>().offset(offset).limit(size);
} }
} // namespace Database
+4 -1
View File
@@ -1,10 +1,11 @@
#include "FileTypes.hpp" #include "FileTypes.hpp"
namespace Database {
Path::Path() Path::Path()
{} {}
Path::Path(boost::filesystem::path p) Path::Path(boost::filesystem::path p)
: _filePath (p.string()), : _filePath (p.string()),
_isDirectory( boost::filesystem::is_directory( _filePath ) ) _isDirectory( boost::filesystem::is_directory( _filePath ) )
@@ -100,3 +101,5 @@ Path::getFileName(void) const
else else
return boost::filesystem::path(_filePath).filename().string(); return boost::filesystem::path(_filePath).filename().string();
} }
} // namespace Database
+3
View File
@@ -4,6 +4,8 @@
#include "AudioTypes.hpp" #include "AudioTypes.hpp"
namespace Database {
Release::Release(const std::string& name) Release::Release(const std::string& name)
: _name(name) : _name(name)
{ {
@@ -72,3 +74,4 @@ Release::getDuration(void) const
} }
} // namespace Database
+2 -1
View File
@@ -4,6 +4,7 @@
#include "AudioTypes.hpp" #include "AudioTypes.hpp"
namespace Database {
Track::Track(const boost::filesystem::path& p, Artist::pointer artist, Release::pointer release) Track::Track(const boost::filesystem::path& p, Artist::pointer artist, Release::pointer release)
: :
@@ -127,7 +128,7 @@ Track::getAll(Wt::Dbo::Session& session,
return query; return query;
} }
} // namespace Database
+4
View File
@@ -2,6 +2,8 @@
#include "FileTypes.hpp" #include "FileTypes.hpp"
namespace Database {
Video::Video() Video::Video()
{ {
} }
@@ -16,3 +18,5 @@ Video::create(Wt::Dbo::Session& session, Wt::Dbo::ptr<Path> path)
{ {
return session.add(new Video(path)); return session.add(new Video(path));
} }
} // namespace Video
+3
View File
@@ -10,6 +10,8 @@
#include <Wt/WDateTime> #include <Wt/WDateTime>
namespace Database {
class Path; class Path;
class Video class Video
@@ -54,6 +56,7 @@ class Video
}; // Video }; // Video
} // namespace Database
#endif #endif
+2 -2
View File
@@ -8,8 +8,8 @@ DatabaseRefreshService::DatabaseRefreshService(boost::asio::io_service& ioServic
{ {
// TODO read from the database itself! // TODO read from the database itself!
// Move this code in the database class // Move this code in the database class
_database.watchDirectory( WatchedDirectory("/storage/common/Media/Son/Metal", WatchedDirectory::Audio) ); _database.watchDirectory( Database::WatchedDirectory("/storage/common/Media/Son/Metal", Database::WatchedDirectory::Audio) );
_database.watchDirectory( WatchedDirectory("/storage/common/Media/Video", WatchedDirectory::Video) ); _database.watchDirectory( Database::WatchedDirectory("/storage/common/Media/Video", Database::WatchedDirectory::Video) );
} }
+1 -1
View File
@@ -24,7 +24,7 @@ class DatabaseRefreshService : public Service
boost::thread _thread; boost::thread _thread;
MetaData::AvFormat _metadataParser; MetaData::AvFormat _metadataParser;
Database _database; Database::Database _database; // Todo use handler
}; };
#endif #endif
+21 -17
View File
@@ -105,9 +105,9 @@ AudioCollectionRequestHandler::processGetGenres(const AudioCollectionRequest::Ge
Wt::Dbo::Transaction transaction( _db.getSession() ); Wt::Dbo::Transaction transaction( _db.getSession() );
Wt::Dbo::collection<Genre::pointer> genres = Genre::getAll( _db.getSession(), request.batch_parameter().offset(), static_cast<int>(size)); Wt::Dbo::collection<Database::Genre::pointer> genres = Database::Genre::getAll( _db.getSession(), request.batch_parameter().offset(), static_cast<int>(size));
typedef Wt::Dbo::collection< Genre::pointer > Genres; typedef Wt::Dbo::collection< Database::Genre::pointer > Genres;
for (Genres::const_iterator it = genres.begin(); it != genres.end(); ++it) for (Genres::const_iterator it = genres.begin(); it != genres.end(); ++it)
{ {
@@ -139,9 +139,9 @@ AudioCollectionRequestHandler::processGetArtists(const AudioCollectionRequest::G
Wt::Dbo::Transaction transaction( _db.getSession() ); Wt::Dbo::Transaction transaction( _db.getSession() );
Wt::Dbo::collection<Artist::pointer> artists = Artist::getAll( _db.getSession(), request.batch_parameter().offset(), static_cast<int>(size) ); Wt::Dbo::collection<Database::Artist::pointer> artists = Database::Artist::getAll( _db.getSession(), request.batch_parameter().offset(), static_cast<int>(size) );
typedef Wt::Dbo::collection< Artist::pointer > Artists; typedef Wt::Dbo::collection< Database::Artist::pointer > Artists;
for (Artists::const_iterator it = artists.begin(); it != artists.end(); ++it) for (Artists::const_iterator it = artists.begin(); it != artists.end(); ++it)
{ {
@@ -169,15 +169,15 @@ AudioCollectionRequestHandler::processGetReleases(const AudioCollectionRequest::
size = _maxListReleases; size = _maxListReleases;
size = std::min(size, _maxListReleases); size = std::min(size, _maxListReleases);
std::vector<Artist::id_type> artistIds; std::vector<Database::Artist::id_type> artistIds;
for (int id = 0; id < request.artist_id_size(); ++id) for (int id = 0; id < request.artist_id_size(); ++id)
artistIds.push_back( request.artist_id(id) ); artistIds.push_back( request.artist_id(id) );
Wt::Dbo::Transaction transaction( _db.getSession() ); Wt::Dbo::Transaction transaction( _db.getSession() );
Wt::Dbo::collection<Release::pointer> releases = Release::getAll( _db.getSession(), artistIds, request.batch_parameter().offset(), static_cast<int>(size)); Wt::Dbo::collection<Database::Release::pointer> releases = Database::Release::getAll( _db.getSession(), artistIds, request.batch_parameter().offset(), static_cast<int>(size));
typedef Wt::Dbo::collection< Release::pointer > Releases; typedef Wt::Dbo::collection< Database::Release::pointer > Releases;
for (Releases::const_iterator it = releases.begin(); it != releases.end(); ++it) for (Releases::const_iterator it = releases.begin(); it != releases.end(); ++it)
{ {
@@ -206,25 +206,29 @@ AudioCollectionRequestHandler::processGetTracks(const AudioCollectionRequest::Ge
size = std::min(size, _maxListTracks); size = std::min(size, _maxListTracks);
// Get filters // Get filters
std::vector<Artist::id_type> artistIds; std::vector<Database::Artist::id_type> artistIds;
for (int id = 0; id < request.artist_id_size(); ++id) for (int id = 0; id < request.artist_id_size(); ++id)
artistIds.push_back( request.artist_id(id) ); artistIds.push_back( request.artist_id(id) );
std::vector<Release::id_type> releaseIds; std::vector<Database::Release::id_type> releaseIds;
for (int id = 0; id < request.release_id_size(); ++id) for (int id = 0; id < request.release_id_size(); ++id)
releaseIds.push_back( request.release_id(id) ); releaseIds.push_back( request.release_id(id) );
std::vector<Release::id_type> genreIds; std::vector<Database::Release::id_type> genreIds;
for (int id = 0; id < request.genre_id_size(); ++id) for (int id = 0; id < request.genre_id_size(); ++id)
genreIds.push_back( request.genre_id(id) ); genreIds.push_back( request.genre_id(id) );
Wt::Dbo::Transaction transaction( _db.getSession() ); Wt::Dbo::Transaction transaction( _db.getSession() );
Wt::Dbo::collection<Track::pointer> tracks = Track::getAll( _db.getSession(), Wt::Dbo::collection<Database::Track::pointer> tracks
artistIds, releaseIds, genreIds, = Database::Track::getAll( _db.getSession(),
request.batch_parameter().offset(), static_cast<int>(size)); artistIds,
releaseIds,
genreIds,
request.batch_parameter().offset(),
static_cast<int>(size));
typedef Wt::Dbo::collection< Track::pointer > Tracks; typedef Wt::Dbo::collection< Database::Track::pointer > Tracks;
for (Tracks::const_iterator it = tracks.begin(); it != tracks.end(); ++it) for (Tracks::const_iterator it = tracks.begin(); it != tracks.end(); ++it)
{ {
@@ -241,7 +245,7 @@ AudioCollectionRequestHandler::processGetTracks(const AudioCollectionRequest::Ge
// if (!(*it)->getCreationTime().is_special()) // if (!(*it)->getCreationTime().is_special())
// track->set_release_date( boost::posix_time::to_simple_string((*it)->getCreationTime()) ); // track->set_release_date( boost::posix_time::to_simple_string((*it)->getCreationTime()) );
BOOST_FOREACH(Genre::pointer genre, (*it)->getGenres()) BOOST_FOREACH(Database::Genre::pointer genre, (*it)->getGenres())
track->add_genre_id( genre.id() ); track->add_genre_id( genre.id() );
} }
@@ -265,7 +269,7 @@ AudioCollectionRequestHandler::processGetCoverArt(const AudioCollectionRequest::
Wt::Dbo::Transaction transaction( _db.getSession() ); Wt::Dbo::Transaction transaction( _db.getSession() );
// Get the request release // Get the request release
Release::pointer release = Release::getById( _db.getSession(), request.release_id()); Database::Release::pointer release = Database::Release::getById( _db.getSession(), request.release_id());
std::vector<CoverArt::CoverArt> coverArts = CoverArt::Grabber::getFromRelease(release); std::vector<CoverArt::CoverArt> coverArts = CoverArt::Grabber::getFromRelease(release);
@@ -297,7 +301,7 @@ AudioCollectionRequestHandler::processGetCoverArt(const AudioCollectionRequest::
Wt::Dbo::Transaction transaction( _db.getSession() ); Wt::Dbo::Transaction transaction( _db.getSession() );
// Get the request release // Get the request release
Track::pointer track = Track::getById( _db.getSession(), request.track_id()); Database::Track::pointer track = Database::Track::getById( _db.getSession(), request.track_id());
std::vector<CoverArt::CoverArt> coverArts = CoverArt::Grabber::getFromTrack(track); std::vector<CoverArt::CoverArt> coverArts = CoverArt::Grabber::getFromTrack(track);
+1 -1
View File
@@ -85,7 +85,7 @@ MediaRequestHandler::processAudioPrepare(const MediaRequest::Prepare::Audio& req
Wt::Dbo::Transaction transaction( _db.getSession()); Wt::Dbo::Transaction transaction( _db.getSession());
Track::pointer track = Track::getById( _db.getSession(), request.track_id() ); Database::Track::pointer track = Database::Track::getById( _db.getSession(), request.track_id() );
if (!track) if (!track)
{ {
+10 -11
View File
@@ -19,24 +19,24 @@ int main(void)
std::cout << "Creating objects..." << std::endl; std::cout << "Creating objects..." << std::endl;
assert( Path::getRoots(database.getSession()).empty() ); assert( Database::Path::getRoots(database.getSession()).empty() );
Path::pointer parentPath = database.getSession().add(new Path("/PARENT") ); Database::Path::pointer parentPath = database.getSession().add(new Database::Path("/PARENT") );
assert( Path::getRoots(database.getSession()).size() == 1); assert( Database::Path::getRoots(database.getSession()).size() == 1);
for (std::size_t i = 0; i < 5; ++i) for (std::size_t i = 0; i < 5; ++i)
{ {
std::ostringstream oss; oss << "/PARENT/toto" << i << ".mp4"; std::ostringstream oss; oss << "/PARENT/toto" << i << ".mp4";
Path::pointer childPath = database.getSession().add(new Path( oss.str()) ); Database::Path::pointer childPath = database.getSession().add(new Database::Path( oss.str()) );
{ {
std::ostringstream oss; oss << "/PARENT/toto" << i << "_dir"; std::ostringstream oss; oss << "/PARENT/toto" << i << "_dir";
Path::pointer childDirPath = database.getSession().add(new Path( oss.str()) ); Database::Path::pointer childDirPath = database.getSession().add(new Database::Path( oss.str()) );
for (std::size_t j = 0; j < 6; ++j) { for (std::size_t j = 0; j < 6; ++j) {
std::ostringstream oss2; oss2 << "/PARENT/toto" << i << "_dir/" << j << ".mp4"; std::ostringstream oss2; oss2 << "/PARENT/toto" << i << "_dir/" << j << ".mp4";
Path::pointer childPath2 = database.getSession().add(new Path( oss2.str()) ); Database::Path::pointer childPath2 = database.getSession().add(new Database::Path( oss2.str()) );
childDirPath.modify()->addChild( childPath2 ); childDirPath.modify()->addChild( childPath2 );
} }
@@ -50,10 +50,10 @@ int main(void)
} }
{ {
std::vector<Path::pointer> roots = Path::getRoots(database.getSession()); std::vector<Database::Path::pointer> roots = Database::Path::getRoots(database.getSession());
std::cout << "There are now " << roots.size() << " roots!" << std::endl; std::cout << "There are now " << roots.size() << " roots!" << std::endl;
BOOST_FOREACH(Path::pointer root, roots) BOOST_FOREACH(Database::Path::pointer root, roots)
{ {
std::cout << "ROOT Path = " << root->getPath() << std::endl; std::cout << "ROOT Path = " << root->getPath() << std::endl;
} }
@@ -63,15 +63,14 @@ int main(void)
std::cout << "PRINT objects..." << std::endl; std::cout << "PRINT objects..." << std::endl;
std::vector< Path::pointer > pathes = parentPath->getChilds(); std::vector< Database::Path::pointer > pathes = parentPath->getChilds();
BOOST_FOREACH(Path::pointer path, pathes) BOOST_FOREACH(Database::Path::pointer path, pathes)
{ {
std::cout << "Found a child: " << path->getPath() << std::endl; std::cout << "Found a child: " << path->getPath() << std::endl;
std::cout << "Parent's = " << path->getParent()->getPath() << std::endl; std::cout << "Parent's = " << path->getParent()->getPath() << std::endl;
} }
// make some empty root dirs // make some empty root dirs
transaction.commit(); transaction.commit();
+2 -2
View File
@@ -19,11 +19,11 @@ int main(void)
Wt::Dbo::Transaction transaction(database.getSession()); Wt::Dbo::Transaction transaction(database.getSession());
Wt::Dbo::collection< Track::pointer > tracks (Track::getAll( database.getSession() )); Wt::Dbo::collection< Database::Track::pointer > tracks (Database::Track::getAll( database.getSession() ));
std::cout << "Found " << tracks.size() << " tracks!" << std::endl; std::cout << "Found " << tracks.size() << " tracks!" << std::endl;
BOOST_FOREACH(Track::pointer track, tracks ) { BOOST_FOREACH(Database::Track::pointer track, tracks ) {
assert( !track->getName().empty() ); assert( !track->getName().empty() );
assert( track->getArtist() ); assert( track->getArtist() );
assert( track->getRelease() ); assert( track->getRelease() );
+2 -2
View File
@@ -105,7 +105,7 @@ TrackWidget::handleTrackSelected(void)
ResultType result = _queryModel.resultRow( currentIndex.row()); ResultType result = _queryModel.resultRow( currentIndex.row());
// Get the track part // Get the track part
Wt::Dbo::ptr<Track> track ( result.get<0>() ); Wt::Dbo::ptr<Database::Track> track ( result.get<0>() );
_trackSelected.emit( track->getPath() ); _trackSelected.emit( track->getPath() );
} }
@@ -127,7 +127,7 @@ TrackWidget::selectNextTrack(void)
ResultType result = _queryModel.resultRow( currentIndex.row() + 1 ); ResultType result = _queryModel.resultRow( currentIndex.row() + 1 );
// Get the track part // Get the track part
Wt::Dbo::ptr<Track> track ( result.get<0>() ); Wt::Dbo::ptr<Database::Track> track ( result.get<0>() );
_trackSelected.emit( track->getPath() ); _trackSelected.emit( track->getPath() );
} }
+1 -1
View File
@@ -36,7 +36,7 @@ class TrackWidget : public FilterWidget
DatabaseHandler& _db; DatabaseHandler& _db;
typedef boost::tuple<Track::pointer, Release::pointer, Artist::pointer> ResultType; typedef boost::tuple<Database::Track::pointer, Database::Release::pointer, Database::Artist::pointer> ResultType;
Wt::Dbo::QueryModel< ResultType > _queryModel; Wt::Dbo::QueryModel< ResultType > _queryModel;
Wt::WTableView* _tableView; Wt::WTableView* _tableView;
+8 -8
View File
@@ -22,7 +22,7 @@ VideoDatabaseWidget::VideoDatabaseWidget(DatabaseHandler& db, Wt::WContainerWid
Wt::Dbo::Transaction transaction ( _db.getSession() ); Wt::Dbo::Transaction transaction ( _db.getSession() );
updateView( Path::pointer() ); updateView( Database::Path::pointer() );
_table->addStyleClass("table form-inline"); _table->addStyleClass("table form-inline");
@@ -72,7 +72,7 @@ VideoDatabaseWidget::addVideo(const std::string& name, const boost::posix_time::
void void
VideoDatabaseWidget::updateView(Path::pointer directory) VideoDatabaseWidget::updateView(Database::Path::pointer directory)
{ {
// Clear table from row 1 to end // Clear table from row 1 to end
// while(_table->rowCount() > 2) // while(_table->rowCount() > 2)
@@ -82,7 +82,7 @@ VideoDatabaseWidget::updateView(Path::pointer directory)
addHeader(); addHeader();
std::vector< Path::pointer > pathes; std::vector< Database::Path::pointer > pathes;
if(directory) if(directory)
{ {
pathes = directory->getChilds(); pathes = directory->getChilds();
@@ -90,10 +90,10 @@ VideoDatabaseWidget::updateView(Path::pointer directory)
addDirectory("<Parent>", directory->getParent() ? directory->getParent() ->getPath() : boost::filesystem::path()); addDirectory("<Parent>", directory->getParent() ? directory->getParent() ->getPath() : boost::filesystem::path());
} }
else else
pathes = Path::getRoots(_db.getSession() ); pathes = Database::Path::getRoots(_db.getSession() );
// Add childs // Add childs
BOOST_FOREACH(Path::pointer path, pathes) BOOST_FOREACH(Database::Path::pointer path, pathes)
{ {
std::cout << "Adding path " << path->getPath() << std::endl; std::cout << "Adding path " << path->getPath() << std::endl;
if (path->isDirectory()) if (path->isDirectory())
@@ -111,7 +111,7 @@ VideoDatabaseWidget::handleOpenDirectory(boost::filesystem::path path)
{ {
Wt::Dbo::Transaction transaction ( _db.getSession() ); Wt::Dbo::Transaction transaction ( _db.getSession() );
Path::pointer directory = Path::getByPath(_db.getSession(), path); Database::Path::pointer directory = Database::Path::getByPath(_db.getSession(), path);
updateView(directory); updateView(directory);
} }
@@ -122,8 +122,8 @@ VideoDatabaseWidget::handlePlayVideo(const boost::filesystem::path& videoFilePat
Wt::Dbo::Transaction transaction ( _db.getSession() ); Wt::Dbo::Transaction transaction ( _db.getSession() );
Path::pointer path = Path::getByPath(_db.getSession(), videoFilePath); Database::Path::pointer path = Database::Path::getByPath(_db.getSession(), videoFilePath);
Video::pointer video; Database::Video::pointer video;
if (path) if (path)
video = path->getVideo(); video = path->getVideo();
+1 -1
View File
@@ -20,7 +20,7 @@ class VideoDatabaseWidget : public Wt::WContainerWidget
private: private:
void updateView(Path::pointer directory); void updateView(Database::Path::pointer directory);
void handleOpenDirectory(boost::filesystem::path directory); void handleOpenDirectory(boost::filesystem::path directory);
void handlePlayVideo(const boost::filesystem::path& path); void handlePlayVideo(const boost::filesystem::path& path);