Skip to content

Commit ac048e2

Browse files
committed
chore: bugfixing resource strings and added max search result
1 parent 9f6ba5e commit ac048e2

22 files changed

Lines changed: 407 additions & 156 deletions

yaacc/src/main/java/de/yaacc/browser/ContentListFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ public void playAllChildsOfParentFrom(DIDLObject item) {
377377
ContentDirectoryBrowseResult result = upnpClient.browseSync(new Position(0, item.getParentID(), upnpClient.getProviderDevice().getIdentity().getUdn().getIdentifierString(), item.getTitle()));
378378
if (result == null || (result.getResult() != null && result.getResult().getItems().isEmpty())) {
379379
if (result != null && result.getResult() != null && !result.getResult().getContainers().isEmpty()) {
380-
play(upnpClient.initializePlayers(upnpClient.toItemList(result.getResult(), 3)));
380+
play(upnpClient.initializePlayers(upnpClient.toItemList(result.getResult())));
381381
} else {
382382
play(upnpClient.initializePlayers(item));
383383
}

yaacc/src/main/java/de/yaacc/upnp/UpnpClient.java

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ public void searchDevices() {
695695
* @return the player
696696
*/
697697
public List<Player> initializePlayers(DIDLObject didlObject) {
698-
return initializePlayers(toItemList(didlObject, 3));
698+
return initializePlayers(toItemList(didlObject));
699699
}
700700

701701
/**
@@ -886,17 +886,18 @@ public List<Player> getCurrentPlayers(AvTransport transport) {
886886
* @param didlContent the content
887887
* @return all items included in the content
888888
**/
889-
public List<Item> toItemList(DIDLContent didlContent, int depth) {
890-
List<Item> items = new ArrayList<>();
889+
public List<Item> toItemList(DIDLContent didlContent) {
890+
891891
if (didlContent == null) {
892-
return items;
892+
return new ArrayList<>();
893893
}
894+
List<Item> items = new ArrayList<>();
894895
items.addAll(didlContent.getItems());
895-
if (depth == 0) {
896-
return items;
897-
}
896+
int itemCount = items.size();
898897
for (Container c : didlContent.getContainers()) {
899-
items.addAll(toItemList(c, depth - 1));
898+
List<Item> containerItems = toItemList(c, itemCount);
899+
itemCount += containerItems.size();
900+
items.addAll(containerItems);
900901
}
901902
return items;
902903
}
@@ -907,14 +908,27 @@ public List<Item> toItemList(DIDLContent didlContent, int depth) {
907908
* @param didlObject the content
908909
* @return the list of cling items
909910
*/
910-
public List<Item> toItemList(DIDLObject didlObject, int depth) {
911+
public List<Item> toItemList(DIDLObject didlObject) {
912+
return toItemList(didlObject, 0);
913+
}
914+
915+
private List<Item> toItemList(DIDLObject didlObject, int currentResultSize) {
916+
if (currentResultSize >= Integer.parseInt(getPreferences().getString(getContext().getString(R.string.settings_browse_max_results_key), "1000"))) {
917+
return new ArrayList<>();
918+
}
911919
List<Item> items = new ArrayList<>();
912-
if (didlObject instanceof Container && depth != 0) {
920+
if (didlObject instanceof Container) {
913921
DIDLContent content = loadContainer((Container) didlObject);
914922
if (content != null) {
915923
items.addAll(content.getItems());
924+
int itemCount = currentResultSize + items.size();
925+
if (itemCount >= Integer.parseInt(getPreferences().getString(getContext().getString(R.string.settings_browse_max_results_key), "1000"))) {
926+
return items;
927+
}
916928
for (Container includedContainer : content.getContainers()) {
917-
items.addAll(toItemList(includedContainer, depth - 1));
929+
List<Item> containerItems = toItemList(includedContainer, itemCount);
930+
itemCount += containerItems.size();
931+
items.addAll(containerItems);
918932
}
919933
}
920934
} else if (didlObject instanceof Item) {

yaacc/src/main/java/de/yaacc/upnp/server/TreeNode.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
*
3+
* Copyright (C) 2025 Tobias Schoene www.yaacc.de
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU General Public License
7+
* as published by the Free Software Foundation; either version 3
8+
* of the License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program; if not, write to the Free Software
17+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18+
*/
119
package de.yaacc.upnp.server;
220

321

yaacc/src/main/java/de/yaacc/upnp/server/TreeNodeManager.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
*
3+
* Copyright (C) 2025 Tobias Schoene www.yaacc.de
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU General Public License
7+
* as published by the Free Software Foundation; either version 3
8+
* of the License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program; if not, write to the Free Software
17+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18+
*/
119
package de.yaacc.upnp.server;
220

321
import java.util.LinkedList;

yaacc/src/main/java/de/yaacc/upnp/server/TreeViewAdapter.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
*
3+
* Copyright (C) 2025 Tobias Schoene www.yaacc.de
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU General Public License
7+
* as published by the Free Software Foundation; either version 3
8+
* of the License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program; if not, write to the Free Software
17+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18+
*/
119
package de.yaacc.upnp.server;
220

321
import android.annotation.SuppressLint;

yaacc/src/main/java/de/yaacc/upnp/server/TreeViewHolder.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
*
3+
* Copyright (C) 2025 Tobias Schoene www.yaacc.de
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU General Public License
7+
* as published by the Free Software Foundation; either version 3
8+
* of the License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program; if not, write to the Free Software
17+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18+
*/
119
package de.yaacc.upnp.server;
220

321

yaacc/src/main/java/de/yaacc/upnp/server/TreeViewHolderFactory.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
*
3+
* Copyright (C) 2025 Tobias Schoene www.yaacc.de
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU General Public License
7+
* as published by the Free Software Foundation; either version 3
8+
* of the License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program; if not, write to the Free Software
17+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18+
*/
119
package de.yaacc.upnp.server;
220

321
import android.view.View;

yaacc/src/main/java/de/yaacc/upnp/server/YaaccUpnpServerControlActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2013 Tobias Schoene www.yaacc.de
2+
* Copyright (C) 2025 Tobias Schoene www.yaacc.de
33
*
44
* This program is free software; you can redistribute it and/or
55
* modify it under the terms of the GNU General Public License

yaacc/src/main/java/de/yaacc/util/FileDownloader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected Void doInBackground(DIDLObject... didlObjects) {
6969
}
7070
}
7171
createNotification(storageDir.getAbsolutePath());
72-
List<Item> items = upnpClient.toItemList(didlObjects[0], 3);
72+
List<Item> items = upnpClient.toItemList(didlObjects[0]);
7373
for (Item item : items) {
7474
PlayableItem playableItem = new PlayableItem(item, 0);
7575
String filename = playableItem.getTitle().replace(" ", "");

yaacc/src/main/res/values-de/setting_strings.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?><!--
22
*
3-
* Copyright (C) 2013 www.yaacc.de
3+
* Copyright (C) 2025 www.yaacc.de
44
*
55
* This program is free software; you can redistribute it and/or
66
* modify it under the terms of the GNU General Public License
@@ -78,6 +78,15 @@
7878
<string name="settings_music_player_shuffle_title">Gemischte Musikabspielung</string>
7979
<string name="settings_music_player_shuffle_on">Musikabspielung gemischt</string>
8080
<string name="settings_music_player_shuffle_off">Musikabspielung geordnet</string>
81+
<string name="settings_browse_chunk_size">Abfragegröße</string>
82+
<string name="settings_browse_chunk_size_summ">Anzahl der abzufragenden Einträge je Anfrage</string>
83+
<string name="settings_category_appearance">Erscheinungsbild</string>
84+
<string name="settings_dark_mode_title">Dunkles Design</string>
85+
<string name="settings_dark_mode_off">Verwende Systemeinstellungen</string>
86+
<string name="settings_dark_mode_on">Dunkles Design aktiv</string>
87+
<string name="settings_log_level">Log level</string>
88+
<string name="settings_browse_max_results_summ">Maximale Größe des Suchergebnisses</string>
89+
<string name="settings_browse_max_results_title">Ergebnismengengröße</string>
8190
<string name="settings_browse_thumbnails_title">Vorschaubilder</string>
8291
<string name="settings_browse_thumbnails_on">Zeige Vorschaubilder</string>
8392
<string name="settings_browse_thumbnails_off">Zeige keine Vorschaubilder</string>
@@ -89,5 +98,4 @@
8998
<string name="settings_browse_swipe_on">Tabwechsel mit Swipe und Touch</string>
9099
<string name="settings_browse_swipe_title">"Swipe-Verhalten "</string>
91100
<string name="settings_local_server_if_filter_names">Ignorierte Interfaces für die IP-Ermittlung</string>
92-
93101
</resources>

0 commit comments

Comments
 (0)