+ job.reset (new AnalyseAudioJob (film, playlist, from_zero));
+ connection = job->Finished.connect (ready);
+ _jobs.push_back (job);
+ _empty_condition.notify_all ();
+ }
+
+ emit (boost::bind (boost::ref (JobAdded), weak_ptr<Job> (job)));
+}
+
+
+void
+JobManager::analyse_subtitles (
+ shared_ptr<const Film> film,
+ shared_ptr<Content> content,
+ boost::signals2::connection& connection,
+ function<void()> ready
+ )
+{
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+
+ BOOST_FOREACH (shared_ptr<Job> i, _jobs) {
+ shared_ptr<AnalyseSubtitlesJob> a = dynamic_pointer_cast<AnalyseSubtitlesJob> (i);
+ if (a && a->path() == film->subtitle_analysis_path(content)) {
+ i->when_finished (connection, ready);
+ return;
+ }
+ }
+ }
+
+ shared_ptr<AnalyseSubtitlesJob> job;
+
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+
+ job.reset (new AnalyseSubtitlesJob(film, content));