Remove - and + from ratings before using them in a DCNC name.
authorCarl Hetherington <cth@carlh.net>
Sat, 3 Sep 2022 20:52:19 +0000 (22:52 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 3 Sep 2022 20:52:21 +0000 (22:52 +0200)
I can't find any documentation about what we should do here,
but at least this rule fits what

https://registry-page.isdcf.com/ratings/

does.

src/lib/film.cc
test/isdcf_name_test.cc

index 37720025b8ca5568e8d6f8e157be952d354a7b26..4e133a90dd8e5b59abce153bba33d2d90be43c8f 100644 (file)
@@ -973,7 +973,10 @@ Film::isdcf_name (bool if_created_now) const
                if (_ratings.empty ()) {
                        d += "-NR";
                } else {
-                       d += "-" + _ratings[0].label;
+                       auto label = _ratings[0].label;
+                       boost::erase_all(label, "+");
+                       boost::erase_all(label, "-");
+                       d += "-" + label;
                }
        }
 
index 4d17f704c4507bbe0cfeddeade2b339f4151aee4..d64f45b899cf7c9878df976345e4c4bb1b4c143f 100644 (file)
@@ -96,9 +96,9 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        film->set_interop (false);
        BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_S_DE-fr_US-R_MOS_4K_DI_20140704_PPF_SMPTE_OV");
 
-       /* Test to see that RU ratings like 6+ survive */
+       /* Test to see that RU ratings like 6+ are stripped of their + */
        film->set_ratings({dcp::Rating("RARS", "6+")});
-       BOOST_CHECK_EQUAL (film->dcp_name(false), "MyNiceFilmWith_TLR-2_S_DE-fr_US-6+_MOS_4K_DI_20140704_PPF_SMPTE_OV");
+       BOOST_CHECK_EQUAL (film->dcp_name(false), "MyNiceFilmWith_TLR-2_S_DE-fr_US-6_MOS_4K_DI_20140704_PPF_SMPTE_OV");
        film->set_ratings({dcp::Rating("MPA", "R")});
 
        /* Test interior aspect ratio: shouldn't be shown with trailers */