Skip to content

Commit

Permalink
#212 removed PlayerDao
Browse files Browse the repository at this point in the history
  • Loading branch information
kagemomiji committed Oct 8, 2023
1 parent 3ce3e55 commit 5ee6730
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 371 deletions.
201 changes: 0 additions & 201 deletions airsonic-main/src/main/java/org/airsonic/player/dao/PlayerDao.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class Player {
@Enumerated(EnumType.STRING)
private TranscodeScheme transcodeScheme = TranscodeScheme.OFF;

@ManyToMany(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "player_transcoding",
joinColumns = {@JoinColumn(name = "player_id")},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public synchronized Player getPlayer(HttpServletRequest request, HttpServletResp
player = new Player();
player.setLastSeen(Instant.now());
populatePlayer(player, username, request, isStreamRequest);
createPlayer(player);
player = createPlayer(player);
} else if (populatePlayer(player, username, request, isStreamRequest)) {
updatePlayer(player);
}
Expand Down Expand Up @@ -398,8 +398,7 @@ public Player clonePlayer(int playerId) {
if (player.getName() != null) {
clone.setName(player.getName() + " (copy)");
}
createPlayer(clone);
return clone;
return createPlayer(clone);
}


Expand All @@ -408,7 +407,7 @@ public Player clonePlayer(int playerId) {
*
* @param player The player to create.
*/
public void createPlayer(Player player) {
public Player createPlayer(Player player) {

// Set default transcodings.
List<Transcoding> defaultActiveTranscodings = transcodingRepository.findByDefaultActiveTrue();
Expand Down Expand Up @@ -444,6 +443,7 @@ public void createPlayer(Player player) {
asyncWebSocketClient.sendToUser(saved.getUsername(), "/queue/players/created",
ImmutableMap.of("id", saved.getId(), "description", saved.getShortDescription(), "tech", saved.getTechnology()));
}
return saved;
}

/**
Expand All @@ -463,9 +463,7 @@ public Player getGuestPlayer(String remoteAddress) {
player.setIpAddress(remoteAddress);
}
player.setUsername(User.USERNAME_GUEST);
createPlayer(player);

return player;
return createPlayer(player);
}

/**
Expand Down
Loading

0 comments on commit 5ee6730

Please sign in to comment.