feat(subsonic): add internet radio support

* Initial commit of internet radio support.

* Added first test for internet radio.

* Refactor to prepare for more test cases.

* Added a few more tests. Realized that I was not calling as admin so added ability to mock admin.

* Added more internet radio tests. Added proper JSON unmarshaling for ID.

* More test cases. Fixed some accidental tabs in files.

* Fixed some more tabs.

* lint fixes

* Changed placeholder for homepage URL to fit into box.

* Finished out internet radio test cases. Found a few bad error codes in internet radio AND podcasts (mea culpa).

* Realized that delete via website was not checking properly if id existed. Fixed.

gofmt
This commit is contained in:
brian-doherty
2022-06-21 16:32:25 -05:00
committed by sentriz
parent 2afc63f64a
commit 7ab378accb
14 changed files with 743 additions and 12 deletions

View File

@@ -189,6 +189,9 @@ func setupAdmin(r *mux.Router, ctrl *ctrladmin.Controller) {
routAdmin.Handle("/delete_podcast_do", ctrl.H(ctrl.ServePodcastDeleteDo))
routAdmin.Handle("/download_podcast_do", ctrl.H(ctrl.ServePodcastDownloadDo))
routAdmin.Handle("/update_podcast_do", ctrl.H(ctrl.ServePodcastUpdateDo))
routAdmin.Handle("/add_internet_radio_station_do", ctrl.H(ctrl.ServeInternetRadioStationAddDo))
routAdmin.Handle("/delete_internet_radio_station_do", ctrl.H(ctrl.ServeInternetRadioStationDeleteDo))
routAdmin.Handle("/update_internet_radio_station_do", ctrl.H(ctrl.ServeInternetRadioStationUpdateDo))
// middlewares should be run for not found handler
// https://github.com/gorilla/mux/issues/416
@@ -260,6 +263,12 @@ func setupSubsonic(r *mux.Router, ctrl *ctrlsubsonic.Controller) {
r.Handle("/deletePodcastChannel{_:(?:\\.view)?}", ctrl.H(ctrl.ServeDeletePodcastChannel))
r.Handle("/deletePodcastEpisode{_:(?:\\.view)?}", ctrl.H(ctrl.ServeDeletePodcastEpisode))
// internet radio
r.Handle("/getInternetRadioStations{_:(?:\\.view)?}", ctrl.H(ctrl.ServeGetInternetRadioStations))
r.Handle("/createInternetRadioStation{_:(?:\\.view)?}", ctrl.H(ctrl.ServeCreateInternetRadioStation))
r.Handle("/updateInternetRadioStation{_:(?:\\.view)?}", ctrl.H(ctrl.ServeUpdateInternetRadioStation))
r.Handle("/deleteInternetRadioStation{_:(?:\\.view)?}", ctrl.H(ctrl.ServeDeleteInternetRadioStation))
// middlewares should be run for not found handler
// https://github.com/gorilla/mux/issues/416
notFoundHandler := ctrl.H(ctrl.ServeNotFound)