|
|
@ -23,39 +23,42 @@ import org.libresonic.player.domain.MediaFile; |
|
|
|
import org.libresonic.player.domain.PlayQueue; |
|
|
|
import org.libresonic.player.domain.PlayQueue; |
|
|
|
import org.libresonic.player.domain.Player; |
|
|
|
import org.libresonic.player.domain.Player; |
|
|
|
import org.libresonic.player.domain.Share; |
|
|
|
import org.libresonic.player.domain.Share; |
|
|
|
import org.libresonic.player.service.MediaFileService; |
|
|
|
import org.libresonic.player.service.*; |
|
|
|
import org.libresonic.player.service.PlayerService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.libresonic.player.service.PlaylistService; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.libresonic.player.service.SecurityService; |
|
|
|
|
|
|
|
import org.libresonic.player.service.SettingsService; |
|
|
|
|
|
|
|
import org.libresonic.player.service.ShareService; |
|
|
|
|
|
|
|
import org.springframework.web.bind.ServletRequestBindingException; |
|
|
|
import org.springframework.web.bind.ServletRequestBindingException; |
|
|
|
import org.springframework.web.bind.ServletRequestUtils; |
|
|
|
import org.springframework.web.bind.ServletRequestUtils; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod; |
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
import org.springframework.web.servlet.mvc.multiaction.MultiActionController; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.*; |
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Controller for sharing music on Twitter, Facebook etc. |
|
|
|
* Controller for sharing music on Twitter, Facebook etc. |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Sindre Mehus |
|
|
|
* @author Sindre Mehus |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class ShareManagementController extends MultiActionController { |
|
|
|
@Controller |
|
|
|
|
|
|
|
@RequestMapping("/createShare") |
|
|
|
|
|
|
|
public class ShareManagementController { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
private MediaFileService mediaFileService; |
|
|
|
private MediaFileService mediaFileService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SettingsService settingsService; |
|
|
|
private SettingsService settingsService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ShareService shareService; |
|
|
|
private ShareService shareService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private PlayerService playerService; |
|
|
|
private PlayerService playerService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private PlaylistService playlistService; |
|
|
|
private PlaylistService playlistService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SecurityService securityService; |
|
|
|
private SecurityService securityService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(method = RequestMethod.GET) |
|
|
|
public ModelAndView createShare(HttpServletRequest request, HttpServletResponse response) throws Exception { |
|
|
|
public ModelAndView createShare(HttpServletRequest request, HttpServletResponse response) throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
List<MediaFile> files = getMediaFiles(request); |
|
|
|
List<MediaFile> files = getMediaFiles(request); |
|
|
@ -95,7 +98,7 @@ public class ShareManagementController extends MultiActionController { |
|
|
|
String playerId = request.getParameter("player"); |
|
|
|
String playerId = request.getParameter("player"); |
|
|
|
Integer playlistId = ServletRequestUtils.getIntParameter(request, "playlist"); |
|
|
|
Integer playlistId = ServletRequestUtils.getIntParameter(request, "playlist"); |
|
|
|
|
|
|
|
|
|
|
|
List<MediaFile> result = new ArrayList<MediaFile>(); |
|
|
|
List<MediaFile> result = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
if (id != null) { |
|
|
|
if (id != null) { |
|
|
|
MediaFile album = mediaFileService.getMediaFile(id); |
|
|
|
MediaFile album = mediaFileService.getMediaFile(id); |
|
|
@ -122,27 +125,4 @@ public class ShareManagementController extends MultiActionController { |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setMediaFileService(MediaFileService mediaFileService) { |
|
|
|
|
|
|
|
this.mediaFileService = mediaFileService; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setSettingsService(SettingsService settingsService) { |
|
|
|
|
|
|
|
this.settingsService = settingsService; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setShareService(ShareService shareService) { |
|
|
|
|
|
|
|
this.shareService = shareService; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setPlayerService(PlayerService playerService) { |
|
|
|
|
|
|
|
this.playerService = playerService; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setSecurityService(SecurityService securityService) { |
|
|
|
|
|
|
|
this.securityService = securityService; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setPlaylistService(PlaylistService playlistService) { |
|
|
|
|
|
|
|
this.playlistService = playlistService; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |