The officially official Devuan Forum!

You are not logged in.

#1 2022-11-08 05:53:10

zapper
Member
Registered: 2017-05-29
Posts: 472  

[SOLVED] make xstarfish randomize the names,

Aka:

when I type starfish -d duration

duration being whatever time I mean, sadly it does the same filename no matter what.

CLI is preferred, but in general, wondered if anyone knows how to do this.

Or for that matter, even doing something akin to,  making a random directiory, cding to it, then transmitting the format and then cding and repeating again and again.

Or to put it another way...

mkdir random directory
cd to random directory
then make the wallpaper
cd
repeat

I have a love for the xstarfish wallpapers it creates.

smile


Black Lives Matter!  I am white, but I prefer equality over hatred.
Haughtiness comes before a fall, pride before destruction.
Peace be with you!
No one can serve two masters. Either you will hate the one and love the other, or you will be devoted to the one and despise the other. You cannot serve both God and mammon!

Offline

#2 2022-11-08 17:05:53

chris2be8
Member
Registered: 2018-08-11
Posts: 168  

Re: [SOLVED] make xstarfish randomize the names,

Try the following (WARNING - untested code- WARNING):

#!/bin/bash
FLAG=0
until [[ $FLAG = "1" ]]
do
DIR=$(date +%N)
mkdir $DIR
if  (($?>0)) ;then exit;fi
cd $DIR
if  (($?>0)) ;then exit;fi
starfish -d duration
# Tidy up anything if you want here
cd ..
if  (($?>0)) ;then exit;fi
rmdir $DIR # Optional
if  (($?>0)) ;then exit;fi
done

date +%N returns the current time in nanoseconds, so will very rarely repeat.

But I don't have starfish, so I can't test this. Use at your own risk.

Last edited by chris2be8 (2022-11-09 17:19:40)

Offline

#3 2022-11-09 17:21:31

chris2be8
Member
Registered: 2018-08-11
Posts: 168  

Re: [SOLVED] make xstarfish randomize the names,

I've just fixed a bug in the above script (I had a do missing) and tested it after replacing "starfish -d duration" with "sleep 5". So it might work now.

Offline

#4 2022-11-09 20:04:14

zapper
Member
Registered: 2017-05-29
Posts: 472  

Re: [SOLVED] make xstarfish randomize the names,

chris2be8 wrote:

I've just fixed a bug in the above script (I had a do missing) and tested it after replacing "starfish -d duration" with "sleep 5". So it might work now.

The above script, works in making multiple directories, but there is one thing:

After I make the directory, I want to output a file, which I seemed to have forgotten, requires the -o

option... after the duration.

After which, I want to make a new wallpaper in said location and when it does, have the command cd used,    then repeat, etc...

The folder I want to be the wallpaper one, aka, where it makes new wallpapers:

would be called WallpaperZone or something like that...

wink

So it seems I made some really silly blunders, in my explanation of what I wanted... sorry bout that...

That being said, you got most of this right already. smile

Although, I wonder if this can be done directly with, making random wallpapers just in the same directory itself...

Aka, having each wallpaper have a different date name.

I wonder...

Anywho, let me know if this is possible...


Black Lives Matter!  I am white, but I prefer equality over hatred.
Haughtiness comes before a fall, pride before destruction.
Peace be with you!
No one can serve two masters. Either you will hate the one and love the other, or you will be devoted to the one and despise the other. You cannot serve both God and mammon!

Offline

#5 2022-11-10 06:58:30

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 2,752  

Re: [SOLVED] make xstarfish randomize the names,

#!/bin/sh 

dir="$HOME/WallpaperZone"
count="1"

mkdir -p "$dir"
while [ $count -lt 11 ] ; do
   starfish -o "$dir"/Wallpaper"$count"
   count=$((count+1)) # ah ha ha
done

Add set -eo pipefail as the first line (after the shebang) if you want the script to exit after any of the commands fail.

EDIT: that example provides 10 images, change the -lt 11 bit to modify that.

EDIT2: added counting Count reference. I love jokes in the comments.

Last edited by Head_on_a_Stick (2022-11-10 14:25:59)


"Who's the idiot in charge?" — ralph.ronnquist

Offline

#6 2022-11-11 03:24:03

zapper
Member
Registered: 2017-05-29
Posts: 472  

Re: [SOLVED] make xstarfish randomize the names,

Head_on_a_Stick wrote:
#!/bin/sh 

dir="$HOME/WallpaperZone"
count="1"

mkdir -p "$dir"
while [ $count -lt 11 ] ; do
   starfish -o "$dir"/Wallpaper"$count"
   count=$((count+1)) # ah ha ha
done

Add set -eo pipefail as the first line (after the shebang) if you want the script to exit after any of the commands fail.

EDIT: that example provides 10 images, change the -lt 11 bit to modify that.

EDIT2: added counting Count reference. I love jokes in the comments.

