fix tests and send feature support within first api call
This commit is contained in:
@ -67,12 +67,13 @@ func getSettingsFromDB() {
|
||||
sett := settings.LoadSettings()
|
||||
|
||||
type InitialDataTypeResponse struct {
|
||||
DarkMode bool
|
||||
Pasword bool
|
||||
MediacenterName string
|
||||
VideoPath string
|
||||
TVShowPath string
|
||||
TVShowEnabled bool
|
||||
DarkMode bool
|
||||
Pasword bool
|
||||
MediacenterName string
|
||||
VideoPath string
|
||||
TVShowPath string
|
||||
TVShowEnabled bool
|
||||
FullDeleteEnabled bool
|
||||
}
|
||||
|
||||
regexMatchUrl := regexp.MustCompile("^http(|s)://([0-9]){1,3}\\.([0-9]){1,3}\\.([0-9]){1,3}\\.([0-9]){1,3}:[0-9]{1,5}")
|
||||
@ -82,12 +83,13 @@ func getSettingsFromDB() {
|
||||
serverTVShowPath := strings.TrimPrefix(sett.TVShowPath, tvshowurl)
|
||||
|
||||
res := InitialDataTypeResponse{
|
||||
DarkMode: sett.DarkMode,
|
||||
Pasword: sett.Pasword != "-1",
|
||||
MediacenterName: sett.MediacenterName,
|
||||
VideoPath: serverVideoPath,
|
||||
TVShowPath: serverTVShowPath,
|
||||
TVShowEnabled: settings.TVShowsEnabled(),
|
||||
DarkMode: sett.DarkMode,
|
||||
Pasword: sett.Pasword != "-1",
|
||||
MediacenterName: sett.MediacenterName,
|
||||
VideoPath: serverVideoPath,
|
||||
TVShowPath: serverTVShowPath,
|
||||
TVShowEnabled: settings.TVShowsEnabled(),
|
||||
FullDeleteEnabled: settings.VideosDeletable(),
|
||||
}
|
||||
|
||||
str, _ := json.Marshal(res)
|
||||
|
@ -420,6 +420,7 @@ func addToVideoHandlers() {
|
||||
* @apiGroup video
|
||||
*
|
||||
* @apiParam {int} MovieId ID of video
|
||||
* @apiParam {bool} FullyDelete Delete video from disk?
|
||||
*
|
||||
* @apiSuccess {string} result 'success' if successfully or error message if not
|
||||
*/
|
||||
@ -446,6 +447,7 @@ func addToVideoHandlers() {
|
||||
return database.ManualSuccessResponse(err)
|
||||
}
|
||||
|
||||
// only allow deletion of video if cli flag is set, independent of passed api arg
|
||||
if settings.VideosDeletable() && args.FullyDelete {
|
||||
// get physical path of video to delete
|
||||
query = fmt.Sprintf("SELECT movie_url FROM videos WHERE movie_id=%d", args.MovieId)
|
||||
@ -457,7 +459,8 @@ func addToVideoHandlers() {
|
||||
|
||||
err = os.Remove(vidpath)
|
||||
if err != nil {
|
||||
fmt.Printf("unable to delete file: %s\n", vidpath)
|
||||
fmt.Printf("unable to delete file: %s -- %s\n", vidpath, err.Error())
|
||||
return database.ManualSuccessResponse(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user