Put Time types in dcpomatic namespace.
[dcpomatic.git] / src / wx / swaroop_controls.cc
index abf6fc58c87d1be095ed0b683a1ba0252c809cf6..d557d09e9b8fe9190c7d7882fd455ccbcfaa8f2d 100644 (file)
@@ -41,6 +41,7 @@ using std::sort;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
 using boost::optional;
+using namespace dcpomatic;
 
 SwaroopControls::SwaroopControls (wxWindow* parent, shared_ptr<FilmViewer> viewer)
        : Controls (parent, viewer, false)
@@ -125,8 +126,10 @@ SwaroopControls::SwaroopControls (wxWindow* parent, shared_ptr<FilmViewer> viewe
 void
 SwaroopControls::check_restart ()
 {
+       cout << "check_restart called\n";
        FILE* f = fopen_boost (Config::path("position"), "r");
        if (!f) {
+               cout << "could not open position file (" << errno << ")\n";
                return;
        }
 
@@ -135,8 +138,11 @@ SwaroopControls::check_restart ()
        int64_t time;
        fscanf (f, "%63s %d %ld", id, &index, &time);
 
+       cout << "Looking for playlist " << id << " to restart.\n";
+
        for (size_t i = 0; i < _playlists.size(); ++i) {
                if (_playlists[i].id() == id) {
+                       cout << "Found playlist " << id << "\n";
                        select_playlist (i, index);
                        update_current_content ();
                        _viewer->seek (DCPTime(time), false);
@@ -162,6 +168,7 @@ SwaroopControls::viewer_position_changed ()
 
                checked_fwrite (p.c_str(), p.length(), f, Config::path("position"));
 #ifdef DCPOMATIC_LINUX
+               fflush (f);
                fsync (fileno(f));
 #endif
                fclose (f);
@@ -269,7 +276,7 @@ SwaroopControls::log (wxString s)
        wxString ts = std_to_wx(string(buffer)) + N_(": ");
        _log->SetValue(_log->GetValue() + ts + s + "\n");
 
-       optional<boost::filesystem::path> log = Config::instance()->player_log_file();
+       optional<boost::filesystem::path> log = Config::instance()->player_activity_log_file();
        if (!log) {
                return;
        }
@@ -342,7 +349,7 @@ SwaroopControls::get_kdm_from_url (shared_ptr<DCPContent> dcp)
        string url = Config::instance()->kdm_server_url();
        boost::algorithm::replace_all (url, "{CPL}", *dcp->cpl());
        optional<dcp::EncryptedKDM> kdm;
-       if (dcp->cpl() && !get_from_url(url, false, temp)) {
+       if (dcp->cpl() && !get_from_url(url, false, false, temp)) {
                try {
                        kdm = dcp::EncryptedKDM (dcp::file_to_string(temp.file()));
                        if (kdm->cpl_id() != dcp->cpl()) {