nova-video-player / aos-AVP

NOVA opeN sOurce Video plAyer: main repository to build them all
Apache License 2.0
3.51k stars 201 forks source link

[Bug]: Libraries getting lost on Amazon Fire devices #844

Open ghost opened 1 year ago

ghost commented 1 year ago

Problem description

After initial scraping (SMBv1 share on Apple Time Capsule), both Movies and TV Shows display correctly. However, if browsing another app on the Fire device and returning to Nova Player, libraries are gone. I have to exit Nova or press 'Home', wait a couple of minutes, then launch Nova again, and the libraries will appear again. 'Recently Played' and 'Recently Added' also sometimes appear, sometimes disappear.

v6.0.67 was the last version to work correctly on FireCube 4K Gen2. v6.0.65 and above work inconsistently on FireStick 4K Max.

Have done a complete factory reset on the FireStick 4K Max, and clean-installed Nova (v6.0.65 and above) and same problem.

Steps to reproduce the issue

1) Setup SMBv1 share on Nova 2) Wait until initial scrape. Libraries populated correctly. 3) Play any movie or tv show. 4) Return until exit from Nova and on OS home screen. 5) Wait a few minutes or use any other app. 6) Launch Nova.

At this point, Movies and TV Shows display generic icons and no movies or tv shows appear.

7) Return until exit from Nova and on OS home screen. 8) Wait a few minutes or use any other app. 9) Launch Nova.

At this point, Movies and TV Shows display populated icons and movies and tv shows fully appear.

If I repeat the same steps again (exit, wait, launch), then libraries are gone again, etc., etc. This behavior cycles.

I have changed Initial Scan on App Startup on and off to no effect.

Cleared cache and data to no avail.

Expected behavior

Libraries should stay populated.

Your phone/tablet/androidTV model

Firecube 4K Gen2, Firestick 4k Max

Operating system version

Fire OS 7.6.2.4

Application version and app store

v6.0.97 from Amazon App Store

Additional system information

v6.0.67 was the last version to work correctly on FireCube 4K Gen2. v6.0.65 and above work inconsistently on FireStick 4K Max. Haven't tried earlier versions.

Debug logs

No response

courville commented 1 year ago

It seems that your problem is not fire device specific but most probably linked to time capsule SMB1 server since it works on my side on a Synology NAS.

Pentaphon commented 1 year ago

I've seen this too on my Fire TV 4K stick, but it never happens on my most used device, the Onn 4K. The person using it complains that the "movies are gone" and I have to revert everything back to normal. It's happened...probably 3 times in the past year? I'm using a Windows PC as a Samba server aka my main office PC, and it provides the video for all the screens in the house.

ghost commented 1 year ago

The curious thing about this is that it happens on the Firecube using v6.0.97. I have reverted to every version until v6.0.67, where it does not happen (which, to my mind, discards the Time Capsule as the culprit). Same thing happens with the Firestick 4K Max, except that v6.0.67 happens sporadically on that one. I'm just guessing here, but I think it has more to do with Nova's database than the Time Capsule...

Also, this happens every single time I repeat the steps in the original post, no matter if it's 2-3 minutes apart or 1-2 hours, etc., it happens all the same.

courville commented 1 year ago

OK I will test. And thanks for pointing out that this would be a regression after v6.0.67. I will check all the code modifications. Note to self 6.0.67 is "Sun May 22 16:44:03 2022 +0200"

ghost commented 1 year ago

Thanks. If you need logs or anything and point me out how to go about getting them, I'd be happy to help. I can also post a (private) video (on Youtube or whatever) to show you what's going on, if it helps.

courville commented 1 year ago

@Molasar49, is this correct to say that you do not have the problem on all your fire devices with v6.0.64? I do not make sense why it should work with v6.0.67 on FireCube 4K Gen2 and v6.0.65 not working on FireStick 4K Max. I will try to reproduce with the FireStick 4K Max.

ghost commented 1 year ago

@courville I installed v6.0.65-20220508 on Firestick 4K Max, but it showed artifacts during playback, so I uninstalled (before checking the issue posted above) and reinstalled v6.0.67-20220605. This version shows the issue posted above. I tried v6.0.71-20220623 and v6.0.97 (the one you sent me previously and also downloaded from the App Store) and they all show the same issue (on the Firestick 4K Max). I went as far as restoring to factory settings, updating the OS and ONLY installing those Nova versions, and same problem persists.

