Controller migration

master
Rémi Cocula 8 years ago
parent 8c81778f5a
commit b8ade50810
  1. 40
      libresonic-main/src/main/java/org/libresonic/player/controller/M3UController.java
  2. 6
      libresonic-main/src/main/resources/libresonic-servlet.xml

@ -19,16 +19,6 @@
*/
package org.libresonic.player.controller;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import org.libresonic.player.domain.MediaFile;
import org.libresonic.player.domain.PlayQueue;
import org.libresonic.player.domain.Player;
@ -36,18 +26,35 @@ import org.libresonic.player.service.PlayerService;
import org.libresonic.player.service.SettingsService;
import org.libresonic.player.service.TranscodingService;
import org.libresonic.player.util.StringUtil;
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.io.IOException;
import java.io.PrintWriter;
import java.util.List;
/**
* Controller which produces the M3U playlist.
*
* @author Sindre Mehus
*/
public class M3UController implements Controller {
@Controller
@RequestMapping("/play.m3u")
public class M3UController {
@Autowired
private PlayerService playerService;
@Autowired
private SettingsService settingsService;
@Autowired
private TranscodingService transcodingService;
@RequestMapping(method = RequestMethod.GET)
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType("audio/x-mpegurl");
response.setCharacterEncoding(StringUtil.ENCODING_UTF8);
@ -115,15 +122,4 @@ public class M3UController implements Controller {
return playQueue.isEmpty() ? null : transcodingService.getSuffix(player, playQueue.getFile(0), null);
}
public void setPlayerService(PlayerService playerService) {
this.playerService = playerService;
}
public void setSettingsService(SettingsService settingsService) {
this.settingsService = settingsService;
}
public void setTranscodingService(TranscodingService transcodingService) {
this.transcodingService = transcodingService;
}
}

@ -15,11 +15,6 @@
<mvc:annotation-driven />
<context:component-scan base-package="org.libresonic.player.controller, org.libresonic.player.validator"/>
<bean id="m3uController" class="org.libresonic.player.controller.M3UController">
<property name="playerService" ref="playerService"/>
<property name="settingsService" ref="settingsService"/>
<property name="transcodingService" ref="transcodingService"/>
</bean>
<bean id="streamController" class="org.libresonic.player.controller.StreamController">
<property name="playerService" ref="playerService"/>
<property name="playlistService" ref="playlistService"/>
@ -126,7 +121,6 @@
<prop key="/wap/download.view">downloadController</prop>
<prop key="/wap/**">wapController</prop>
<prop key="/rest/**">restController</prop>
<prop key="/play.m3u">m3uController</prop>
<prop key="/stream/**">streamController</prop>
<prop key="/hls/**">hlsController</prop>
<prop key="/share/**">externalPlayerController</prop>

Loading…
Cancel
Save