| 129 | } |
| 130 | |
| 131 | void Transcoder::PruneTranscodeCache(Context& context) { |
| 132 | std::map<time_t, fs::path> sorted; |
| 133 | |
| 134 | iterateTranscodeCache(context, [&sorted](fs::path p) { |
| 135 | sorted[lastWriteTime(p)] = p; |
| 136 | }); |
| 137 | |
| 138 | int maxSize = context.prefs->GetInt( |
| 139 | prefs::transcoder_cache_count.c_str(), |
| 140 | defaults::transcoder_cache_count); |
| 141 | |
| 142 | int extra = (int) sorted.size() - (maxSize - 1); |
| 143 | auto it = sorted.begin(); |
| 144 | while (extra > 0 && it != sorted.end()) { |
| 145 | auto p = it->second; |
| 146 | std::error_code ec; |
| 147 | if (fs::remove(p, ec)) { |
| 148 | --extra; |
| 149 | } |
| 150 | ++it; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | static void getTempAndFinalFilename( |
| 155 | Context& context, |
nothing calls this directly
no test coverage detected