So I headed over to the FireCube 4K Gen2 and notice that only v6.0.67 works correctly - all newer versions show the same behavior. When launching on FireCube, v6.0.67 shows generic Movies and TV Shows icons but immediately recovers (split-second later), showing "customized" icons before I get a chance to do anything and all works fine.

I don't know why v6.0.67 works on FireCube but not on Firestick Max. With Firestick, I sometimes get a Recently Played movie, which plays fine, but going into 'Movies', the library is empty - which makes me think it's not an SMBv1 or Time Capsule issue, but a Nova database issue - just my (educated) guess (since I used to be a full-time .NET developer).

I was meaning to copy some of my movies from the Time Capsule to a Windows Server share and observe the behavior. Would that help in some way?

What is strange (on Firestick) is that launching shows the behavior, returning to Home (OS) and relaunching seems to make Nova recover and populate library. Returning to Home (OS) and relaunching shows the issue, etc., etc. Going back and forth populates, then empty, then populated, then empty, etc. There seems to be no scanning involved - it's just as if it reads it's database, then it doesn't, then it reads it, then it doesn't, etc. (just guessing here). There is hardly any delay. It's just there or it isn't (if that makes any sense).

courville commented 1 year ago

Thanks for the detailed behavior analysis. I ruled out the SMB1 timecapsule issue. I tried to reproduce on Firestick 4K Max on latest release and SMB2 share on a synology and unfortunately it works as expected on my side. I do not have this split second of generic icon at all.

