Remembering previous wallpaper

Asked by Oleg on 2014-09-22

Hello,

Is there a way to configure the amount of pictures the program remember? This is in regards to that I have 1000 pictures in my folder , yet I notice several times the same picture appears repeatedly. I would like to go over the whole folder before repeating them.

Thanks

Oleg

Question information

Language:
English Edit question
Status:
Answered
For:
Variety Edit question
Assignee:
No assignee Edit question
Last query:
2014-10-25
Last reply:
2017-11-04
Peter Levi (peterlevi) said : #1

Variety does not build a DB of the images in your folders. It prepares a short image queue of around 100 images, and once it exhausts it, it fills it with random images again with whatever is in the folders at present. It does not keep track of how many times every image has been shown, how many total images are there, etc. This reflects the "dynamic" nature of Variety's image folders when you have downloading enabled.

Oleg (oleg-tarassov) said : #2

Thank you for taking time to answer me, final question regarding this; is possible to increase the queue from 100 to 1000?

This would solve my question in terms of image repetition too often.

Thanks

--- Original Message ---

From: "Peter Levi" <email address hidden>
Sent: September 23, 2014 7:09 AM
To: <email address hidden>
Subject: Re: [Question #254827]: Remembering previous wallpaper

Your question #254827 on Variety changed:
https://answers.launchpad.net/variety/+question/254827

    Status: Open => Answered

Peter Levi proposed the following answer:
Variety does not build a DB of the images in your folders. It prepares a
short image queue of around 100 images, and once it exhausts it, it
fills it with random images again with whatever is in the folders at
present. It does not keep track of how many times every image has been
shown, how many total images are there, etc. This reflects the "dynamic"
nature of Variety's image folders when you have downloading enabled.

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/variety/+question/254827/+confirm?answer_id=0

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/variety/+question/254827

You received this question notification because you asked the question.

Launchpad Janitor (janitor) said : #3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Oleg (oleg-tarassov) said : #4

Is there a way?

--- Original Message ---

From: "Launchpad Janitor" <email address hidden>
Sent: October 9, 2014 6:57 AM
To: <email address hidden>
Subject: Re: [Question #254827]: Remembering previous wallpaper

Your question #254827 on Variety changed:
https://answers.launchpad.net/variety/+question/254827

    Status: Open => Expired

Launchpad Janitor expired the question:
This question was expired because it remained in the 'Open' state
without activity for the last 15 days.

--
If you're still having this problem, you can reopen your question either
by replying to this email or by going to the following page and
entering more information about your problem:
https://answers.launchpad.net/variety/+question/254827

You received this question notification because you asked the question.

Launchpad Janitor (janitor) said : #5

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Oleg (oleg-tarassov) said : #6

--- Original Message ---

From: "Launchpad Janitor" <email address hidden>
Sent: October 25, 2014 6:21 AM
To: <email address hidden>
Subject: Re: [Question #254827]: Remembering previous wallpaper

Your question #254827 on Variety changed:
https://answers.launchpad.net/variety/+question/254827

    Status: Open => Expired

Launchpad Janitor expired the question:
This question was expired because it remained in the 'Open' state
without activity for the last 15 days.

--
If you're still having this problem, you can reopen your question either
by replying to this email or by going to the following page and
entering more information about your problem:
https://answers.launchpad.net/variety/+question/254827

You received this question notification because you asked the question.

Peter Levi (peterlevi) said : #7

Oleg, everybody has a different number of images in their folders and different expectations of how Variety should cycle them. The current algorithm is a decent compromise between what most users consider good wallpaper choosing behaviour, memory consumption and disk I/O load. I am not intending to change it for now. In a future version I might add options to fine-tune this behavior, like forcing Variety to cycle images in alphabetical or chronological order, forcing it to show every image at least once before starting to cycle, etc. But I'm focused on some very different aspects of Variety at the moment, so this won't be soon.

Marco (suikoy) said : #8

Hi Peter, I would add to the discussion because as Oleg said, often see the same pictures is something that should not happen.
In my case I set variety to change the wallpaper on pc start but I think that the pictures list that variety chooses is totally random without taking into account the previous image queue.
So my idea is: would it be possible to write for example in a text file, the list generated by the algorithm and a cursor that indicates the current background? So in this way variety could check if the list is present and if yes get a new wallpaper from the queue by simply incrementing the cursor.
Finally, when the cursor reaches the last element of the queue, the image selection algorithm can be called again to create a new queue and reset the cursor.
I hope I have given you an interesting cue to work on.
Many thanks for your support ;)

Oleg (oleg-tarassov) said : #9

Hello everyone, been a while -

I have been using another mechanism to perform these via cron and shell but I would love to switch back to variety. I believe Variety is using dconf to store its configs including the pictures in its bank. All that is needed is a pop from that list and when list is empty execute the algorithm to populate it once again.

Here is my version of Michele Bonazza script, hope this can give you an idea how to implement this. In short, I create a state file with my pictures and their relative paths after executing the algorithm. At that point, I just pop the first element. When file is empty, I re-execute the algorithm to populate it or if the file is missing. All via cron so the process does not live and waste resources.

```
#!/bin/bash
#
# WallpaperChanger.sh
# Copyright 2014 Michele Bonazza <email address hidden>
#
# A simple script to automatically change your wallpaper in Gnome.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

WALLPAPERS_STATE=/home/oleg/.wallpapers_state
WALLPAPERS_FOLDER=/home/oleg/OneDrive/Pictures/Wallpaper/
REFRESH_INTERVAL=$((240 * 60)) # change every 4 hours
MODE="zoom" # one between none, centered, wallpaper, scaled, stretched, zoom, spanned
NEXT_WP=""

# Changes the desktop background, and moves it to the "shown" folder so that it's
# not shown again before all wallpapers in the folder have been used.
# arg1 the file name of the file to be set as new background; must be in the
# current folder
function change_wallpaper() {
  gsettings set org.gnome.desktop.background picture-uri file://"$1"
  gsettings set org.gnome.desktop.background picture-options $MODE
}

# Echoes the next wallpaper to be set, picked at random among images in the
# configured folder
function get_next_wallpaper() {
  if [ ! -s $WALLPAPERS_STATE ]
  then
    /usr/bin/logger -t wallpaper-changer "Initializing State File"
    touch $WALLPAPERS_STATE
    find $WALLPAPERS_FOLDER -maxdepth 2 -type f -name "*.png" -o -name "*.jpg" -o -name "*.gif" -o -name "*.jpeg" | shuf > $WALLPAPERS_STATE
  fi

  while [[ $NEXT_WP == "" ]]
  do
    WP=$(head -n1 $WALLPAPERS_STATE)
    sed -i '1d' $WALLPAPERS_STATE
    if [ -f "$WP" ]
    then
      NEXT_WP=$WP
    else
      /usr/bin/logger -t wallpaper-changer "ERROR: $WP does not exist"
    fi
  done
}

function main(){
    get_next_wallpaper

    /usr/bin/logger -t wallpaper-changer "INFO: Changing to $NEXT_WP"
    change_wallpaper "$NEXT_WP"
}

if [[ $1 == "next" ]]; then
    main
    exit 0
else
    while true; do
        main
        sleep $REFRESH_INTERVAL
    done
fi

```

Can you help with this problem?

Provide an answer of your own, or ask Oleg for more information if necessary.

To post a message you must log in.