private PlayerController createNewStationPlayer(byte type, short id) { // voice players are handled as stations but not as such in database if (!Client.database.hasStation(type, id) && type != GlobalConstants.TYPE_VOICE) { return null; } App.logger.d("Creating new player. Type: " + type + " id: " + id, null); PlayerController controller = null; Station station = Client.database.getStation(type, id); ConcurrentHashMap<Short, PlayerController> map = getStationPlayerMap(type); if (map != null) { if (station == null && type == GlobalConstants.TYPE_VOICE) { controller = new VoicePlayer(type, id); } else if (station != null) { controller = new StationPlayer(type, id); } map.put(id, controller); } if (controller != null) { // start the player controller.start(); } else { App.logger.d("Failed to create new player. Type: " + type + " id: " + id, null); } return controller; }
public void playSingleSong(Song song) { if (singleSongPlayers.containsKey(song)) { return; } // TODO: add priority to single songs PlayerController controller = new SingleSongPlayer(song, 1); controller.start(); singleSongPlayers.put(song, controller); }