forked from dv336699/MMM-RandomPhoto
-
Notifications
You must be signed in to change notification settings - Fork 7
Added rescan interval #4
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
Open
MystaraTheGreat
wants to merge
8
commits into
skuethe:master
Choose a base branch
from
MystaraTheGreat:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ba0ff17
Added rescan interval
MystaraTheGreat 8c5222b
Fixed error in which function became out of scope
MystaraTheGreat a376de8
Added documentation
MystaraTheGreat 6642845
Changed tab to spaces
MystaraTheGreat dbc00cd
Changed documentation to mention that scanInterval is in seconds
MystaraTheGreat 2f309a4
Removed package-lock.json
MystaraTheGreat a4d1e57
Changed tabs to spaces
MystaraTheGreat fa3e05a
Rescan interval
MystaraTheGreat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with this timer is, that it will conflict with the
updateIntervaltimer.Also, when you have
startPausedset totrueit will still reload the images and continue with the image cycle on everyscanIntervaltrigger. This breaks usage of thestartPausedsetting and somewhat the one ofupdateInterval.So we need to think of a way to respect these settings before triggering a reload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain this in more detail? I'm not really sure I see how there's a conflict. The two timers should be independent.
I think the issue is that this.load() is getting called on line 107 when startPaused is set to true? Consequently even though startPaused is set to true, the image will keep cycling.
So to fix that, the IMAGE_LIST notification needs to be disconnected from loading an image - at least after an image has already been loaded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well this also has to do with the fact that we are calling
this.load()on everyIMAGE_LISTnotification received. In this case both timers are triggering the load of the next image. That's what I mean with "conflict".Well
this.load()is always called in theresumeImageLoadingfunction. Regardless of whatstartPausedis set to.startHiddenactually handles the call when receiving the notification.After giving it a bit of thought, it is probably best to just get rid of lines 411 to 413.
We are calling the
resumeImageLoadingfunction already during MM²'s extended build-inresumefunction. So that should get the image loading started in the first place.But this needs to be tested to see if the app behaves like it should with all the different config settings - especially
startHiddenandstartPaused.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. It does look as if they would solve the initial issue. But I agree that it's necessary to check the startHidden and startPaused. I'll give it a go here and see what happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, no, doesn't seem to work. The image loading never starts.
A messier fix might be to add a firstImageLoaded flag to indicate whether a first image has loaded or not - and not to call resumeImageLoading if firstImageLoaded is true.
But it seems inelegant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we delete lines 411 to 413 we need to also adjust these lines.
But the problem actually still persists. No display is being shown, because the image loading just takes more time.
So actually invoking the image showing on the
IMAGE_LISTsocketNotification still makes sense (lines 411 to 413).So I would agree the easiest solution probably is to introduce some kind of flag / parameter to indicate if it is an "initial image loading" process or an "update image loading" process.
Some thoughts without going deeper into details:
UPDATE_IMAGE_LISTsocketNotification?this.imageList's lenght to be> 0?asyncandawaitto wait for some executions?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm now testing a version that uses an UPDATE_IMAGE_LIST socket notification. On reception, all it does it replace the imageList. It doesn't do anything regarding resumption.
I haven't followed up on waiting for the imageList length to be >0 or using async/wait. These changes don't seem to be necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above version seems to work. However, I've been having difficulty with the calendar not updating as well, so I'm going to take the simpler option of just restarting MM every day.
Feel free to use the push or not as you like :)