|
|
@ -18,43 +18,49 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package org.libresonic.player.controller; |
|
|
|
package org.libresonic.player.controller; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.LinkedHashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
|
|
|
import org.springframework.web.servlet.mvc.ParameterizableViewController; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.libresonic.player.domain.PodcastChannel; |
|
|
|
import org.libresonic.player.domain.PodcastChannel; |
|
|
|
import org.libresonic.player.domain.PodcastEpisode; |
|
|
|
import org.libresonic.player.domain.PodcastEpisode; |
|
|
|
import org.libresonic.player.service.PodcastService; |
|
|
|
import org.libresonic.player.service.PodcastService; |
|
|
|
import org.libresonic.player.service.SecurityService; |
|
|
|
import org.libresonic.player.service.SecurityService; |
|
|
|
import org.libresonic.player.service.SettingsService; |
|
|
|
import org.libresonic.player.service.SettingsService; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod; |
|
|
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.LinkedHashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Controller for the "Podcast channels" page. |
|
|
|
* Controller for the "Podcast channels" page. |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Sindre Mehus |
|
|
|
* @author Sindre Mehus |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class PodcastChannelsController extends ParameterizableViewController { |
|
|
|
@Controller |
|
|
|
|
|
|
|
@RequestMapping("/podcastChannels") |
|
|
|
|
|
|
|
public class PodcastChannelsController { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
private PodcastService podcastService; |
|
|
|
private PodcastService podcastService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SecurityService securityService; |
|
|
|
private SecurityService securityService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SettingsService settingsService; |
|
|
|
private SettingsService settingsService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@RequestMapping(method = RequestMethod.GET) |
|
|
|
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { |
|
|
|
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
ModelAndView result = super.handleRequestInternal(request, response); |
|
|
|
ModelAndView result = new ModelAndView(); |
|
|
|
result.addObject("model", map); |
|
|
|
result.addObject("model", map); |
|
|
|
|
|
|
|
|
|
|
|
Map<PodcastChannel, List<PodcastEpisode>> channels = new LinkedHashMap<PodcastChannel, List<PodcastEpisode>>(); |
|
|
|
Map<PodcastChannel, List<PodcastEpisode>> channels = new LinkedHashMap<>(); |
|
|
|
Map<Integer, PodcastChannel> channelMap = new HashMap<Integer, PodcastChannel>(); |
|
|
|
Map<Integer, PodcastChannel> channelMap = new HashMap<>(); |
|
|
|
for (PodcastChannel channel : podcastService.getAllChannels()) { |
|
|
|
for (PodcastChannel channel : podcastService.getAllChannels()) { |
|
|
|
channels.put(channel, podcastService.getEpisodes(channel.getId())); |
|
|
|
channels.put(channel, podcastService.getEpisodes(channel.getId())); |
|
|
|
channelMap.put(channel.getId(), channel); |
|
|
|
channelMap.put(channel.getId(), channel); |
|
|
@ -68,15 +74,6 @@ public class PodcastChannelsController extends ParameterizableViewController { |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setPodcastService(PodcastService podcastService) { |
|
|
|
|
|
|
|
this.podcastService = podcastService; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setSecurityService(SecurityService securityService) { |
|
|
|
|
|
|
|
this.securityService = securityService; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setSettingsService(SettingsService settingsService) { |
|
|
|
|
|
|
|
this.settingsService = settingsService; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|