Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for reported problem on some SONY TV's while content browsing / searching #2607

Merged

Conversation

ik666
Copy link
Contributor

@ik666 ik666 commented Aug 16, 2021

This might solve the issue reported in: #2376. I hope the TV doesn't make consecutive search requests.

https://www.universalmediaserver.com/forum/viewtopic.php?f=9&t=14807&p=44349#p44349

@SubJunk
Copy link
Member

SubJunk commented Aug 16, 2021

Thanks!

@valib
Copy link
Contributor

valib commented Aug 16, 2021

@ik666 can you check my changes if it is working for you?

"object.container.person.musicArtist"), TYPE_PLAYLIST("PLAYLIST$",
"object.container.playlistContainer"), TYPE_VIDEO("VIDEO$", "object.container.storageFolder");
TYPE_AUDIO("FID$", "object.item.audioItem"),
TYPE_FOLDER("FOLDER$", "object.container.storageFolder"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not implemented and there is a question if we need it. Folders are not stored in the database.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you're right. In the beginning, I was searching only for "FILES" type. But then the more concrete types were necessary and "FILES" became obsolete. Thanks for figuring out.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good point but it presents a problem with the search approach, since it is valid for renderers to search for folders, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is valid to search for "object.container.storageFolder", but the current implementation ignores this upnp:class yet.

Since the SearchRequestHandler will not create an URL-Link of type TYPE_FOLDER, we should not actually have an issue here in this concrete java class (in discovering the DLNAResource which is not implemented).

@valib
Copy link
Contributor

valib commented Aug 16, 2021

@ik666 @SubJunk we should aware users that all this implementation is working correctly only if the database is enabled and the UMS will fully scan shared folders. Otherwise the result will be not relevant.

@SubJunk
Copy link
Member

SubJunk commented Aug 16, 2021

@valib yes. At this point I think the database and startup scan are essential for UMS to run properly in many ways. That's why those settings are hidden by default. People should not disable them unless there is a bug to avoid, and I am always working hard to fix bugs

@ik666
Copy link
Contributor Author

ik666 commented Aug 17, 2021

@valib I had a quick check. Your changes are all right. I had no issues.

@SubJunk
Copy link
Member

SubJunk commented Aug 17, 2021

The user replied that it didn't work, should I make a new build with these latest changes @valib ?

@ik666
Copy link
Contributor Author

ik666 commented Aug 17, 2021

@SubJunk I'm not sure if the fix didn't work, or if there are "still errors". To prevent spamming, @valib changed the loglevel to TRACE, so that this error shouldn't pop up in the "general" log any more. Maybe a rebuild is needed for changes to take effect.

Since the code calls the pre 10.6 logic in case of any error (RequestV2: around 1112) ,

		try {
			return searchRequestHandler.createSearchResponse(requestMessage, mediaRenderer);
		} catch (Exception e) {
			LOGGER.trace("error transforming searchCriteria to SQL. Fallback to content browsing ...", e);
			return browseHandler();
		}

I'm wondering if the origin of this issue lies within the UPnP search code or not ?

Besides that, the users error message shows a search for object.item.imageItem. Since UMS doesn't store any images, delivering an empty container should actually be fine, too (current implementation on master branch) ?!

@ik666
Copy link
Contributor Author

ik666 commented Aug 17, 2021

@SubJunk @valib
ok, I think I see the problem. The TV makes a search for top 14 available video items (log file around line 4085). This leads actually not to an exception, therefore not entering the pre 10.6 logic. The result is 0, which might be an error. I could add SQL queries in TRACE log to dig deeper into this.

However, even if the search delivers top 14 videos in SearchResponse I personally think, this is not the intended user experience, since the user might rather like to browse the media library (beginning with the root element) instead of looking at unsorted top 14 video files ...

One solution could be disabling UPnP search support by a configuration entry for specific TV types by delegating the call directly to browseHandler(). I haven't done any TV specific configuration stuff yet ... can one of you give me a hint, or just implement the configuration entry if you'd like to move in this direction?

@Nadahar
Copy link
Contributor

Nadahar commented Aug 17, 2021

Besides that, the users error message shows a search for object.item.imageItem. Since UMS doesn't store any images, delivering an empty container should actually be fine, too (current implementation on master branch) ?!

I'm not following the logic of the search implementation here, but I don't understand your claim that "UMS doesn't store any images". Images should be "stored" in the database like other media files, but their metadata is stored in a different way. For audio and video, a few selected metadata is stored in the database tables. For images, all metadata is stored in ImageInfo which is then serialized and stored in the database. These metadata thus isn't available to make queries in the database, but the image media files should still "be there".

The reason for storing the metadata this way is that there are so many different metadata available for different formats that making a column for all of them would mean that most would be null/blank for most images. If some of these properties are needed for SQL queries, columns could be created for those specific metadata.

@SubJunk
Copy link
Member

SubJunk commented Aug 17, 2021

@ik666 it might be some kind of "smart" filtering system for the TV. For example on PS3 it has different entry points for media servers depending on what you want - video, audio or image. In the case of PS3 it just uses browse requests and then ignores the results it doesn't want, but maybe there is a similar user experience on the TV. The fact it requests 14 videos may be because of pagination or some quick-preview feature or something. Maybe when it's working we can ask the user to provide photos of the interface.

Anyway it's up to the TV to do what they want with our API, and it's up to us to fulfil the requests that we report to support. I think it's kinda exciting when renderers do unconventional things with DLNA/UPnP :)

Maybe we can just try to fulfil the request in a basic way and see where that leads? Maybe the renderer will send a browse request too after we fulfil the search requests. What do you think?

@SubJunk
Copy link
Member

SubJunk commented Aug 17, 2021

These are possibly related as well. Not fully confirmed but the timing lines up and I don't think we have done other big changes lately:

https://www.universalmediaserver.com/forum/viewtopic.php?f=9&t=14247&p=44366#p44366
https://www.universalmediaserver.com/forum/viewtopic.php?p=44364#p44364

Maybe the best thing for now would be to disable the search capability and work on it some more, what do you think @ik666 ? That way I can do a release very soon with that disabled and then we can continue to work on it for a future release

@SubJunk
Copy link
Member

SubJunk commented Aug 17, 2021

Unfortunately I need to go away from this computer for a few days or more for a COVID-19 lockdown so I think I will do a release of master while I have time, I was hoping to wait until we had a fix for this but I'll get the release ready now

@valib
Copy link
Contributor

valib commented Aug 17, 2021

@SubJunk has anybody test my last commit?

@SubJunk
Copy link
Member

SubJunk commented Aug 17, 2021

@valib no, I wasn't sure if it was ready for testing yet. Do you have the ability to do Windows builds? I won't be able to for at least 4 days unless I figure out building from CI which I have been meaning to do...

@ik666
Copy link
Contributor Author

ik666 commented Aug 18, 2021

@ik666 it might be some kind of "smart" filtering system for the TV. For example on PS3 it has different entry points for media servers depending on what you want - video, audio or image. In the case of PS3 it just uses browse requests and then ignores the results it doesn't want, but maybe there is a similar user experience on the TV. The fact it requests 14 videos may be because of pagination or some quick-preview feature or something. Maybe when it's working we can ask the user to provide photos of the interface.

Anyway it's up to the TV to do what they want with our API, and it's up to us to fulfil the requests that we report to support. I think it's kinda exciting when renderers do unconventional things with DLNA/UPnP :)

Maybe we can just try to fulfil the request in a basic way and see where that leads? Maybe the renderer will send a browse request too after we fulfil the search requests. What do you think?

I don't mind to figure out why the resultset has no entries. I'll add some SQL trace code. Nevertheless, I somehow doubt that the TV will make BrowseRequests after the SearchRequest if the resultset is >0 ... we'll see.

@ik666
Copy link
Contributor Author

ik666 commented Aug 18, 2021

Besides that, the users error message shows a search for object.item.imageItem. Since UMS doesn't store any images, delivering an empty container should actually be fine, too (current implementation on master branch) ?!

I'm not following the logic of the search implementation here, but I don't understand your claim that "UMS doesn't store any images". Images should be "stored" in the database like other media files, but their metadata is stored in a different way. For audio and video, a few selected metadata is stored in the database tables. For images, all metadata is stored in ImageInfo which is then serialized and stored in the database. These metadata thus isn't available to make queries in the database, but the image media files should still "be there".

The reason for storing the metadata this way is that there are so many different metadata available for different formats that making a column for all of them would mean that most would be null/blank for most images. If some of these properties are needed for SQL queries, columns could be created for those specific metadata.

You're right. I made wrong assumptions. I'm uncertain how interesting an image search might be for the end user ...

@ik666
Copy link
Contributor Author

ik666 commented Aug 18, 2021

These are possibly related as well. Not fully confirmed but the timing lines up and I don't think we have done other big changes lately:

https://www.universalmediaserver.com/forum/viewtopic.php?f=9&t=14247&p=44366#p44366
https://www.universalmediaserver.com/forum/viewtopic.php?p=44364#p44364

Maybe the best thing for now would be to disable the search capability and work on it some more, what do you think @ik666 ? That way I can do a release very soon with that disabled and then we can continue to work on it for a future release

I can disable the search, however I doubt it will have any effect on the "massive" or "very large" id issue, since the search implementation uses it's own resource loading (doesn't rely on the PMS object cache). Actually, I had the same experience while doing the search implementation. Even though same files were found, new ID's were generated for the same object, leading to misses in resolving thumbnails. That's the reason, why I implemented a "database-id based resource locator" circumveting this issue.
@Nadahar you might remember our discussion on this point.

