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

[Feature Request] Avoid duplicate wallpaper in random mode #115

Open
3 tasks done
contact-maximux opened this issue Nov 19, 2024 · 26 comments · May be fixed by #149
Open
3 tasks done

[Feature Request] Avoid duplicate wallpaper in random mode #115

contact-maximux opened this issue Nov 19, 2024 · 26 comments · May be fixed by #149
Assignees
Labels
feature request New feature or request low priority This issue has low priority

Comments

@contact-maximux
Copy link

contact-maximux commented Nov 19, 2024

Confirmation

Feature Description

add feature to not use wallpaper of last #N duration

Describe the Solution

I have 6000 wallpaper in one folder. I want app must not pick any wallpaper used earlier.

Whenever you do. May be achieved like this

Ask permission to rename all wallpapers name
Now before applying any wallpaper just rename it to some pattern
Now for next wallpaper button: search image not having above pattern
When all image renamed to that pattern, that means all wallpaper has been used.
Now you can remove that pattern string from all images and notify user that "Wallpaper exhausted. NOW WALLPAPER WILL BE REPEATED"
Problem solved without Database

Describe Alternatives

No response

Additional Context

No response

Sufficiency Confirmation

  • I have provided all the information requested above and deemed sufficient for the developer to address the issue
@contact-maximux contact-maximux added the feature request New feature or request label Nov 19, 2024
@Hamza417
Copy link
Owner

Then why not use Pick in Linear Order toggle? It was added to solve a similar problem #50

@Hamza417 Hamza417 added the low priority This issue has low priority label Nov 19, 2024
@contact-maximux
Copy link
Author

contact-maximux commented Nov 20, 2024 via email

@Hamza417
Copy link
Owner

The linear picker only remembers the position of the last set wallpaper meaning it starts from the beginning and one by one sets the next wallpaper until the last and then starts again and in the auto wallpaper the list is sorted by date of the file and doesn't adhere to the configurations you are using in the app. So, there is a very low chance your wallpaper will repeat unless the list if modified or its state has changed like few new wallpapers are added or deleted then the position may set arbitrary or repeating wallpapers until its last correct location is reached.

@contact-maximux
Copy link
Author

contact-maximux commented Nov 20, 2024

Thanks for attentional reply. App is already at sweet spot. I love it. Though can be overdo or little impactful
Suggestion:
Example: No repeat wallpaper till 10 days until there are fresh images in folder.
May there will be a container which hold the name of image applied and avoid using any image as wallpaper whose name exist in container. Reset that container after 10 days or when no images left used. Sorry I am not technical to elaborate that deeply.

@Hamza417
Copy link
Owner

May there will be a container which hold the name of image applied and avoid using any image as wallpaper whose name exist in container. Reset that container after 10 days or when no images left used. Sorry I am not technical to elaborate that deeply.

I thought about adding a persistent memory for auto wallpaper but deemed it unnecessary. I think something like this can be added, a separate database would do.

@frfeed123
Copy link

Any work on it yet?

@Hamza417
Copy link
Owner

Any work on it yet?

Not yet, this particular issue requires a little bit of testing and thought processing since there are a lot of variables involved and all of them need to work correctly. And, recently, #122 and #98 will need to be addressed as well. Any updates will be posted here by default once I begin working on the issue. I am just a bit occupied lately with academics and learning.

@contact-maximux
Copy link
Author

Whenever you do. May be achieved like this

  • Ask permission to rename all wallpapers name
  • Now before applying any wallpaper just rename it to some pattern
  • Now for next wallpaper button: search image not having above pattern
  • When all image renamed to that pattern, that means all wallpaper has been used.
  • Now you can remove that pattern string from all images and notify user that "Wallpaper exhausted. NOW WALLPAPER WILL BE REPEATED"

Problem solved without Database
Problem: I have 1000+ wallpaper in folder but each time I saw only few wallpapers. I hate it.
@Hamza417 @frfeed123

@contact-maximux contact-maximux changed the title [Feature Request] Duplicate wallpaper in random mode [Feature Request] Avoid duplicate wallpaper in random mode Feb 18, 2025
@Hamza417 Hamza417 linked a pull request Feb 18, 2025 that will close this issue
@Hamza417
Copy link
Owner

app-prod-release.zip

Test the app file and let me know what didn't work.

@ZornHadNoChoice
Copy link

  • Ask permission to rename all wallpapers name

I personally wouldn't like my wallpaper names to be changed, so this should be optional if it's implemented.

@Hamza417
Copy link
Owner

  • Ask permission to rename all wallpapers name

I personally wouldn't like my wallpaper names to be changed, so this should be optional if it's implemented.

No, I created a database and fetched the difference of the wallpapers. It should correspond to this diagram. The A is the wallpaper we will use and B is wallpaper that has been already used. It runs until A is exhausted, then B is cleaned up and repeat.

Image