This one is very good!

Just one small thing though, is there a finite limit?

Also, as a last question, how many files would be a bad idea to have in one folder for someone like me?

As a huge important hint, I should mention:
I have two libreboot X200 computers... one of them is in a very not so good shape, as an unneeded info... wink
One X230,, which mostly works, beyond a key missing, Dual core i5-3380M
one T430i which has a quad core processor i7-3632QM

I bring this, wondering how many files in a folder would cause me the same problem I have when I read a /etc/hosts type adblock filterlist with 1 million, or one hundred thousand lines on it...

One million takes a bit to load,  on T430...
A lot Longer time on X230 but loadable.
However, if its the X200... forget about it!

xD

Although, beyond this, probably I am good for now.

But do you have any advice?

Waiting on that before I mark solved.


Black Lives Matter!  I am white, but I prefer equality over hatred.
Haughtiness comes before a fall, pride before destruction.
Peace be with you!
No one can serve two masters. Either you will hate the one and love the other, or you will be devoted to the one and despise the other. You cannot serve both God and mammon!

Offline

#7 2022-11-11 06:46:46

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 2,752  

Re: [SOLVED] make xstarfish randomize the names,

zapper wrote:

is there a finite limit?

No. Use this construct to start an infinite loop:

while : ; do
   [stuff]
done

https://pubs.opengroup.org/onlinepubs/0 … colon.html

zapper wrote:

how many files would be a bad idea to have in one folder for someone like me?

Infinite files would be a bad idea. Otherwise the image tiles are about 100KiB in size so it depends how big your hard drive is. Many files would only cause a slowdown if you tried to view them all at once, for example in a graphical file manager with thumbnails enabled.

Last edited by Head_on_a_Stick (2022-11-11 08:30:43)


"Who's the idiot in charge?" — ralph.ronnquist

Offline

#8 2022-11-13 08:57:01

GlennW
Member
Registered: 2019-07-18
Posts: 300  

Re: [SOLVED] make xstarfish randomize the names,

zapper wrote:

I bring this, wondering how many files in a folder would cause me the same problem I have when I read a /etc/hosts type adblock filterlist with 1 million, or one hundred thousand lines on it...

One million takes a bit to load,  on T430...
A lot Longer time on X230 but loadable.

hi, Have you seen a noticable difference with host addblock?

I had been using ...

# This MVPS HOSTS file is a free download from:            #
# http://winhelp2002.mvps.org/hosts.htm                          #

but unloaded it about 2 months ago and haven't really noticed a flood of adds. offtopic I know, but... ?

Offline

#9 2022-11-14 03:22:20

zapper
Member
Registered: 2017-05-29
Posts: 472  

Re: [SOLVED] make xstarfish randomize the names,

GlennW wrote:
zapper wrote:

I bring this, wondering how many files in a folder would cause me the same problem I have when I read a /etc/hosts type adblock filterlist with 1 million, or one hundred thousand lines on it...

One million takes a bit to load,  on T430...
A lot Longer time on X230 but loadable.

hi, Have you seen a noticable difference with host addblock?

I had been using ...

# This MVPS HOSTS file is a free download from:            #
# http://winhelp2002.mvps.org/hosts.htm                          #

but unloaded it about 2 months ago and haven't really noticed a flood of adds. offtopic I know, but... ?

Yeah... about that... your comment is in fact off topic quite a bit... nothing new for me  tho... tongue

With that out of the way, that host link you had, is beyond outdated if you look up their sources.

Just a heads up...

big_smile


Black Lives Matter!  I am white, but I prefer equality over hatred.
Haughtiness comes before a fall, pride before destruction.
Peace be with you!
No one can serve two masters. Either you will hate the one and love the other, or you will be devoted to the one and despise the other. You cannot serve both God and mammon!

Offline

#10 2022-11-14 03:25:24

zapper
Member
Registered: 2017-05-29
Posts: 472  

Re: [SOLVED] make xstarfish randomize the names,

Head_on_a_Stick wrote:
zapper wrote:

is there a finite limit?

No. Use this construct to start an infinite loop:

while : ; do
   [stuff]
done

https://pubs.opengroup.org/onlinepubs/0 … colon.html

zapper wrote:

how many files would be a bad idea to have in one folder for someone like me?

Infinite files would be a bad idea. Otherwise the image tiles are about 100KiB in size so it depends how big your hard drive is. Many files would only cause a slowdown if you tried to view them all at once, for example in a graphical file manager with thumbnails enabled.

Can you show me an example of theloop you mentioned?

Something akin to,  create new wallpaper via starfish per duration with a different name via date, then start over,

Been trying to get it to work, but it gives me the unexpected end issue when I try...

*sigh*

wink


Black Lives Matter!  I am white, but I prefer equality over hatred.
Haughtiness comes before a fall, pride before destruction.
Peace be with you!
No one can serve two masters. Either you will hate the one and love the other, or you will be devoted to the one and despise the other. You cannot serve both God and mammon!

