Fix exception with non-directories in courses dir

Course name parsing isn't robust enough to handle non-directories. I had
assumed that there are only course directories in /courses. Added some
sanity checks to skip files and hidden dirs to course name parsing.
It'll return an empty string if the checks fail.
Skip non-course directories while indexing.

Apparently, it's possible for /courses to contain directories that are
not course related. There is now a CourseCache class that stores the
course id and title. The CourseCache will also check if a course exists
when it's asked to add a course. This should let us skip directories
that aren't course related.