Predominantly an attempt to fix #269, but I've also done a few minor changes (mostly DRY) round the edges.
In ascending order of potential controversy:
The model code now performs the check to see if podcasts are published, so all endpoints depending on the model now only see published podcasts.
The podcast player uses the Go builtin http.NotFound if it 404s, so at least there's an error thrown, even if it's ugly as sin. (I presumed that using the normal URY 404 would be silly - it won't render well in an embed.)
The podcast controller eagerly constructs a model in its constructor, since all of its endpoints depend on having the model around.
I've pulled out 404 handling code from both the not-found and podcasts controllers into one bit of code, which is currently in controllers but can be moved.
I've also pulled out the idea of handling a template using the page context of a controller into a private method of Controller, which might be useful, or it might be overly coupling templates and controllers, comments welcome.
I'd love to do more to improve the error handling here, but I think I need more structured error information from myradio-go.
Predominantly an attempt to fix #269, but I've also done a few minor changes (mostly DRY) round the edges.
In ascending order of potential controversy:
http.NotFound
if it 404s, so at least there's an error thrown, even if it's ugly as sin. (I presumed that using the normal URY 404 would be silly - it won't render well in an embed.)controllers
but can be moved.Controller
, which might be useful, or it might be overly coupling templates and controllers, comments welcome.I'd love to do more to improve the error handling here, but I think I need more structured error information from
myradio-go
.