What I propose since you have the issue systematically, is to stick with latest release and try to get logs. I will share shortly a debug build with more logs around nova db and scraping. If you can capture adb logs with this release it would help (https://github.com/nova-video-player/aos-AVP/wiki/Debugging, adb connect adb logcat etc...).

ghost commented 1 year ago

@courville, So, you recommend I uninstall v6.0.67 and install v6.0.97 on Firestick Max and capture logs, or wait until the debug build?

courville commented 1 year ago

@Molasar49 please use this build: https://drive.google.com/file/d/1-HoPfztgctk7Kro1lHJt1dY-W5MxWYai/view?usp=sharing Capture adb logcat logs (it will be verbose thus if you find a way to record the logs in a text file it would be better). You can share the results with me via email (zip files) software at courville dot org. Thanks in advance for your help (and patience) on this issue.

ghost commented 1 year ago

@courville Ok, will proceed with this right now. And on the contrary, thank you for your time and effort!

courville commented 1 year ago

Do not hesitate to request help.

ghost commented 1 year ago

@courville Wow! This version works! The only thing I notice is that it's displaying generic Movies and TV Shows icons (after successful full scan), other than that, works as expected. I captured the logs. Do you wish me to send them over?

ghost commented 1 year ago

Oh wait! When I disconnected adb, same problem!!!!

ghost commented 1 year ago

Capturing new log right now. Recently Played shows 1 movie and it plays correctly. Libraries are empty. After a few minutes, Recently Added and Recently Played are gone too, but now showing populated libraries (and generic icons). Will play around a bit and send over logs.

courville commented 1 year ago

Damn, yes please send the logs and I will analyze tomorrow. Also one thing if you manage to do it is to dump nova media database before the full lib gets populated back (check "Get a dump of nova media database" section in the https://github.com/nova-video-player/aos-AVP/wiki/Debugging wiki). If you could send me both versions (normal, and empty) via email, it would be nice too.

ghost commented 1 year ago

@courville Done. Also sent a link on the email to a video capture with my phone showing the issue. Hope it helps.

courville commented 1 year ago

Thanks for taking the time to investigate and for sharing the logs and the media dbs at different stages and an explanatory video. I need to spend more time on the analysis. What I can see from the media db is that all the videos are there and I see no scanning retrigered. What I suspects now is that some loaders are stuck for some reasons that do not deliver the right information to the various fragments. Let's dig in further.

courville commented 1 year ago

I will revert the changes made around the 6.0.67 and share a new build with you tonight. I will add logs only on these parts and I will kindly request that you capture logs from nova only via for linux/macos adb shell 'logcat --pid=$(pidof -s org.courville.nova)' and adb shell "logcat --pid=$(pidof -s org.courville.nova)" most probably for windows.

ghost commented 1 year ago

Thanks. Will be away for Sabbath but will continue after that. Thanks again!

courville commented 1 year ago

@Molasar49, I will share an experimental build soon for you to test. What is not entirely logic on my side looking at the code changes is that you state that it works with v6.0.67 but not with v6.0.68. Do you confirm this statement?

courville commented 1 year ago

OK re-reading the full thread, issue happens with v6.0.67 but less frequently but not with v6.0.65. It is thus between v6.0.65 and v6.0.67 that the issue has been introduced and it far more visible after v6.0.67. The change I target is the throttling that I removed that could on the fire devices (for unknown reasons) to get all the loaders stuck.

courville commented 1 year ago

Note to self: might be related to #141, #605, #134 (check with in Video tig --follow ./src/main/java/com/archos/mediacenter/video/browser/loader/)

Github releases dates:

Comment: AsyncTaskLoader relies on ModernTaskLoader now and uses ThreadPoolExecutor(5, 128, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(10), tocheck).

courville commented 1 year ago

@Molasar49 could you please test this new build and report if it is any better https://drive.google.com/file/d/1-HoPfztgctk7Kro1lHJt1dY-W5MxWYai/view?usp=sharing ?

It has VideoLoader throttling enabled for all related loaders and relies on ThreadPoolExecutor(1, 1, 10, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(5200));. However throttling is disabled in VideoSelectionLoader and it relies on default ThreadPoolExecutor(5, 128, 10, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(10)).

courville commented 1 year ago

@Molasar49 after and only after testing above build, if it is still nok, it would be nice if you could provide feedback on this build where the default android ThreadPoolExecutors are used for the loaders (throttling is still enabled): https://drive.google.com/file/d/1-2FOkcJks9SYLNzvtZg7ludju0tuvRxN/view?usp=sharing

ghost commented 1 year ago

@courville On it in a couple of hours full steam and will report back. Thank you again for your efforts!

ghost commented 1 year ago

@courville I just installed the first version you kindly sent me (v6.1.2 2023-0319.1233) and these are my preliminary observations (on the Firestick 4K Max):

After initial scan, Movies and TV Shows libraries were populated. Returned to Home (OS), reentered and got it to fail quickly (libraries empty). After that, tried very hard to make it fail and couldn't.

I acivated the Re-scan when opening the application and got it to fail on the very next cycle (Exit-Home-Launch), but couldn't get it to fail after.

Noticed the Movie and TV Shows icons are generic no matter what.

I was just about to declare this version a winner.

Exited to Home (OS), came to write this, and before I finished, went and launched Nova just to find both libraries empty. So i guess the lengthened "pause" on Home screen (OS) and relaunching causes it to fail.

Exited to Home for 2 seconds, relaunched and now even Recently Played and Recently Added are gone, along with both libraries.

What do you want me to do next?

ghost commented 1 year ago

@courville After a couple of fast cycles (Exit-Home-Launch), everything populated now...

I can kind of notice a pattern on how I can get it to fail. This version is clearly harder to make fail than v6.0.67.

It's very hard to make it fail, but it does happen rarely. Generic icons, though.

A 1 to 2 minute exit to Home then relaunch seems to make it fail sometimes (clearly not always), losing Recently Played and Recently Added sometimes too.

Quick update: Now I'm having a hard time getting it to repopulate libraries.

ghost commented 1 year ago

Ok, just installed new version (v6.1.2 20230319.1310). Everything went smooth upon installing and initial scan. Exited to Home (OS), waited 1 minute (chronometer in hand), launched and... empty libraries :(

Recently Played and Recently Added are populated, just nothing within both libraries.

If you need logs, dbs or video, please let me know.

Update 1: Repeated the same cycle: Exit, 1 minute on Home, relaunch, now Recently Added and Recently Played are gone but libraries are populated.

Update 2: Repeated the same cycle again: Exit, Home (1 min), Relaunch. Recently Added and Recently Played are populated, both libraries are gone.

Update 3: Repeated same cycle. Recents (gone) and Libraries (populated), i.e.: flipped again.

Generic icons no matter what, in all cases.

All the above on the Firestick 4K Max. Have done no tests on the Cube 4K Gen2.

courville commented 1 year ago

@Molasar49 thanks for your thorough testing and reporting.

Couple of comments:

Could you please test this build (same as v6.1.2 20230319.1310 with throttling disabled and some logs on iconBox builders): https://drive.google.com/file/d/1EVWCbLogGMCwxIGFk38dgy3NmVIU32AX/view?usp=sharing

I would be interested in the logs this time (not the db which is populated always) and let's focus on logs from MainFragment and buildAllMoviesBoxTask.

To be clear and do not induce false hopes, I do not anticipate this build to be the magic bullet.

Thx

courville commented 1 year ago

OK the generic icon for all movies, sagas, all tv shows is indeed a bug (regression): reverting 5e7554cb9d3c1073c3efe093d82fd811e524242a solves it.

courville commented 1 year ago

@Molasar49 just updated previous link https://drive.google.com/file/d/1EVWCbLogGMCwxIGFk38dgy3NmVIU32AX/view?usp=sharing with the fix for all movies icon and same config.

courville commented 1 year ago

Note to self inspect 9fabacac4e34646ab427043e4a4a3ae387f9b508 next for MainFragment and previous ones for cause of regression on fireTV.

ghost commented 1 year ago

Commencing trials with v6.1.2 (20230319.2025) on Firestick 4K Max with full log capture starting before initial scan...

Will get back soon.

ghost commented 1 year ago

@courville Whoa! I think we have a winner! I absolutely could not get this one to fail. Generic icons are updated correctly (with a split second delay), libraries and Recents all correct. Applied the 1-minute hypothesis, then 5 seconds, 10, 15 seconds and could not get this one to fail. I captured the full log. Sending logs now...

courville commented 1 year ago

OK we are finally getting somewhere (I hope). Let's test this build to be sure where I revert back to the last release loaders behavior and implement the icon fix. If this solves your issue, I will make a release for everyone. Here is the new build to test (pretty please): https://drive.google.com/file/d/1EVWCbLogGMCwxIGFk38dgy3NmVIU32AX/view?usp=sharing (same link new build).

ghost commented 1 year ago

@courville Absolutely! Will get this fully tested later tonight and post back. Thank you for your time, effort and patience!

ghost commented 1 year ago

@courville Commencing trial run v6.1.1 (20230319.2230)....

Wait...is this version right?

ghost commented 1 year ago

First observations:

1) Upon initial scrape (and finalized), Recently Added is populated, but Movie and TV Shows icons remain generic. 2) Both libraries are indeed populated (but icons remain generic). 3) Play any movie. Return. Recently Played correctly populated. Generic icons remain. 4) Return to Home (OS). Wait 1 minute. Relaunch. Recently Added and Recently Played populated, no more generic icons (have been changed to customized). 5) Libraries correctly populated.

