summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-12-08 16:45:55 +0100
committerCarl Hetherington <cth@carlh.net>2023-12-09 16:40:56 +0100
commit3c5bd6d80f4f7b535cfe4630136f1f561d6427e4 (patch)
treee89856d5d68ee21b2f56c71471d2b135fb195f09 /src/lib
parentd7cb4dacab2337cced184f212bfe5bdcb5049d58 (diff)
Don't scan content if we don't need to (#2661).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/hints.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lib/hints.cc b/src/lib/hints.cc
index 55342a8d0..7537317d4 100644
--- a/src/lib/hints.cc
+++ b/src/lib/hints.cc
@@ -374,8 +374,27 @@ Hints::scan_content(shared_ptr<const Film> film)
{
auto const check_loudness_done = check_loudness();
- if (check_loudness_done) {
+ auto content = film->playlist()->content();
+ auto iter = std::find_if(content.begin(), content.end(), [](shared_ptr<const Content> content) {
+ auto text_iter = std::find_if(content->text.begin(), content->text.end(), [](shared_ptr<const TextContent> text) {
+ return text->use();
+ });
+ return text_iter != content->text.end();
+ });
+
+ auto const have_text = iter != content.end();
+
+ if (check_loudness_done && !have_text) {
+ /* We don't need to check loudness, and we don't have any active text to check,
+ * so a scan of the content is pointless.
+ */
+ return;
+ }
+
+ if (check_loudness_done && have_text) {
emit (bind(boost::ref(Progress), _("Examining subtitles and closed captions")));
+ } else if (!check_loudness_done && !have_text) {
+ emit (bind(boost::ref(Progress), _("Examining audio")));
} else {
emit (bind(boost::ref(Progress), _("Examining audio, subtitles and closed captions")));
}