Skip to content

Commit

Permalink
#318 Changed search results to show folder
Browse files Browse the repository at this point in the history
  • Loading branch information
kagemomiji committed Jun 22, 2024
1 parent b85c8f7 commit 4ebc7a9
Show file tree
Hide file tree
Showing 5 changed files with 330 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with Airsonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2024 (C) Airsonic Authors
Copyright 2016 (C) Airsonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
Expand All @@ -23,11 +24,9 @@
import org.airsonic.player.domain.MediaFile;
import org.airsonic.player.domain.Player;
import org.airsonic.player.domain.User;
import org.apache.commons.lang3.tuple.Pair;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
* Command used in {@link SearchController}.
Expand All @@ -37,10 +36,10 @@
public class SearchCommand {

private String query;
private Map<String, Set<Integer>> artists;
private Map<String, Set<Integer>> artistsFromTag;
private Map<Pair<String, String>, Set<Integer>> albums;
private Map<Pair<String, String>, Set<Integer>> albumsFromTag;
private List<SearchResultArtist> artists = new ArrayList<>();
private List<SearchResultArtist> artistsFromTag = new ArrayList<>();
private List<SearchResultAlbum> albums;
private List<SearchResultAlbum> albumsFromTag;
private List<MediaFile> songs;
private boolean isIndexBeingCreated;
private User user;
Expand All @@ -63,35 +62,35 @@ public void setIndexBeingCreated(boolean indexBeingCreated) {
isIndexBeingCreated = indexBeingCreated;
}

public Map<String, Set<Integer>> getArtists() {
public List<SearchResultArtist> getArtists() {
return artists;
}

public void setArtists(Map<String, Set<Integer>> artists) {
public void setArtists(List<SearchResultArtist> artists) {
this.artists = artists;
}

public Map<String, Set<Integer>> getArtistsFromTag() {
public List<SearchResultArtist> getArtistsFromTag() {
return artistsFromTag;
}

public void setArtistsFromTag(Map<String, Set<Integer>> artistsFromTag) {
public void setArtistsFromTag(List<SearchResultArtist> artistsFromTag) {
this.artistsFromTag = artistsFromTag;
}

public Map<Pair<String, String>, Set<Integer>> getAlbums() {
public List<SearchResultAlbum> getAlbums() {
return albums;
}

public void setAlbums(Map<Pair<String, String>, Set<Integer>> albums) {
public void setAlbums(List<SearchResultAlbum> albums) {
this.albums = albums;
}

public Map<Pair<String, String>, Set<Integer>> getAlbumsFromTag() {
public List<SearchResultAlbum> getAlbumsFromTag() {
return albumsFromTag;
}

public void setAlbumsFromTag(Map<Pair<String, String>, Set<Integer>> albumsFromTag) {
public void setAlbumsFromTag(List<SearchResultAlbum> albumsFromTag) {
this.albumsFromTag = albumsFromTag;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
This file is part of Airsonic.
Airsonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Airsonic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Airsonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2024 (C) Y.Tory
*/
package org.airsonic.player.command;

import org.airsonic.player.domain.MusicFolder;

import java.util.HashSet;
import java.util.Set;

public class SearchResultAlbum {

private String album;

private String artist;

private MusicFolder folder;

private Set<Integer> mediaFileIds = new HashSet<>();

public SearchResultAlbum(String album, String artist, MusicFolder folder) {
this.album = album;
this.artist = artist;
this.folder = folder;
}

public String getAlbum() {
return album;
}

public void setAlbum(String album) {
this.album = album;
}

public String getArtist() {
return artist;
}

public void setArtist(String artist) {
this.artist = artist;
}

public MusicFolder getFolder() {
return folder;
}

public void setFolder(MusicFolder folder) {
this.folder = folder;
}

public Set<Integer> getMediaFileIds() {
return mediaFileIds;
}

public void setMediaFileIds(Set<Integer> mediaFileIds) {
this.mediaFileIds = mediaFileIds;
}

public void addMediaFileId(Integer mediaFileId) {
this.mediaFileIds.add(mediaFileId);
}

public void addMediaFileIds(Set<Integer> mediaFileIds) {
this.mediaFileIds.addAll(mediaFileIds);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
This file is part of Airsonic.
Airsonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Airsonic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Airsonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2024 (C) Y.Tory
*/
package org.airsonic.player.command;

import org.airsonic.player.domain.MusicFolder;

import java.util.HashSet;
import java.util.Set;

public class SearchResultArtist {

private String artist;

private MusicFolder folder;

private Set<Integer> mediaFileIds = new HashSet<>();

public SearchResultArtist(String artist, MusicFolder folder) {
this.artist = artist;
this.folder = folder;
}

public String getArtist() {
return artist;
}

public void setArtist(String artist) {
this.artist = artist;
}

public MusicFolder getFolder() {
return folder;
}

public void setFolder(MusicFolder folder) {
this.folder = folder;
}

public Set<Integer> getMediaFileIds() {
return mediaFileIds;
}

public void setMediaFileIds(Set<Integer> mediaFileIds) {
this.mediaFileIds = mediaFileIds;
}

public void addMediaFileId(Integer mediaFileId) {
this.mediaFileIds.add(mediaFileId);
}

public void addMediaFileIds(Set<Integer> mediaFileIds) {
this.mediaFileIds.addAll(mediaFileIds);
}

}
Loading

0 comments on commit 4ebc7a9

Please sign in to comment.