maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   [Script][N900][19/9/2014] NatGeo photo of the day script. (https://talk.maemo.org/showthread.php?t=93857)

marcphemt 2014-09-15 12:06

[Script][N900][19/9/2014] NatGeo photo of the day script.
 
1 Attachment(s)
Hi guys!!
I want to share with all of you a script made by me for download and apply the National Geographic Photo of the day..
It will auto download the new photo and will auto apply the photo as wallpaper on all 4 the screen of hildon home!!

1) You have to install bash3 from HAM or FAM
2) in X-Term type chsh and than, when you see
Code:

Login Shell [/bin/sh]:
type
Code:

/bin/bash
otherwise the script will not work ;)
3) restart X-Term to have bash fully working..
4) type
Code:

sudo gainroot
and than
Code:

apt-get install wget
Now you are ready to download and use the script:

1) From x-term type
Code:

cd MyDocs/
Code:

mkdir photos
Code:

wget --no-check-certificate http://github.com/marcphemt/scrpts/raw/master/n900photooftheday.sh
2) When downloaded type
Code:

chmod +x n900photooftheday.sh
You have done!! :)

To execute the script type in x-term
Code:

cd MyDocs/
and
Code:

./n900photooftheday.sh
For new versions you have to download another time the same script with che same command and than chmod it!!

To add the icon and .desktop to hildon follow this instruction ;)

1) Download zip attached, unzip it, and put files in MyDocs
2) With x-term as root type
Code:

cp /home/user/MyDocs/natgeo.png /opt/usr/share/icons/hicolor/64x64/hildon/
Code:

cp /home/user/MyDocs/natgeo.desktop /usr/share/applications/hildon
3) Reboot

For problems write here or pm me!! :D

Changelog 15/9/2014: Added the command to view the photo just downloaded with image-viewer...if you don't like the new photo of the day you have to simply close x-term!! :)
Changelog 16/9/2014: Added instruction to add icon to hildon :)
Changelog 19/9/2014: Cleaning up the code and added switch for those who use it with QueenBeeCon and corrected lines for file comparison (All thanks goes to Ilew and shawnjefferson)..Just download another time from github!! Cheers.
To Do:

1) Add graphic interface using zenity (i think).
2) Add an option to revert back the old wallpaper.

I ll tell you all changes with changelog..
Hope you like this script.

Cheers
Marcphemt

nokiabot 2014-09-15 12:43

Re: [Script][N900] NatGeo photo of the day script.
 
Wow nice wallpapers everyday ! Also consider uploading to the repos later then maybe a gui or an icon to the script would do even better ;)

roflmaoo 2014-09-15 12:54

Re: [Script][N900] NatGeo photo of the day script.
 
Nice new guy and already with the scripts! Keep it going :)

marcphemt 2014-09-15 13:05

Re: [Script][N900] NatGeo photo of the day script.
 
Thanks guys!! :) i m very happy that you like the script..
About graphic interface: I m planning to learn how to use zenity for a simple interface..hope i can learn something in few time eheheheheeheheheheh :D !!Than i ll learn about make a .deb file to install my works ;)

marcphemt 2014-09-15 16:24

Re: [Script][N900] NatGeo photo of the day script.
 
Hi guys, thanks for the comments...i m happy because you like my work...soon i ll post other works of mine!! :)
BTW now i m studing for the last exam for my veterinary university, so i don't have so much time to study for zenity...but i want to add a graphic interface to my works!! Thanks for the suggestions!!

Cheers

Marcphemt

marcphemt 2014-09-16 16:55

Re: [Script][N900][16/9/2014] NatGeo photo of the day script.
 
....don't know why, but i can't see my answers.. :confused:

shawnjefferson 2014-09-17 21:39

Re: [Script][N900][16/9/2014] NatGeo photo of the day script.
 
I was taking a look at this and I'm not the strongest in shell scripting (so I could be wrong), but it looks like you aren't always using the PICTURE_DIR variable.

In the check if the picture already exists:
Code:

if [ ! -e ~/Immagini/${TODAY}_ngeo.jpg ]; then
In the preview code:
Code:

/usr/bin/dbus-send --print-reply --dest=com.nokia.image_viewer /com/nokia/image_viewer com.nokia.image_viewer.mime_open string:file:///home/user/MyDocs/photos/${TODAY}_ngeo.jpg

in the code that sets the wallpaper:
Code:

        gconftool -s --type string /apps/osso/hildon-desktop/views/1/bg-image ~/MyDocs/photos/${TODAY}_ngeo.jpg
        gconftool -s --type string /apps/osso/hildon-desktop/views/2/bg-image ~/MyDocs/photos/${TODAY}_ngeo.jpg
        gconftool -s --type string /apps/osso/hildon-desktop/views/3/bg-image ~/MyDocs/photos/${TODAY}_ngeo.jpg
        gconftool -s --type string /apps/osso/hildon-desktop/views/4/bg-image ~/MyDocs/photos/${TODAY}_ngeo.jpg

also it looks like you are using ~/MyDocs/pic_url in one section of the code and /tmp/pic_url in another? probably /tmp/pic_url is the best place...

marcphemt 2014-09-17 21:47

Re: [Script][N900][16/9/2014] NatGeo photo of the day script.
 
You are right...i write this script for my pc and than converted for N900..so...thank you for reporting!! :) I ll correct this error as soon as possible!! ;)

shawnjefferson 2014-09-17 22:17

Re: [Script][N900][16/9/2014] NatGeo photo of the day script.
 
PS, also the file size comparison doesn't work, at least on my system. wget returns a comma in the filesize and stat doesn't.

Feature request: how about adding a switch (-batch or -quiet or something) to run without prompting the user, so we can run it via a QueenBeeCon or other scheduled task?

marcphemt 2014-09-18 07:15

Re: [Script][N900][16/9/2014] NatGeo photo of the day script.
 
Quote:

Originally Posted by shawnjefferson (Post 1439564)
Feature request: how about adding a switch (-batch or -quiet or something) to run without prompting the user, so we can run it via a QueenBeeCon or other scheduled task?

Do you mean that you don't want the output? Or you don't want only the "press ENTER"? :D
Sorry, but for now i don't use queenBeeCon, so i don't know how it works.. :)
Thanks for comment!! :cool:

EDIT: i'm working at the file comparison, and i see that don't work anymore..so i ll cancel that line...we don't need it beacause we don't have duplicates of the same photo..


All times are GMT. The time now is 14:01.

vBulletin® Version 3.8.8