@ik666
Copy link
Contributor Author

ik666 commented Aug 18, 2021

Lastet commit disables UPnP search.

@ik666
Copy link
Contributor Author

ik666 commented Aug 18, 2021

Unfortunately I need to go away from this computer for a few days or more for a COVID-19 lockdown so I think I will do a release of master while I have time, I was hoping to wait until we had a fix for this but I'll get the release ready now

That's bad :( I wish you the best ...

@SubJunk
Copy link
Member

SubJunk commented Aug 18, 2021

Thanks, it's ok it's just my government is very responsive - we had one case of infection in New Zealand and the country is in lockdown. It's very cool and keeps us safe.

Ok I can include that disabling in the next release (I am in the middle of releasing 10.10.0 now, which I built hours ago) and then hopefully we can get searching back into the program soon

@ik666
Copy link
Contributor Author

ik666 commented Aug 18, 2021

@SubJunk Good to know ...

But I did a c&p error :(( . Please do also merge GIT 3615470 or this complete branch. to disable search support.

valib and others added 3 commits October 11, 2021 21:58
Co-authored-by: SubJunk <SubJunk@users.noreply.github.com>
is searching for the files subs not the empty line which force the GUI
to hide the Status Line and let the Shared folders to grow.
@SubJunk
Copy link
Member

SubJunk commented Oct 12, 2021

@valib do you think we should merge this?

@ik666
Copy link
Contributor Author

ik666 commented Oct 13, 2021

Sorry, I was some days off. I think it looks nice now :)

@SubJunk
Copy link
Member

SubJunk commented Oct 15, 2021

Ok cool, I think it's good now but I just want to check with @valib that he is ok with it too

bugfix/upnpSearch/searchErrorFallback

Conflicts:
	src/main/java/net/pms/util/OpenSubtitle.java
@valib
Copy link
Contributor

valib commented Oct 15, 2021

@SubJunk I am still testing it because I have a problem with the test case. For me the test is not working in Eclipse but it pass when I use mvn site. Strange. Maybe the problem in Eclipse setting.

valib
valib previously approved these changes Oct 15, 2021
@SubJunk
Copy link
Member

SubJunk commented Oct 16, 2021

@valib I just tested it and it passed too. Do we need to document that for Eclipse users?

@Nadahar
Copy link
Contributor

Nadahar commented Oct 16, 2021

This is not my business, but I really think it sounds like a bad idea to "document" that it's broken under Eclipse and move on. I don't know exactly what doesn't work under Eclipse, but I find it very likely that this problem can manifest under other circumstances as well and isn't the "fault" of Eclipse.

It the problem is the tests, I'd bet it is a threading/concurrency issue. Eclipse runs the tests somewhat differently than Maven, and I've experienced tests that fail only under Eclipse and vice versa. If you tweak the Maven testrunner's thread handling, I'm pretty sure you'll get that to fail too.

A much better solution would be to fix the concurrency bug IMO, if this is the situation.

@valib
Copy link
Contributor

valib commented Oct 16, 2021

Now it works in Eclipse. It takes some time but it works for me.

@SubJunk
Copy link
Member

SubJunk commented Oct 17, 2021

@Nadahar sure it's your business, you're a long-time code contributor and supporter of us on the forum, your thoughts are always very welcome here :)

