| 247 | |
| 248 | |
| 249 | std::optional<DefaultSequenceHelper> create_default_seq(const Entry &entry) { |
| 250 | std::cmatch m; |
| 251 | try { |
| 252 | static const std::regex bare_number(R"(()([-]?\d+)())", std::regex::optimize); |
| 253 | static const std::regex number_and_ext(R"(()([-]?\d+)(\.[^.]+))", std::regex::optimize); |
| 254 | static const std::regex body_dot_number_and_double_ext( |
| 255 | R"((.+\.)([-]?\d+)(\.[^.\d]{1,4}\.[^.]{1,3}))", std::regex::optimize); |
| 256 | static const std::regex body_dot_number_and_ext( |
| 257 | R"((.+\.)([-]?\d+)(\.[^.]+))", std::regex::optimize); |
| 258 | static const std::regex body_no_dot_number_and_ext( |
| 259 | R"((.+[^0-9])(\d+)(\.[^.]+))", std::regex::optimize); |
| 260 | |
| 261 | if (std::regex_match(entry.name_.c_str(), m, bare_number) or |
| 262 | std::regex_match(entry.name_.c_str(), m, number_and_ext) or |
| 263 | std::regex_match(entry.name_.c_str(), m, body_dot_number_and_double_ext) or |
| 264 | std::regex_match(entry.name_.c_str(), m, body_dot_number_and_ext) or |
| 265 | std::regex_match(entry.name_.c_str(), m, body_no_dot_number_and_ext)) { |
| 266 | |
| 267 | // skip versions.. |
| 268 | if (ends_with(m[1].str(), "_v")) |
| 269 | return {}; |
| 270 | DefaultSequenceHelper seq; |
| 271 | seq.head_ = escape_percentage(m[1].str()); |
| 272 | seq.tail_ = escape_percentage(m[3].str()); |
| 273 | seq.name_ = seq.head_ + "#" + seq.tail_; |
| 274 | seq.frames_.insert(std::atoi(m[2].str().c_str())); |
| 275 | seq.frame_str_ = m[2].str(); |
| 276 | seq.pad_ = pad_size(m[2].str()); |
| 277 | seq.pad_str_ = pad_spec(seq.pad_); |
| 278 | seq.entries_.push_back(entry); |
| 279 | return seq; |
| 280 | } |
| 281 | |
| 282 | return {}; |
| 283 | } catch (const std::exception &err) { |
| 284 | spdlog::warn("{} {}", __PRETTY_FUNCTION__, err.what()); |
| 285 | } |
| 286 | return {}; |
| 287 | } |
| 288 | |
| 289 | std::vector<Sequence> default_collapse_sequences(const std::vector<Entry> &entries) { |
| 290 | // collapse sequences that are part of a collection. |
no test coverage detected