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

Changing keywords can result in incorrect image count. #182

Closed
dadr opened this issue Mar 7, 2021 · 2 comments
Closed

Changing keywords can result in incorrect image count. #182

dadr opened this issue Mar 7, 2021 · 2 comments

Comments

@dadr
Copy link
Contributor

dadr commented Mar 7, 2021

Found a bug where keywords added or deleted (in this case from USB service) were leaving behind the number of images in the state.json file - even when the keyword itself was removed. This got the slideshow stuck, because it looks for additional pictures until all have been shown. I changed the logic in services/base.py:getImagesTotal() so that it only added images for keywords listed rather than taking all the entries in _NUM_IMAGES even when they were not listed as a keyword. Oddly though, after several iterations with adding and removing keywords, the problems seem to have gone away. I'm unsure whether this is because strings got updated along the way or because of something else. Another consideration might be to add something in addition to the warning messages in modules/servicemanager.py:servicePrepareNextItem. If no additional pictures can be found, the frame just shows a black screen with error message, but it might be better to assume the source has changed, and to rescan the keywords.

@dadr
Copy link
Contributor Author

dadr commented Mar 8, 2021

OK, this "bug" is also present in the current production system. I had noticed that the "do nothing" option for resizing photos was not working like I thought it should, and went to a freshly installed and updated system to see how it worked there. In the process of adding and deleting keywords I managed to get that system into the same state I describe above. I "think" this happens when you add a keyword and then delete it before the scan for pictures has completed. I've attached some log snippets and the contents of /root/photoframe_config/services/*/state.json. This also seems to say that it might not be all that necessary to update the config data types as part of the upgrade. I'll post the fix described above as a PR. Do you think it worthwhile to add some error case code to the servicePrepareNextItem as described above?

Photoframe log:

Mar  8 11:17:51 photoframe photoframe[523]: 2021-03-08 11:17:51,176 - WARNING - prepareNextItem for USB-Photos came back with an error: No (new) images could be found
Mar  8 11:19:08 photoframe photoframe[523]: 2021-03-08 11:19:08,908 - WARNING - prepareNextItem for USB-Photos came back with an error: No (new) images could be found
Mar  8 11:19:51 photoframe photoframe[523]: 2021-03-08 11:19:51,307 - WARNING - prepareNextItem for USB-Photos came back with an error: No (new) images could be found

/root/photoframe_config/services/*/state.json:

{"_NUM_IMAGES": {"art": 258, "python3": 8}, "_KEYWORDS": ["python3"], "_OAUTH_CONFIG": null, 
"_NEXT_SCAN": {"test": 1615153074.86118, "_PHOTOFRAME_": 1612643803.609333, "art": 1615154792.32103, 
"python3": 1615223516.384467}, "_OAUTH_CONTEXT": null, "_CONFIG": null, "_EXTRAS": null, "_INDEX_IMAGE": 0, 
"_INDEX_KEYWORD": 0}

dadr pushed a commit to dadr/photoframe that referenced this issue Mar 8, 2021
Add same logic to python3 branch for issue mrworf#182
@dadr dadr changed the title Update process to python3 may need to walk through configuration and state. Changing keywords can result in incorrect image count. Mar 8, 2021
mrworf pushed a commit that referenced this issue Jun 8, 2021
* Update debug.py

Fixes to make "Log Report" button work again

* Update shutdown.py

* Update helper.py

* Update debug.py

Per our discussion with previous changes

* Update helper.py

Changes per our discussion

* Update base.py

Add same logic to python3 branch for issue #182

* Update display.py

Fix for python3 branch for handling images set to Do Nothing or to Fill

* Update servicemanager.py

* Update oauth.py

* Update oauthlink.py

added codecs library and modified code to translate bytes to string for json.load

* Update README.md

Updated to describe this branch specifically.

* Update svc_googlephotos.py

Bring up to date with mrworf master/python3 version

* Update colormatch.py

Added Ability to make use of alternate TCS34727 color sensor on a different module.   This module has a better physical design than the Adafruit module, and works the same, except it has a version ID of 77 (0x4D) instead of 68 (0x44).  It was bought on eBay: https://www.ebay.com/itm/133600154256

* Update README.md

Updated description of alternate color module

* Update helper.py

Added Code to support HEIC and HEIF images.

* Update README.md

Spelling and grammar

* Update helper.py

fix syntax error

* Update helper.py

Indent error for Copy/paste

* Update helper.py

Moved HEIC to JPG conversion from makeFullframe to Autorotate in order to catch a missing case where a HEIC was set to do nothing but changed colors when cropped to fit the screen.

* Update colormatch.py

Colormatch had some questionable logic at low lux levels.  The changes allow temperature to be calculated as long as all the colors are not 0.  And also, when there is NO light, zero temperature is probably not correct, rather make a middle-of-the-road assumption.

* Update colormatch.py

Modified to detect and control monitors that can be adjusted using ddc channel. These will change brightness and temperature, and not require the colormatch script.

* Update colormatch.py

Added check to avoid going higher in temp than a monitor can support

* Update colormatch.py

Syntax changes

* Update colormatch.py

Syntax

* Update colormatch.py

More Syntax - I need to try an  IDE!

* Update colormatch.py

temp and lux were not set when levels were zero

* Update colormatch.py

* Update colormatch.py

* Update colormatch.py

* Update colormatch.py

Make scale adjustments

* reduce Warnings and clean up update script

move logic to suppress script adjustment to slidephow.py to avoid logging a warning for each picture.  Also clean up legacy updates in update.sh.  All those will have been applied in this branch.

* Update README.md

Formatting and URL port 7777

* Update README.md

spelling

* Update README.md

* update to install instructions

Added instructions to add http-auth.json for a manual install.

* Re-written temp logic

New color logic and move server to port 80.

* syntax bug

* Monitor brightness fix

Allow configuring a scaler to set Monitor brightness from lux

* Run from port 80

partial commit to run from port 80

* Update README.md

Added Install step for update crontab file

* Update svc_usb.py

Ignore hidden files (those that start with "."

* Update README.md

Made changes to re-purpose the Philip branch readme to this one.

* Update Readme

Removed Migration.md and minor updates to Readme

* Update Readme 

Install and update from python3 branch
@dadr
Copy link
Contributor Author

dadr commented Jun 9, 2021

This is addressed in the python3 branch (v2)

@dadr dadr closed this as completed Jun 9, 2021
mrworf pushed a commit that referenced this issue Jun 27, 2021
* Update base.py

Changed the way `sum` was computed in `getImagesTotal()` to avoid black screen with "no (new) images could be found" in the warning log.

* Update display.py

Fix Fill and Do Nothing image handling.

* Update base.py

Addresses #186
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

No branches or pull requests

1 participant