@valib nice work fixing it, thanks!

@SubJunk SubJunk merged commit 54a0935 into UniversalMediaServer:master Oct 25, 2021
@ik666
Copy link
Contributor Author

ik666 commented Oct 26, 2021

I'm back from holidays and I'm glad to see you guys having everything under control :)

@ik666 ik666 deleted the bugfix/upnpSearch/searchErrorFallback branch October 26, 2021 07:44
@ik666 ik666 restored the bugfix/upnpSearch/searchErrorFallback branch October 26, 2021 07:46
@ik666 ik666 deleted the bugfix/upnpSearch/searchErrorFallback branch October 26, 2021 07:46
ik666 pushed a commit to ik666/UniversalMediaServer that referenced this pull request Oct 26, 2021
* master_UMS:
  fix for reported problem on some SONY TV's while content browsing / searching (UniversalMediaServer#2607)
  Bump spotbugs-maven-plugin from 4.4.2.1 to 4.4.2.2 (UniversalMediaServer#2685)
  Bump oshi-core from 5.8.2 to 5.8.3 (UniversalMediaServer#2686)
  Fixed uncaught exception when updating DLNAMediaDatabase version (UniversalMediaServer#2684)
  Fix some bugs (UniversalMediaServer#2682)
  Fix problem reported in issue UniversalMediaServer#2678 (UniversalMediaServer#2680)
  Continue to fix the UniversalMediaServer#2553 (UniversalMediaServer#2681)
  Bump spotbugs-maven-plugin from 4.4.2 to 4.4.2.1 (UniversalMediaServer#2679)
  Fix the problem reported in UniversalMediaServer#2553
  Updated changelog
  Match more filenames (UniversalMediaServer#2676)
  Improved stability and logging while fetching JSON (UniversalMediaServer#2672)

# Conflicts:
#	src/main/java/net/pms/network/DbIdResourceLocator.java
#	src/main/java/net/pms/network/SearchRequestHandler.java
#	src/test/java/net/pms/dlna/DLNAMediaInfoTest.java
#	src/test/java/net/pms/network/SearchRequestHandlerTest.java
ik666 pushed a commit to ik666/UniversalMediaServer that referenced this pull request Oct 26, 2021
* master_UMS: (120 commits)
  fix for reported problem on some SONY TV's while content browsing / searching (UniversalMediaServer#2607)
  Bump spotbugs-maven-plugin from 4.4.2.1 to 4.4.2.2 (UniversalMediaServer#2685)
  Bump oshi-core from 5.8.2 to 5.8.3 (UniversalMediaServer#2686)
  Fixed uncaught exception when updating DLNAMediaDatabase version (UniversalMediaServer#2684)
  Fix some bugs (UniversalMediaServer#2682)
  Fix problem reported in issue UniversalMediaServer#2678 (UniversalMediaServer#2680)
  Continue to fix the UniversalMediaServer#2553 (UniversalMediaServer#2681)
  Bump spotbugs-maven-plugin from 4.4.2 to 4.4.2.1 (UniversalMediaServer#2679)
  Fix the problem reported in UniversalMediaServer#2553
  Updated changelog
  Match more filenames (UniversalMediaServer#2676)
  Improved stability and logging while fetching JSON (UniversalMediaServer#2672)
  Move API Metadata methods to new APIUtils class (UniversalMediaServer#2674)
  Bump spotbugs-maven-plugin from 4.4.1 to 4.4.2 (UniversalMediaServer#2675)
  Use translation for Status line message
  Show the folder name in the Status Line when the subtitles API (UniversalMediaServer#2673)
  Checking for non set variables with better syntax (UniversalMediaServer#2659)
  Replaced '==' with '===' and '!=' with !==' (UniversalMediaServer#2669)
  Removed unused variable. (UniversalMediaServer#2670)
  simplify if loop (UniversalMediaServer#2668)
  ...
ik666 pushed a commit to ik666/UniversalMediaServer that referenced this pull request Oct 26, 2021
* master_UMS: (86 commits)
  fix for reported problem on some SONY TV's while content browsing / searching (UniversalMediaServer#2607)
  Bump spotbugs-maven-plugin from 4.4.2.1 to 4.4.2.2 (UniversalMediaServer#2685)
  Bump oshi-core from 5.8.2 to 5.8.3 (UniversalMediaServer#2686)
  Fixed uncaught exception when updating DLNAMediaDatabase version (UniversalMediaServer#2684)
  Fix some bugs (UniversalMediaServer#2682)
  Fix problem reported in issue UniversalMediaServer#2678 (UniversalMediaServer#2680)
  Continue to fix the UniversalMediaServer#2553 (UniversalMediaServer#2681)
  Bump spotbugs-maven-plugin from 4.4.2 to 4.4.2.1 (UniversalMediaServer#2679)
  Fix the problem reported in UniversalMediaServer#2553
  Updated changelog
  Match more filenames (UniversalMediaServer#2676)
  Improved stability and logging while fetching JSON (UniversalMediaServer#2672)
  Move API Metadata methods to new APIUtils class (UniversalMediaServer#2674)
  Bump spotbugs-maven-plugin from 4.4.1 to 4.4.2 (UniversalMediaServer#2675)
  Use translation for Status line message
  Show the folder name in the Status Line when the subtitles API (UniversalMediaServer#2673)
  Checking for non set variables with better syntax (UniversalMediaServer#2659)
  Replaced '==' with '===' and '!=' with !==' (UniversalMediaServer#2669)
  Removed unused variable. (UniversalMediaServer#2670)
  simplify if loop (UniversalMediaServer#2668)
  ...

# Conflicts:
#	src/main/java/net/pms/network/DbIdResourceLocator.java
#	src/main/java/net/pms/network/RequestV2.java
#	src/main/java/net/pms/network/SearchRequestHandler.java
ik666 pushed a commit to ik666/UniversalMediaServer that referenced this pull request Oct 26, 2021
* feature/master/artistSearchImprovement:
  fix for reported problem on some SONY TV's while content browsing / searching (UniversalMediaServer#2607)
  Bump spotbugs-maven-plugin from 4.4.2.1 to 4.4.2.2 (UniversalMediaServer#2685)
  Bump oshi-core from 5.8.2 to 5.8.3 (UniversalMediaServer#2686)
  Fixed uncaught exception when updating DLNAMediaDatabase version (UniversalMediaServer#2684)
  Fix some bugs (UniversalMediaServer#2682)
  Fix problem reported in issue UniversalMediaServer#2678 (UniversalMediaServer#2680)
  Continue to fix the UniversalMediaServer#2553 (UniversalMediaServer#2681)
  Bump spotbugs-maven-plugin from 4.4.2 to 4.4.2.1 (UniversalMediaServer#2679)
  Fix the problem reported in UniversalMediaServer#2553
  Updated changelog
  Match more filenames (UniversalMediaServer#2676)
  Improved stability and logging while fetching JSON (UniversalMediaServer#2672)

# Conflicts:
#	src/main/java/net/pms/network/SearchRequestHandler.java
#	src/test/java/net/pms/dlna/DLNAMediaInfoTest.java
#	src/test/java/net/pms/network/SearchRequestHandlerTest.java
SubJunk pushed a commit that referenced this pull request Jan 17, 2022
…earching (#2607)

* fix for reported problem on some SONY TV's while content browsing / searching.

* Make the search more common

* Update

* no message

* disabled search feature ...

* reverted to original call logic.

* Send the MusicBrainz TrackID only for audio file.

* enabled upnp search requests

* Store the MusicBrainzID only for audio files.

* Update

* Fix comment

* added SearchRequestHandlerTest

* Fix test

* Update

* improved search speed a little, by using LIMIT and OFFSET in sql queries

* Fix NPE

* SQL fix

* Update

* Fixed reading musicbrainz id's while scanning the file system.

* insert NULL values instead of an empty UUID string, if no musicbrainz id are present in the audio file

* Change the MBID columns from default value UUID to VARCHAR

to avoid to spam the database with 00000000-0000-0000-0000-000000000000
values

* Return back the UUID, fix some Javadoc description

* Update src/main/java/net/pms/network/SearchRequestHandler.java

Co-authored-by: SubJunk <SubJunk@users.noreply.github.com>

* Update src/test/java/net/pms/dlna/DLNAMediaInfoTest.java

Co-authored-by: SubJunk <SubJunk@users.noreply.github.com>

* Update src/main/java/net/pms/dlna/LibMediaInfoParser.java

Co-authored-by: SubJunk <SubJunk@users.noreply.github.com>

* Update src/test/java/net/pms/dlna/DLNAMediaInfoTest.java

Co-authored-by: SubJunk <SubJunk@users.noreply.github.com>

* Show the folder name in the Status Line when the subtitles API

is searching for the files subs not the empty line which force the GUI
to hide the Status Line and let the Shared folders to grow.

* Do not test the network speed in the SearchRequestHandlerTest

Co-authored-by: sf666 <satfreak666@gmx.de>
Co-authored-by: valib <liborvala@seznam.cz>
Co-authored-by: SubJunk <SubJunk@users.noreply.github.com>
(cherry picked from commit 54a0935)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants