|
|
@ -64,7 +64,12 @@ public class MusicFolderSettingsController { |
|
|
|
private MediaFileDao mediaFileDao; |
|
|
|
private MediaFileDao mediaFileDao; |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(method = RequestMethod.GET) |
|
|
|
@RequestMapping(method = RequestMethod.GET) |
|
|
|
protected String formBackingObject(@RequestParam(value = "scanNow",required = false) String scanNow, |
|
|
|
protected String displayForm() throws Exception { |
|
|
|
|
|
|
|
return "musicFolderSettings"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ModelAttribute |
|
|
|
|
|
|
|
protected void formBackingObject(@RequestParam(value = "scanNow",required = false) String scanNow, |
|
|
|
@RequestParam(value = "expunge",required = false) String expunge, |
|
|
|
@RequestParam(value = "expunge",required = false) String expunge, |
|
|
|
@RequestParam(value = "reload",required = false) String reload, |
|
|
|
@RequestParam(value = "reload",required = false) String reload, |
|
|
|
Model model) throws Exception { |
|
|
|
Model model) throws Exception { |
|
|
@ -88,9 +93,9 @@ public class MusicFolderSettingsController { |
|
|
|
command.setReload(reload != null || scanNow != null); |
|
|
|
command.setReload(reload != null || scanNow != null); |
|
|
|
|
|
|
|
|
|
|
|
model.addAttribute("command",command); |
|
|
|
model.addAttribute("command",command); |
|
|
|
return "musicFolderSettings"; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void expunge() { |
|
|
|
private void expunge() { |
|
|
|
artistDao.expunge(); |
|
|
|
artistDao.expunge(); |
|
|
|
albumDao.expunge(); |
|
|
|
albumDao.expunge(); |
|
|
@ -106,9 +111,8 @@ public class MusicFolderSettingsController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(method = RequestMethod.POST) |
|
|
|
@RequestMapping(method = RequestMethod.POST) |
|
|
|
protected String onSubmit(@ModelAttribute MusicFolderSettingsCommand command, Model model) throws Exception { |
|
|
|
protected String onSubmit(@ModelAttribute("command") MusicFolderSettingsCommand command, Model model) throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
if (command.getMusicFolders() != null) { |
|
|
|
|
|
|
|
for (MusicFolderSettingsCommand.MusicFolderInfo musicFolderInfo : command.getMusicFolders()) { |
|
|
|
for (MusicFolderSettingsCommand.MusicFolderInfo musicFolderInfo : command.getMusicFolders()) { |
|
|
|
if (musicFolderInfo.isDelete()) { |
|
|
|
if (musicFolderInfo.isDelete()) { |
|
|
|
settingsService.deleteMusicFolder(musicFolderInfo.getId()); |
|
|
|
settingsService.deleteMusicFolder(musicFolderInfo.getId()); |
|
|
@ -119,7 +123,6 @@ public class MusicFolderSettingsController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MusicFolder newMusicFolder = command.getNewMusicFolder().toMusicFolder(); |
|
|
|
MusicFolder newMusicFolder = command.getNewMusicFolder().toMusicFolder(); |
|
|
|
if (newMusicFolder != null) { |
|
|
|
if (newMusicFolder != null) { |
|
|
@ -133,7 +136,6 @@ public class MusicFolderSettingsController { |
|
|
|
settingsService.save(); |
|
|
|
settingsService.save(); |
|
|
|
|
|
|
|
|
|
|
|
mediaScannerService.schedule(); |
|
|
|
mediaScannerService.schedule(); |
|
|
|
model.addAttribute("command",command); |
|
|
|
|
|
|
|
return "redirect:musicFolderSettings.view"; |
|
|
|
return "redirect:musicFolderSettings.view"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|