Skip to content

Commit

Permalink
openSuSE: Fix test and inits
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlStraussberger committed Dec 2, 2022
1 parent 6053b92 commit db59373
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
15 changes: 10 additions & 5 deletions doc/config-import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -668,11 +668,11 @@ You can set up your correct fanart file by yourself, if no image is embedded in

::

<container location="image" parentCount="2" minDepth="2"/>
<container location="images" parentCount="2" minDepth="2"/>

* Optional

Set up container images. Drop your artists' images or logos for default containers here and they are displayed as thumbnail when browsing with a compatible client.
Set up container images. The fanart of a media file is added automatically as a thumbnail to the container (e.g. the album container).

::

Expand All @@ -681,23 +681,28 @@ You can set up your correct fanart file by yourself, if no image is embedded in
* Optional

Path to the directory containing the images to load. Relative paths are assumed to be under the server's home.
If the image is not found in that location, it is also searched in the physical folder itself
Drop your artists' images or logos for default containers here and they are displayed as thumbnail when browsing with a compatible client.
If the image is not found in that location, it is also searched in the physical folder itself.

::

parentCount="..."

* Optional

Number of level which the fanart of a media file can be propagated upwards.
This setting allows to increase the number of levels which the fanart of a media file can be propagated upwards (examples refer to basic layout /Root/Audio/Artist/Album/song).
A value of 1 adds the fanart only to the direct parent container when a media file is added (e.g. the Album container).
A value of 2 means you propagate that image to the parent container as well (e.g. the Artist container).
A value of 0 blocks propagation completely.

::

minDepth="..."

* Optional

Minimum number of path elements for container using fanart from media files.
Depending on the virtual layout propagating thumbnails can reach containers like Video or Audio. This settings forces a minimal depth for propagation to apply.
It is setting the minimum number of path elements for container using fanart from media files (e.g. /Root/Audio/Artist has level 3 so the image can be set).


``add-file``
Expand Down
23 changes: 17 additions & 6 deletions src/util/grb_net.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,33 @@ std::string GrbNet::getHostName()
return hostName;

auto addr = reinterpret_cast<const struct sockaddr*>(&sockAddr);
char hoststr[NI_MAXHOST];
char portstr[NI_MAXSERV];
char hoststr[NI_MAXHOST] = "";
char portstr[NI_MAXSERV] = "";
int len = addr->sa_family == AF_INET6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in);
int ret = getnameinfo(addr, len, hoststr, sizeof(hoststr), portstr, sizeof(portstr), NI_NOFQDN);
if (ret != 0) {
log_debug("could not determine getnameinfo: {}", std::strerror(errno));
log_warning("Could not determine getnameinfo: {}", std::strerror(errno));
hoststr[0] = '\0';
}
hostName = hoststr;
if (hostName.empty()) {
ret = getnameinfo(addr, len, hoststr, sizeof(hoststr), portstr, sizeof(portstr), NI_NUMERICHOST);
if (ret != 0) {
log_warning("Could not determine getnameinfo: {}", std::strerror(errno));
hoststr[0] = '\0';
return hostName;
}
hostName = hoststr;
}

return hoststr;
}

std::string GrbNet::getNameInfo(bool withPort) const
{
auto addr = reinterpret_cast<const struct sockaddr*>(&sockAddr);
char hoststr[NI_MAXHOST];
char portstr[NI_MAXSERV];
char hoststr[NI_MAXHOST] = "";
char portstr[NI_MAXSERV] = "";
int len = addr->sa_family == AF_INET6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in);
int ret = getnameinfo(addr, len, hoststr, sizeof(hoststr), portstr, sizeof(portstr), NI_NUMERICHOST | NI_NUMERICSERV);
if (ret != 0) {
Expand All @@ -181,7 +192,7 @@ std::string GrbNet::ipToInterface(std::string_view ip)

struct ifaddrs* ifaddr;
int family, s;
char host[NI_MAXHOST];
char host[NI_MAXHOST] = "";

if (getifaddrs(&ifaddr) == -1) {
log_error("Could not getifaddrs: {}", std::strerror(errno));
Expand Down
2 changes: 1 addition & 1 deletion test/core/test_searchhandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ TEST_F(ParserTest, SortCriteriaError)

TEST_F(ParserTest, SortTrackNumber)
{
EXPECT_EQ(OTN, "unknown");
EXPECT_TRUE(OTN == "unknown" || otn == "upnp:originalTrackNumber");
EXPECT_EQ(otn, "upnp:originalTrackNumber");
EXPECT_EQ(MetadataHandler::getMetaFieldName(M_TRACKNUMBER), "upnp:originalTrackNumber");
EXPECT_TRUE(executeSortParserTest("+upnp:originalTrackNumber",
Expand Down

0 comments on commit db59373

Please sign in to comment.