Offline

#11 2022-11-14 06:03:59

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 2,752  

Re: [SOLVED] make xstarfish randomize the names,

zapper wrote:

Can you show me an example of theloop you mentioned?

I already have. Replace [stuff] with the commands to be repeated.

zapper wrote:

Been trying to get it to work, but it gives me the unexpected end issue when I try...

Show us your attempts.

Last edited by Head_on_a_Stick (2022-11-14 06:04:11)


"Who's the idiot in charge?" — ralph.ronnquist

Offline

#12 2022-11-15 00:12:48

zapper
Member
Registered: 2017-05-29
Posts: 472  

Re: [SOLVED] make xstarfish randomize the names,

This was my latest attempt, more or less, I kind of wanted to have it occur every so often, via a specific duration... wink
#!/bin/sh
while : ; do
dir="$HOME/WallpaperZone"
count="1"

mkdir -p "$dir"
while [ $count -lt 11 ] ; do
   starfish -o "$dir"/Wallpaper"$count"
   count=$((count+1)) # ah ha ha
sleep 60000
done

Actually, this is going to sound insane, but I just found my error... stupid or not

insert embarrassed face here...  __________

seems I have two different sets of "whiles"  this doesn't work, does it...

xD

EDIT: FINAL hopefully?

#!/bin/sh
while : FLAG=0; do
touch=$(date +%N)
    starfish -d 60 -o ~/Wallpaper/$(date +%N)
sleep 60000
done

I use this and it works, except for one thing...

*Keeps trying to change the most recent one and not create a new one from the CURRENT date*

Last edited by zapper (2022-11-15 01:08:18)


Black Lives Matter!  I am white, but I prefer equality over hatred.
Haughtiness comes before a fall, pride before destruction.
Peace be with you!
No one can serve two masters. Either you will hate the one and love the other, or you will be devoted to the one and despise the other. You cannot serve both God and mammon!

Offline

#13 2022-11-15 07:09:20

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 2,752  

Re: [SOLVED] make xstarfish randomize the names,

I think you need to explain exactly what you want to do here.

In respect of this:

#!/bin/sh
while : FLAG=0; do
touch=$(date +%N)
    starfish -d 60 -o ~/Wallpaper/$(date +%N)
sleep 60000
done

Why FLAG=0? I think chris2be8 was using that to create an infinite loop but my while : bit does that already.

Why have you set the touch variable and then not used it?

Why are you using the -d flag for starfish? I think that controls the delay between switching wallpapers when it's run in daemon mode. It's not needed at all if you just want to create a bunch of wallpaper image files.

If you just want a random wallpaper switcher then run starfish as a daemon, then you won't have to save any image files at all because they will be generated on demand. I think this is the intended mode of operation anyway.


"Who's the idiot in charge?" — ralph.ronnquist

Offline

#14 2022-11-17 21:40:13

zapper
Member
Registered: 2017-05-29
Posts: 472  

Re: [SOLVED] make xstarfish randomize the names,

Head_on_a_Stick wrote:

I think you need to explain exactly what you want to do here.

In respect of this:

#!/bin/sh
while : FLAG=0; do
touch=$(date +%N)
    starfish -d 60 -o ~/Wallpaper/$(date +%N)
sleep 60000
done

Why FLAG=0? I think chris2be8 was using that to create an infinite loop but my while : bit does that already.

Why have you set the touch variable and then not used it?

Why are you using the -d flag for starfish? I think that controls the delay between switching wallpapers when it's run in daemon mode. It's not needed at all if you just want to create a bunch of wallpaper image files.

If you just want a random wallpaper switcher then run starfish as a daemon, then you won't have to save any image files at all because they will be generated on demand. I think this is the intended mode of operation anyway.

I actually, just realized something beyond stupid and possibly insane...

As long as I keep "using it" and the folder its being created in, is open, theoretically, it should keep pumping them out... and as long as I don't do what I usually do... aka, use bleachbit, nonstop, etc... to delete thumbnails, etc...

The problem is basically solved...

facepalm.jpeg seems appropriate here... like on an insane scale...

xD

So...  my apologies, its solved.  Btw, I think that was what you just said, right?

The funny thing is, for some unknown reason, a lightbulb went off when I was deleted files via bleachbit-gtk...

the .thumbnails folder... is the solution!

Anyways, thanks for the help... I appreciate it!

The only thing I really need to do which should be easy enough, is to make sure when I exit jwm, I have it set to paste those files elsewhere on shutdown... 

smile


Black Lives Matter!  I am white, but I prefer equality over hatred.
Haughtiness comes before a fall, pride before destruction.
Peace be with you!
No one can serve two masters. Either you will hate the one and love the other, or you will be devoted to the one and despise the other. You cannot serve both God and mammon!

Offline

Board footer