Active Topics

 



Notices


Reply
Thread Tools
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#21
wuhaha
got it ^^

Code:
#!/bin/bash

# determine number of files in /dconfs
cd /etc/hildon-welcome.d/dconfs/
nof=$(ls *.conf | wc -l)

# get random number
rn=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")

# in range of 1 - nof
let "rr = $rn % $nof + 1"

# choose random conf
rf="$rr.conf"
echo "$rr.conf"

# copy it over to default.conf
cp $rf ../default.conf

# exit
exit 0
the new random number generator looks quite ugly but it works (look at the pic at the bottom)
(i only have 2 confs in the dconfs-folder ^^)

maybe i'll try to get it in rc2.d
a shortcut on the desktop (for doing it manually) to this script is done very fast (:
Attached Images
 

Last edited by b666m; 2010-02-18 at 21:28.
 

The Following User Says Thank You to b666m For This Useful Post:
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#22
if anybody is interested in this random bootvideo shortcut on the desktop. i could write a short how-to
 
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#23
Hi b666m
Can you write please the "how-to" for a noob in Linux....

1) How-to random video automaticly

2) How-to random bootvideo shortcut on the desktop

Thanks
 
Posts: 527 | Thanked: 121 times | Joined on Feb 2010
#24
Originally Posted by b666m View Post
if anybody is interested in this random bootvideo shortcut on the desktop. i could write a short how-to
I really would like a step by step as well...
Than I will get smarter in this
 
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#25
omg... the shortcut wasn't as easy as i thought it would be... but finally it's working...

instructions:
1. download the zip-file and unpack the two files anywhere in a new folder in your MyDocs. for example: ~/MyDocs/randomvid/
(unplug usb cable)
2. open xterm and type "sudo gainroot"
3. type "mkdir /etc/hildon-welcome.d/dconfs"
4. in this folder you have to store your default.conf files named 1.conf, 2.conf, 3.conf and so on (you have to start with 1 and then incremental count up (2, 3, 4, 5,...))
5. type "cd MyDocs/randomvid/"
6. type "cp rvid.sh /etc/hildon-welcome.d/"
7. type "chmod a+x /etc/hildon-welcome.d/rvid.sh"
8. type "cp rvid.desktop /usr/share/applications/hildon/"
9. close xterm, go to your desktop and add the shortcut named "rvid".

it uses the terminal-icon. if you want your own icon do following:
1. place a .png with 48 * 48 px in /usr/share/icons/hicolor/48x48/hildon/
(for example: rvid.png)
2. open the rvid.desktop with a editor and change the icon-line to:
"Icon=rvid". save it.
3. you may have to reboot your device.

thanks go to:
fatalsaint for pointing me in the right direction with the desktop file.
(http://talk.maemo.org/showpost.php?p...7&postcount=66)
subcore for hack-around changing xterm to busybox.
(http://talk.maemo.org/showpost.php?p...9&postcount=11)
archebyte for changing the desktop-icon and some other neat work.
(http://talk.maemo.org/showpost.php?p...0&postcount=26)

edit:
it's normal that the terminal opens up, stays black and closes after a few seconds.
it's also normal that it may replaces the current default.conf with the same config - so your video may not change everytime you click on it. but hey... that's randomness ;D

EDIT: updated the rvid.sh with new code with generates random number out of date and checks which default.conf is used at the moment so the video is changed every time you click it
(code is available on page 4 where the instructions are given on how to do this random vid change automatically ^)
Attached Files
File Type: zip rvid.sh.zip (448 Bytes, 154 views)

Last edited by b666m; 2010-02-21 at 18:47.
 

The Following 2 Users Say Thank You to b666m For This Useful Post:
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#26
script:
Code:
#!/bin/bash

cd /etc/hildon-welcome.d/dconfs/

if [ -f 1.conf ]; then

# determine number of files in /dconfs
nof=$(ls *.conf | wc -l)

# get random number
rna=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")
rna=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")

if [ $rna -ge $rnb ]; then
let "rn = $rna - $rnb"
else
let "rn = $rnb - $rna"
fi

# in range of 1 - nof
let "rr = $rn % $nof + 1"

# choose random conf
rf="$rr.conf"
echo "$rr.conf"

# copy it over to default.conf
cp $rf ../default.conf

fi

# exit
exit 0
(added check if "1.conf" exists. yes: run the script and exit 0. no: quit with exit 0.)
(edit: for some reason there was 5:1 chance of 2.conf to 1.conf... so i added some more randomness by creating two random numbers and substract the smaller number from the greater one.)
(edit2: i could add some lines which force the bootvideo to change. in the current version the default could be replaced by the same file and the bootvideo would still be the same. good idea? bad idea?!)

desktop:
Code:
[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Terminal=true
Name=rvid
Exec=/bin/busybox sh -c 'echo sh /etc/hildon-welcome.d/rvid.sh | sudo gainroot'
Icon=terminal
#X-Window-Icon=
X-Window-Icon=     
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

Last edited by b666m; 2010-02-20 at 00:01.
 

The Following User Says Thank You to b666m For This Useful Post:
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#27
where I need put the video files ? to /MyDocs/randomvid/ ?
or in default folder /media ?
 
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#28
Originally Posted by Schturman View Post
where I need put the video files ? to /MyDocs/randomvid/ ?
or in default folder /media ?
0. sudo gainroot
(get root-terminal)
1. cp -r /usr/share/hildon-welcome/media /opt/
(this should make /opt/media with the nokia hands video as content)
2. rm -r /usr/share/hildon-welcome/media
(this should remove the media folder from there)
3. cd /usr/share/hildon-welcome
(change the directory ^^)
4. ln -s /opt/media media
(symlinking /opt/media to /usr/share/hildon-welcome/media)

then you can put all of your videos into /opt/media/

Last edited by b666m; 2010-02-20 at 13:14.
 

The Following User Says Thank You to b666m For This Useful Post:
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#29
I get this ! Thank you very much !
Another question, can we get this process automatically, without pressing on the button on desktop before reboot ? I mean on all reboot it the load another video ? (sorry for my ugly english :-) )
 
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#30
Originally Posted by Schturman View Post
I get this ! Thank you very much !
Another question, can we get this process automatically, without pressing on the button on desktop before reboot ? I mean on all reboot it the load another video ? (sorry for my ugly english :-) )
maybe someone will write a init-script which executes my shell-script at bootup or shutdown (:

haven't done this before... but i could take a look... (better said: google could have a look ^^)

CAN ANYONE PROVIDE AN INIT SCRIPT WHICH LAUNCHES A SHELL SCRIPT?

Last edited by b666m; 2010-02-19 at 23:40.
 
Reply


 
Forum Jump


All times are GMT. The time now is 16:56.