Will now run different cycle tests, i.e.: Exit->Home (OS)->Relaunch and report back.

ghost commented 1 year ago

@courville Happy to report v6.1.1 (20230319.2230) is a clear winner on Firestick 4K Max.

Absolutely could not make this version fail no matter what I threw at it. Only caveat was the generic icons upon initial scrape finish. 1 cycle fixed it.

Commencing trial runs on Firecube 4K Gen 2. Will report back when done.

ghost commented 1 year ago

v6.1.1 (20230319.2230) on Firecube 4K Gen2:

1) Seeing same generic icon behavior upon initial scrape finish. 2) One cycle (Exit->Home->Relaunch) without any pause fixes the icons. 3) Probably not related. Have "Searching" and "Missing" movies; Collection shows Missing/Searching 2-Movie Collection icon, but only 1 movie there: "Missing". Other collections, i.e.: Ant-Man, Battlestar Galactica are grouping correctly. Didn't notice but same happens on Firestick 4K Max. Used Rescrape all collections option on both, still just 1 movie there. Movies are called Missing.mp4 and Searching.mp4 in their respective directories (i.e.: Media/Movies/Searching and Media/Movies/Missing).

Other than that, could not make this version fail no matter what.

Happy to report v6.1.1 (20230319.2230) is a clear winner also on Firecube 4K Gen2.

Please let me know if you need any further testing, logs, dbs, etc.

courville commented 1 year ago

@Molasar49 thanks for your detailed feedback and testing! I take that the latest build works but you see a degradation of the generic icons generation that could be linked to the size of LinkedBlockingQueue. I would be tempted to have you do another test on a build that I will share tonight if it is not too much to ask to address the above issue.

ghost commented 1 year ago

@courville Will be more than happy to test!

courville commented 1 year ago

@Molasar49: here is my release candidate version for you to check if it is ok on your side. If you confirm it is ok, I push it to the world ;-) https://drive.google.com/file/d/1fRP50x5dp-9EgdLgJwK8eKbsId6eRsMo/view?usp=sharing

ghost commented 1 year ago

@courville Sure! Will get on it later tonight and report back. Thanks!

ghost commented 1 year ago

Commencing trial runs v6.1.2 (20230320.2258) on Firestick 4K Max (Wifi)...

ghost commented 1 year ago

@courville