@ZornHadNoChoice
Copy link

Nice! I think I can benefit from this feature too since I have 2300 wallpapers that would take forever to show up all if they repeated.

The A is the wallpaper we will use

I hope you meant A-B. Did not expect a Ven diagram here 😅.

@ZornHadNoChoice
Copy link

Test the app file and let me know what didn't work.

I couldn't find an option to enable this new feature. If there isn't one, please add it!

@Hamza417
Copy link
Owner

Test the app file and let me know what didn't work.

I couldn't find an option to enable this new feature. If there isn't one, please add it!

I decided to make it the default behavior, so no toggle needed. It will just work.

@ZornHadNoChoice
Copy link

I decided to make it the default behavior, so no toggle needed. It will just work.

But what if I stopped liking this feature, an option to disable it would be appreciated.

@contact-maximux
Copy link
Author

should

I agree this. But it can be no change wallpaper name, like
river.jpg => river_peristyle_timestamp.jpg

When done. name back to original. I don't think adding a suffix in any file will effect any of existing setup.

@Hamza417
Copy link
Owner

A database approach is the most suitable one here, all files are already assigned proper IDs to them, I only needed to create a different set for used wallpapers and then compare the list each time a wallpaper operation occurs and most importantly it's really fast with almost zero load on the system unlike renaming a file which poses a risk of significant I/O load for huge number of files.

@contact-maximux
Copy link
Author

A database approach is the most suitable one here, all files are already assigned proper IDs to them, I only needed to create a different set for used wallpapers and then compare the list each time a wallpaper operation occurs and most importantly it's really fast with almost zero load on the system unlike renaming a file which poses a risk of significant I/O load for huge number of files.

This suits well. But require more work. Alternate like having filename in .file in same folder as added one.

@contact-maximux
Copy link
Author

contact-maximux commented Feb 19, 2025

app-prod-release.zip

Test the app file and let me know what didn't work.

Each time wallpaper change(Auto or clicking NEXT WALLPAPER) error comes. Tried both method.

  • API wallpaper
  • Next wallpaper

I set delay one minute and now after every minute it s giving error notification.

java.util.NoSuchElementException: Collection is empty. at kotlin.collections.CollectionsKt.random(SourceFile:31) at app.simple.peri.abstraction.AbstractAutoWallpaperService$getRandomWallpaperFromDatabase$2.invokeSuspend(SourceFile:168) at app.simple.peri.abstraction.AbstractAutoWallpaperService$getRandomWallpaperFromDatabase$2.invoke(SourceFile:13) at kotlin.time.DurationKt.startUndispatchedOrReturn(SourceFile:5) at kotlinx.coroutines.JobKt.withContext(SourceFile:74) at app.simple.peri.services.AutoWallpaperService.access$getLockScreenWallpaper(SourceFile:335) at app.simple.peri.abstraction.AbstractComposeAutoWallpaperService$setComposeWallpaper$1.invokeSuspend(SourceFile:348) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:9) at kotlinx.coroutines.DispatchedTask.run(SourceFile:113) at androidx.core.app.ActivityRecreator$1.run(SourceFile:12) at kotlinx.coroutines.scheduling.TaskImpl.run(SourceFile:3) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:96)

Hamza417 added a commit that referenced this issue Feb 19, 2025
@Hamza417
Copy link
Owner

app-prod-release.zip

This should fix it

@ZornHadNoChoice
Copy link

It seems that setting the wallpaper manually works, but using the Next Wallpaper button doesn't. Then I tried Live Auto Wallpaper button and set the wallpaper to home, and I got this notification:

Error getting wallpaper by folder: java.util.NoSuchElementException: Collection is empty.

@ZornHadNoChoice
Copy link

Also, I keep getting "an instance is already running, please wait" and "changing wallpaper, please wait" but nothing changes. And I got this now:

Image

Hamza417 added a commit that referenced this issue Feb 19, 2025
@Hamza417
Copy link
Owner

Hamza417 commented Feb 19, 2025

app-prod-release.zip

I mistakenly used the same instance of the wallpaper database, this should fix it. Make sure your wallpaper database is valid before hitting the next wallpaper button.

@contact-maximux
Copy link
Author

contact-maximux commented Feb 19, 2025

app-prod-release.zip

I mistakenly used the same instance of the wallpaper database, this should fix it. Make sure your wallpaper database is valid before hitting the next wallpaper button.

Fresh install, fresh wallpaper folder added. No error observed. checking randomness and duplicity. You did magic. Wallpaper changing taken time is extremely fast.

WhatsApp.Video.2025-02-19.at.15.54.43.mp4

@ZornHadNoChoice
Copy link

@Hamza417 Just a question: does the "Recreate Database" option reset the list of wallpapers already used?

@Hamza417
Copy link
Owner

It should only affect the folders' database. The wallpaper memory database gets cleared when the list is exhausted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request low priority This issue has low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants