.idx and .sub subtitle files only work if both are present, but the code was overwriting the first-inserted element to subtitlesByName, as it was keyed by the basename without extension. Make subtitlesByName point to a slice of nodes instead.
This tests the mediaWithResources function in various scenarios.