1) After initial scrape (530+ and 105+ items), Movies and TV Shows still showing generic icons. 2) Both libraries are populated correctly. 3) Entering Movies library and returning to main screen still showing generic Movie icon. 4) Entering TV Shows library and returning to main screen still showing generic TV Shows icon. 5) One cycle (Exit->Home->Relaunch) without any pause fixes both icons.

Will continue to put it thru its paces, though the initial icons issue remains...

ghost commented 1 year ago

@courville

Conducted the following tests:

With "Re-scan when opening the application" set to "No": 1) Exit->Home (no pause)->Relaunch 2) Exit->Home (5s pause)->Relaunch 3) Exit->Home (10s pause)->Relaunch 4) Exit->Home (15s pause)->Relaunch 5) Exit->Home (30s pause)->Relaunch 6) Exit->Home (1m pause)->Relaunch 7) Exit->Home (3m pause)->Relaunch 8) Exit->Home (6m pause)->Relaunch

Played random movie between random cycles. Launched other random apps during longer pauses, also between random cycles.

With "Re-scan when opening the application" set to "Yes": 1) Exit->Home (no pause)->Relaunch 2) Exit->Home (5s pause)->Relaunch 3) Exit->Home (10s pause)->Relaunch 4) Exit->Home (15s pause)->Relaunch 5) Exit->Home (30s pause)->Relaunch 6) Exit->Home (1m pause)->Relaunch 7) Exit->Home (3m pause)->Relaunch 8) Exit->Home (6m pause)->Relaunch

Played random movie between random cycles. Launched other random apps during longer pauses, also between random cycles.

Everything works as expected, except for the initial scrape and generic icons not refreshed issue.

Commencing trial runs on Firecube 4K Gen2 (Wired). Will report back.

ghost commented 1 year ago

@courville

After initial scrape (530+ and 105+ items), Movies and TV Shows still showing generic icons.

1) Both libraries are populated correctly. 2) Entering Movies library and returning to main screen still showing generic Movie icon. 3) Entering TV Shows library and returning to main screen still showing generic TV Shows icon. 4) One cycle (Exit->Home->Relaunch) without any pause DOES NOT fix both icons. 5) Recently added library correctly populated. 6) Both Movies and TV Shows libraries are now gone!

Will run same cycle tests and report back.

ghost commented 1 year ago

With "Re-scan when opening the application" set to "No":

1) Exit->Home (1m pause)->Relaunch. Recently Added gone. Generic icons for both libraries remain. Both libraries gone. :(

2) Exit->Home (5s pause)->Relaunch. Recently Added gone. Generic icons for both libraries remain. Both libraries gone.

3) Exit->Home (10s pause)->Relaunch. Recently Added gone. Movies and TV Shows icons are now customized. Both libraries populated. a) Since libraries are back, played 1 movie for a bit. Return. Recently Played now populated.

4) Exit->Home (15s pause)->Relaunch. Recently Added and Recently played populated. Generic icons are now back. Both libraries are gone.

5) Exit->Home (30s pause)->Relaunch. Recently Added and Recently Played gone. Generic icons remain. Both libraries are gone.

(At this point, went to confirm if I installed correct version. Preferences>About shows v6.1.2 (20230320.2258)

6) Exit->Home (1m pause)->Relaunch. Recently Added and Recently Played gone. Generic icons remain. Both libraries are gone.

7) Exit->Home (3m pause)->Launched Netflix and browsed around->Exit->Relaunch Nova. Recently Added and Recently Played gone. Customized icons back. Both libraries populated.

At this point, reboot (restart) Firecube. Waiting 1 minute (after Home displayed, for Cube to "settle", just in case) before recommencing cycles.

8) Relaunch. Recently added and Recently Played populated. Customized icons present. Both libraries present. a) Since libraries are back, played another movie for a bit. Return. Recently Played now showing 2 movies correctly.

9) Exit->Home (no pause)->Relaunch. All correct, i.e.: Recently Added and Recently Played populated. Customized icons present. Both libraries present.

10) Exit->Home (5s pause)->Relaunch. All correct.

11) Exit->Home (10s pause)->Relaunch. Recently Added and Recently Played populated. Generic icons back again. Both libraries gone. :(

12) Exit->Home (15s pause)->Relaunch. Recently Added and Recently Played gone. Customized icons back again. Both libraries populated.

13) Exit->Home (30s pause)->Relaunch. All correct, i.e.: Recently Added and Recently Played populated. Customized icons present. Both libraries present.

14) Exit->Home (1m pause)->Relaunch. All correct.

Have stopped all timed tests at this point.