maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Announce] QtLockscreen: highly configurable lockscreen replacement (https://talk.maemo.org/showthread.php?t=75150)

sakya 2012-05-07 21:30

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by D@vIcHoJD (Post 1203229)
How I can add the widget of the cpu, memory and IP, which is in the screenshot.

The widget in the screenshot is made by this script (put it in /opt/qtlockscreen and call it sysinfo.sh):
Code:

#!/bin/sh
echo `awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq`

echo `awk '/mT/ {memttl = $2}; /mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == "Cached:" {memcch = $2} END {printf ("%.1f MB\n",(memttl-memfre-membff-memcch)/1024)}' /proc/meminfo`

CONN=$(/sbin/route | awk '/default/ {print $NF}')
IP="-"
if [ "$CONN" == "wlan0" ]; then
    IP=$(/sbin/ifconfig wlan0 | awk -F "[: ]" '/Bc/ {print $13}')
fi

if [ "$CONN" == "gprs0" ]; then
    IP=$(/sbin/ifconfig gprs0 | awk -F "[: ]" '/P-t-P/ {print $13}')
fi
echo -n $IP

And these widgets in the config file (one for the background, one for the text and one for the values from the script):
Code:

[SystemInfoBackground]
PosL="5;220"
PosP="5;220"
SizeP="150;70"
SizeL="150;70"
Radius=5
Color="0;0;0;150"

[SystemInfoText]
PosL="8;220"
PosP="8;220"
SizeP="150;70"
SizeL="150;70"
Font=";12;normal;0"
Color="50;255;25;255"
Alignment="left;center"
Multiline=1
Text="CPU:\nMem:\nIP:"

[SystemInfo]
PosL="5;220"
PosP="5;220"
SizeP="147;70"
SizeL="147;70"
Font=";12;normal;0"
Alignment="right;center"
Multiline=1
Command="/opt/qtlockscreen/sysinfo.sh"
UpdateIntervalSeconds=1

You need to add the widgets in the widget list (adjust the numbers and don't forget to update the size field):
Code:

Widgets\25\Name="Rect.SystemInfoBackground"
Widgets\26\Name="Text.SystemInfoText"
Widgets\27\Name="TextCommand.SystemInfo"

For info on available widgets and some info refer to the wiki:
http://wiki.maemo.org/QtLockscreen

D@vIcHoJD 2012-05-08 03:18

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
1 Attachment(s)
I have a small problem with the script, I get error 127, I did something wrong, or is an error in the script, thanks for your help.
I followed all the instructions you indicated me.:D:D

sakya 2012-05-08 07:29

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by D@vIcHoJD (Post 1203311)
I followed all the instructions you indicated me.:D:D

Did you set the script's execute permission?
What happens if you launch the script from the terminal?
Code:

/opt/qtlockscreen/sysinfo.sh

D@vIcHoJD 2012-05-08 07:48

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by sakya (Post 1203370)
Did you set the script's execute permission?
What happens if you launch the script from the terminal?
Code:

/opt/qtlockscreen/sysinfo.sh

I went out that did not find the folder, but this way I throw this error:

-sh: /opt/qtlockscreen/sysinfo.sh: not found
~ $ root


BusyBox v1.20.0 (Debian 1.20.0power1) built-in shell (ash)
Enter 'help' for a list of built-in commands.

Nokia-N900:~# opt/qtlockscreen/sysinfo.sh
-sh: opt/qtlockscreen/sysinfo.sh: not found
Nokia-N900:~# /opt/qtlockscreen/sysinfo.sh
-sh: /opt/qtlockscreen/sysinfo.sh: not found
Nokia-N900:~# /opt/qtlockscreen/
-sh: /opt/qtlockscreen/: Permission denied
Nokia-N900:~# cd opt/qtlockscreen
-sh: cd: can't cd to opt/qtlockscreen
Nokia-N900:~# cd opt/qtlockscreen/
-sh: cd: can't cd to opt/qtlockscreen/
Nokia-N900:~# cd /opt/qtlockscreen/
Nokia-N900:/opt/qtlockscreen# sysinfo.sh
-sh: sysinfo.sh: not found
Nokia-N900:/opt/qtlockscreen# sysinfo.sh
-sh: sysinfo.sh: not found
Nokia-N900:/opt/qtlockscreen# sh sysinfo.sh
805 MHz
: not found line 3:
162.1 MB
: not found line 5:
sysinfo.sh: line 15: syntax error: unexpected end of file (expecting "then")
Nokia-N900:/opt/qtlockscreen#

Please help me, Am I doing something wrong:D

sakya 2012-05-08 07:56

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
1 Attachment(s)
Quote:

Originally Posted by D@vIcHoJD (Post 1203377)
Please help me, Am I doing something wrong:D

Use the attached script (rename it sysinfo.sh)
Give the file execute permission:
Code:

root
chmod a+x /opt/qtlockscreen/sysinfo.sh


D@vIcHoJD 2012-05-08 08:01

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by sakya (Post 1203387)
Use the attached script (rename it sysinfo.sh)
Give the file execute permission:
Code:

root
chmod a+x /opt/qtlockscreen/sysinfo.sh


Thank very much sakya. Problem solved and thanks again for the script.:D:D

D@vIcHoJD 2012-05-08 08:33

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
In the last version 0.1.26 is repeated 2 times the widget 26, I corrected it manually.

J4ZZ 2012-05-09 10:23

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Sakya I still need your help. Like I wrote a few posts back. Qtlockscreen doesn't load at boot. So I always need to re-apply my theme with Lockscreen-Config...

Can I somehow check if it's properly in startup? And where do I have to look?

Regards,

J4ZZ

sakya 2012-05-09 10:30

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by J4ZZ (Post 1203937)
Like I wrote a few posts back.

Sorry, I didn't notice your message.

The autostart script is /etc/event.d/qtlockscreen
It should be like this:
Code:

start on started hildon-desktop

respawn

script
  exec su - user -c "exec /usr/bin/qtlockscreen"
end script


J4ZZ 2012-05-09 14:05

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by sakya (Post 1203939)
The autostart script is /etc/event.d/qtlockscreen
It should be like this:
Code:

  exec su - user -c "exec /usr/bin/qtlockscreen"

What is expected output/behaviour of this command?

I get something like
Code:

Maemo applications must be run with the run-standalone.sh script"
qtlockscreen: cannot connect to X server

when executing the line in Terminal. (bash is default shell)

Regards,

J4ZZ

sakya 2012-05-09 14:25

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by J4ZZ (Post 1204075)
bash is default shell

I don't have that error when running the command from the terminal (from root user).
Maybe bash is the "problem"?

J4ZZ 2012-05-09 14:39

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Probably... When executing the command in busybox it works.
I also tried running exec su user instead of exec su - user in bash wich worked in terminal but not in boot script.

Is there a way to change the command so bash will read it properly? :)

D@vIcHoJD 2012-05-11 02:03

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
I have a small problem that was presented recently, yahoo widget is not updated, apparently is that the interfacein yahooweather has changed is possible to correct this problem?

Someone else has the same problem?

x-lette 2012-05-11 15:17

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by D@vIcHoJD (Post 1205010)
I have a small problem that was presented recently, yahoo widget is not updated, apparently is that the interfacein yahooweather has changed is possible to correct this problem?

Someone else has the same problem?

I also don't get current weather displayed. But that might also be a faulty declaration of URL. Tried many possible URLs but neither does work. Calling URL in webbrowser works.

sakya 2012-05-11 15:20

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Yahoo changed the weather page, the script that should extract information from it must be fixed.

If you want to do it you can find the script in /opt/qtlockscreen/weatherwidget.sh

x-lette 2012-05-11 15:24

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Another question: is there any way to configure the calendar widget so it uses only defined calendars. Currently it shows entries from some of my calendars but not from my most important one. So I don't see actual entries on lockscreen but I see holiday entries from next week. :o

Same goes for alarmwidget: widget obviously only shows alarms from builtin clock. I'd better like seeing alarms from calendar as they are the important ones. Btw: currently shown is a disabled alarm dated aug, 29th. That was the last time it was active ;)

Thanks for all your work! :D

wittyheart 2012-06-03 04:47

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
has anyone fixed the script for yahoo weather??? please inform...thanks

tadzik 2012-07-14 14:12

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
http://imgur.com/ooN6m.png

I've created myself the following theme, I wanted it to be Landscape-only (hence two clocks, so I can read an hour no matter what orientation). This is not the config thread, and I have no problem with the theme itself. The problem is with the rotation.

I have the config here: https://gist.github.com/3111526

I've set Orientation="landscape", but I have a following problem (bug?) with it:
Steps to reproduce:
1) Rotate the phone so it's in portrait mode
2) Lock screen
3) Press the power button, so qtlockscreen shows up
4) Observe how qtlockscreen tries to scale wallpaper and rotate widgets for 5 seconds before it notices it shouldn't care.
5) Swear audibly.

Long story short, even though it's supposed to be landscape-only, qtlockscreen tries to turn itself into portrait, which takes a lot of time, looks ugly and makes me frown.

Any idea how to fix that, or work around that?

EDIT: Bonus points: When the lockscreen finally shows up correctly and you unlock it, it then rotates everything again and the layout breaks once again for a while before hildon shows up.

johnny27 2012-07-15 09:33

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
1 Attachment(s)
anyone knows how can i default lockscreen vertical.

i dont want install any application.

but i want my lockscreen vertical.

this is my lockscreen.but it is cant vertical.

rm42 2012-08-15 15:18

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
I found an Android phone on the street the other day (almost ran over it with the car). The phone was locked, but it had an option to display emergency contacts. I was hoping to see a number that I could call to return the phone to its owner. Unfortunately, the person had not bothered to enter any of its contacts into that option.

Any way, that got me thinking about what if my phone was lost. There is nothing that I can see that could allow a good Samaritan to return it to me if he wanted to. A "Return Lost Device" widget that displays some owner Info would be nice. Either that, or an "Emergency Contacts" widget similar to Android's would great too.

luunaitk12 2012-08-16 11:09

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by sakya (Post 1205275)
Yahoo changed the weather page, the script that should extract information from it must be fixed.

If you want to do it you can find the script in /opt/qtlockscreen/weatherwidget.sh


what exactly is to be changed? i am not able to get weather displayed in the lockscreen, i changed to the new url (http://weather.yahoo.com/LOCATION/) still nothing what else has to be changed, i do have the 0.1.27 version

sakya 2012-08-23 10:38

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by luunaitk12 (Post 1252550)
what exactly is to be changed?

The weatherwidget.sh script (it's in /opt/qtlockscreen/ directory).
Just fix it to parse the new yahoo weather (or the weather service you want to use) and outputs informations in the format:
Code:

Current: XX
Conditions: XXXXXXXX
High: XX
Low: XX
Image: /tmp/XXXXX.png

https://www.assembla.com/code/qtlock...dget.sh?rev=96

wittyheart 2012-08-26 14:35

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by sakya (Post 1254836)
The weatherwidget.sh script (it's in /opt/qtlockscreen/ directory).
Just fix it to parse the new yahoo weather (or the weather service you want to use) and outputs informations in the format:
Code:

Current: XX
Conditions: XXXXXXXX
High: XX
Low: XX
Image: /tmp/XXXXX.png

https://www.assembla.com/code/qtlock...dget.sh?rev=96

sorry for asking you again, but which lines in the weatherwidget.sh are to be replaced with the code?

ersanpermana 2012-08-27 00:23

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
2 Attachment(s)
Any one can help me this my problem?

:confused:

IntelN900 2012-09-04 13:00

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Hey, which package is for N900? I'm new at this and dont know what I need to do, please help me. :(

n900user259 2012-09-15 19:26

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Just open the application manager on your n900, and download qtlockscreen. It's currently at version 0.1.27.
The lockscreens that have been made can be found in Extras and devel.

imo 2012-10-03 17:32

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
is it possible that i can change the wallpaper of qtlockscreen ? http://www.fondos7.net/wallpaper-ori...2010-2605.jpeg like the one here ,actually i do have other great wallpapers on my N900 main window , but how do i change the lockscreen wallpaper to look alike the one i have on my main window ?

gidzzz 2012-10-05 14:12

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
This post inspired me to fiddle with the mentioned file in hope of finding a solution for the problem with QtLockscreen freezing for a moment after the power button is pressed. I added "/usr/bin/qtlockscreen" in the section called "[classify sysutils]" and after a reboot the freezing is gone. :)

Mentalist Traceur 2012-10-06 19:07

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by gidzzz (Post 1276850)
This post inspired me to fiddle with the mentioned file in hope of finding a solution for the problem with QtLockscreen freezing for a moment after the power button is pressed. I added "/usr/bin/qtlockscreen" in the section called "[classify sysutils]" and after a reboot the freezing is gone. :)

I wouldn't put it into sysutils category, just because that's used for stuff like dsme, mce, dbus-daemon (only entries I have in there). However, I would put it where the standard lockscreen's file resides - which I believe is part of the 'systemui' package. And /usr/bin/systemui is in the [classify desktop] section. I'm going to test qtlockscreen in this section right now, brb.

I just realized there's a seperate category for the browser, maps, e-mail, etc, too. Which of course only contain the stock Nokia applications. People should try out putting alternative browsers, maps, e-mail clients, into this area, and see if they work better/worse.

[Edit]
Yes, putting it in the [classify desktop] section seems to work fine too. Now I imagined this meant that the [DateTime] widget of the QTLockscreen, no longer needs to have a rather short (couple minutes) of a 'background update' time, because it should now always update as soon as it displays anyway. So I set the auto-update interval in my QTLockscreen.ini file to 3600 seconds (i.e. 60 minutes, i.e. hour), and it looks like it's correctly up to date from the moment you see it anyway.

Granted, my QtLockscreen.ini file is ancient, and there's probably been some more features added since I last updated, so for all I know the background update thing just gets ignored now.

[Edit 2]
Nvm, you can still see that the time takes a tiny bit to update, if you leave the N900 locked for a while, before re-checking. So the auto-update setting for the datetime widget does still seem to have its use.

gidzzz 2012-10-06 20:06

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by Mentalist Traceur (Post 1277367)
I wouldn't put it into sysutils category, just because that's used for stuff like dsme, mce, dbus-daemon (only entries I have in there). However, I would put it where the standard lockscreen's file resides - which I believe is part of the 'systemui' package. And /usr/bin/systemui is in the [classify desktop] section. I'm going to test qtlockscreen in this section right now, brb.

"[classify desktop]" was the first place where I tried to put it and initially it seemed to work, but half an hour later I was saddened to find out that the freezing was back. Then I decided to try with "system" partition, of which "sysutils" looked like the most suitable category and QtLockscreen held up smooth for well over a day, interrupted by a reboot due to curiosity caused by your post (I'm *almost* certain that I checked for typos after such traumatic disappointment ;) ).

Mentalist Traceur 2012-10-06 21:50

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by gidzzz (Post 1277380)
"[classify desktop]" was the first place where I tried to put it and initially it seemed to work, but half an hour later I was saddened to find out that the freezing was back. Then I decided to try with "system" partition, of which "sysutils" looked like the most suitable category and QtLockscreen held up smooth for well over a day, interrupted by a reboot due to curiosity caused by your post (I'm *almost* certain that I checked for typos after such traumatic disappointment ;) ).

Hmm, interesting. For me, after I made that post, I have yet to notice the same freezing 'return' - there is still a barely noticeable delay in the time update (only easy to notice when like 15 minutes have passed, so that the numbers are significantly different), but it's way less than a second, and I'm not even sure if it's the freezing or just the DateTime widget (either way, I have yet to manage to touch the lock slider on the lockscreen, after pressing the power key, and have it not respond/move - and believe me I've tried to hold one finger right where the lock slider is, and moving it immediately after pressing the power key), where-as on an N900 that doesn't have qtlockscreen entered anywhere in that file, the 'freeze' is ~3 seconds, and the lock slider is indeed non-responsive (I have the fortune of having multiple N900s to compare things on at the same time, thanks to having the misfortune of having two, so far, succumb to the "telephony functions disabled" error).

But you might still be right - it's possible, for instance, the N900 swaps out desktop-classified programs after some long period of inactivity, or something, but doesn't touch the sysutils-classified ones, or something like that. I'm going to report back if/when I see the QtLockscreen start freezing again. (I concede it's possible I don't notice because my QtLockscreen config is fairly simple - no music player/album art/weather/etc.

Mentalist Traceur 2012-10-07 19:03

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Have yet to have freezing return on my device so far that I've noticed, QtLockscreen still being inside the desktop section.

ed_boner 2012-10-07 19:20

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
nice guys..sounds like a new update will be here soon..i am excited:D

rotoflex 2012-11-18 06:49

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
qtlockscreen has been great for use with the N900 docked in the car using FM carkit.

Its drawback is that it's driving Espeak Time crazy, & the espeak man announces the time when unlocking, sometimes a couple of times, & sometimes randomly.

Can either qtlockscreen or espeak time be tweaked to calm him down?

skanky 2013-01-18 20:59

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
I've written a new weatherwidget.sh to get the information form the UKMO mobile site (I think it just covers the UK). I'll post it up here when I get it all working, but I have two issues.

The first is that the icon is very small, but it's workable for me at the moment - though it may be worth eventually looking into it.

The second is that I'm not getting the Conditions being displayed.
Here is an example of my output:

Code:

Current: -3
Conditions: Light Snow
High: -2
Low: -3
Image: /tmp/ywtemp.png

Anyone spot the obvious thing I must be missing?

skanky 2013-01-21 17:15

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Quote:

Originally Posted by skanky (Post 1315737)
I've written a new weatherwidget.sh to get the information form the UKMO mobile site (I think it just covers the UK). I'll post it up here when I get it all working, but I have two issues.

The first is that the icon is very small, but it's workable for me at the moment - though it may be worth eventually looking into it.

The second is that I'm not getting the Conditions being displayed.
Here is an example of my output:

Code:

Current: -3
Conditions: Light Snow
High: -2
Low: -3
Image: /tmp/ywtemp.png

Anyone spot the obvious thing I must be missing?

Okay, I'm an idiot, I didn't unquote the Conditions settings in the ini file.

So though this still needs work, here's the UKMO version of the script:

Code:

#!/bin/sh
#Arguments:
# 1 = Place id - from ukmo website
# 2 = output dir

url="http://www.metoffice.gov.uk/mobile/"

# Your default location here, take it from the Met Office mobile
# website.
id=${2-"XXXXXX"}
out=${3-"/tmp"}


post="forecastid=$id"

# Get info for day
wget --user-agent=""  -q -t 1 -T 10 --post-data="$post" -O "$out/ywtemp.htm" "${url}5dayforecastdetail" || { exit 1; }

curday=`date "+%a %d %b %y"`

eval `awk '
                BEGIN      { use = 0 }
                /.h2.'"$curday"'..h2./ { use = 1 }
                use == 1 && /weathervalues/ { sub("^.*>Temperature: ","");
                                              sub("&nbsp.*\\\(", " ");
                                              sub("&nbsp.*$", "");
                                              high=$1; low=$2; exit }
                END        { printf("high=\"%s\" low=\"%s\"", high, low)}' "$out/ywtemp.htm"
`

# Get info specific to time of day
curtime=`date +%H`00
if [ $curtime -lt 1200 ]; then
        curtime=0900
elif [ $curtime -ge 1200 ] && [ $curtime -lt 1500 ]; then
        curtime=1200
elif [ $curtime -ge 1500 ] && [ $curtime -lt 1800 ]; then
        curtime=1500
elif [ $curtime -ge 1800 ] && [ $curtime -lt 2100 ]; then
        curtime=1800
elif [ $curtime -gt 2100 ]; then
        curtime=2100
fi

curday=`date "+%a %d %b %y" | sed 's/ /%20/g'`

post="forecastid=$id&detail=$curday"

wget --user-agent=""  -q -t 1 -T 10 --post-data="$post" -O "$out/ywtemp.htm" "${url}5dayforecastdetail" || { exit 1; }

eval `awk '
                BEGIN      { use = 0 }
                /Time: '$curtime'/ { use = 1 }
                use == 1 && /img/ { sub("^.*src=", ""); sub(" alt.*$", ""); img=$0 }
                use == 1 && /weathervalues/ {
                                        sub("^.*weathervalues\">", "")
                                        sub("&nbsp.*$", "")
                                        sub("<br/>Temperature: ","\" temp=\"")
                                        wx=$0
                                        exit
                                }
                END        { printf("icon=\"%s\" conditions=\"%s\"", img, wx)}' "$out/ywtemp.htm"
`

wget --user-agent="" -q -t 1 -T 10 -O "$out/ywtemp.gif" "${url}${icon}" || { exit 1; }

echo "Current: "$temp
echo "Conditions: "$conditions
echo "High: "$high
echo "Low: "$low
echo "Image: $out/ywtemp.png"

NB I've put it in code tags, but think there may still be some formatting issues.

Temporal 2013-02-13 11:26

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Hi, I'm here to say that maybe I may have fixed the weather widget (for all).

Of couse it will require some little changes and it may have some rough edges but here it is:

Code:

#!/bin/sh
#Arguments:
# 1 = Link to yahoo weather
# 2 = output dir
# 3 = Biggest weather code to consider

url=${1-"weather.yahooapis.com/forecastrss?w=455861&u=c"}
out=${2-"/tmp"}
big=${3-"47"}
let big="$big"+1

# ========sakya's translation========
# In order to work with QtLockscreen I need to, in the WORST case scenario:
# http://weather.yahoo.com/weather.yahooapis.com/forecastrss?w=455861&u=c?unit=c
# 1) Remove the 'http://weather.yahoo.com/'
# 2) Translate the appended '?unit=X' to '&u=X'
url=`echo "$url" | sed s/weather.yahoo.com\\\/// | sed 's/&u=[cf]//' | sed 's/?unit/\&u/'`
# the only problem is that now it requires the ?unit=c to recognize celcius, but for the qtlockscreen it is ok.

code="44d"
curr="0"
cond="Unknown"
high="0"
loww="0"

# Getting all the necessary info.
wget --user-agent="" -q -t 1 -T 10 -O "$out/ywtemp.xml" "$url" || { exit 1; }
# Now I have to find out the condition code in order to select the icon to download
code=`cat "$out/ywtemp.xml" | grep -o code=\".* -m 1 | sed s/code=\"// | sed s/\".*//`|| { exit 1; }

# I think that it is safe to translate odd codes to night and even codes to day. It is difficult to get each match on the site, there's nothing anywhere to look into. The weather developer API does not stabilish a correlation.
  if [ "$code" -lt "$big" ]
  then
    # It is lower than the bigger known good weather code (47?), so, it isn't the unknown code 3200 or any other also unknown. Now the unknown icon are the 44d and 44n that are equal N/A:
    if [ ` expr $code % 2 ` -eq 0 ]
    then
      code="$code""d";
    else
      code="$code""n";
    fi
    curr=`cat "$out/ywtemp.xml" | grep -o temp=\".* -m 1 | sed s/temp=\"// | sed s/\".*//` || { exit 1; }
    cond=`cat "$out/ywtemp.xml" | grep -o text=\".* -m 1 | sed s/text=\"// | sed s/\".*//` || { exit 1; }
    high=`cat "$out/ywtemp.xml" | grep -o high=\".* -m 1 | sed s/high=\"// | sed s/\".*//` || { exit 1; }
    loww=`cat "$out/ywtemp.xml" | grep -o low=\".* -m 1  | sed s/low=\"//  | sed s/\".*//` || { exit 1; }
  else
    code="44d";
  fi

# Getting the icon...
wget --user-agent="" -q -t 1 -T 10 -O "$out/ywtemp.png" "l.yimg.com/os/mit/media/m/weather/images/icons/l/$code-100567.png" || { exit 1; }

echo "Current: $curr"
echo "Conditions: $cond"
echo "High: $high"
echo "Low: $loww"
echo "Image: $out/ywtemp.png"

So, how to make it work:

1)Open /opt/qtlockscreen/weatherwidget.sh with the editor of your choice;

2)Delete everything on this file and paste the code above;

3)Go to http://weather.yahoo.com and look for your city.

4)It should return something around the lines of:
weather.yahoo.com/doesnt-matter/doesnt/matter-455861/

5)Take the last numbers of that url and put them in the end of THIS (weather.yahooapis.com/forecastrss?w=) url, like THIS:
weather.yahooapis.com/forecastrss?w=455861

6)Go to your configuration file (of the lockscreen you use) with the weather widget and replace the link there with this new link.

7)I guess it is done.

------------------------
I just did it so it might have bugs, expand them here so I can fix/help. I may update the wiki shortly this week if I get time.

This problem was bugging me too much. Bye!

Godhell 2014-05-28 08:31

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Hi,

I'm still using the awesome device and have come across the qtlockscreen app.

The problem is that I still can't get bloody Yahoo Weather fixed.

1. Seems I've finally got the weatherwidget.sh right:
- Yahoo seems to provide a direct link to the weather icon now, no need for extra code
- the icon is provided in .gif format - I'm simply writing it with a .png extension and it works.
- the weather file is no longer in .htm, it's an .xml - fixed for this.

Here's the code:

Code:

#!/bin/sh
#Arguments:
# 1 = Link to yahoo weather
# 2 = output dir
# 3 = Biggest weather code to consider

url=${1-"weather.yahooapis.com/forecastrss?w=2122265&u=c?unit=c"}
out=${2-"/tmp"}

# ========sakya's translation========
# In order to work with QtLockscreen I need to, in the WORST case scenario:
# http://weather.yahoo.com/weather.yahooapis.com/forecastrss?w=455861&u=c?unit=c
# 1) Remove the 'http://weather.yahoo.com/'
# 2) Translate the appended '?unit=X' to '&u=X'
url=`echo "$url" | sed s/weather.yahoo.com\\\/// | sed 's/&u=[cf]//' | sed 's/?unit/\&u/'`
# the only problem is that now it requires the ?unit=c to recognize celcius, but for the qtlockscreen it is ok.

curr="0"
cond="Unknown"
high="0"
loww="0"

# Getting the XML and extracting the weather icon URL
wget --user-agent="" -q -t 1 -T 10 -O "$out/ywtemp.xml" "$url" || { exit 1; }
image=`cat "$out/ywtemp.xml" | grep "img src" | sed s'_<img src="__' | sed s'_"/><br />__'`|| { exit 1; }
#echo "$image"

# Setting weather conditions
curr=`cat "$out/ywtemp.xml" | grep -o temp=\".* -m 1 | sed s/temp=\"// | sed s/\".*//` || { exit 1; }
cond=`cat "$out/ywtemp.xml" | grep -o text=\".* -m 1 | sed s/text=\"// | sed s/\".*//` || { exit 1; }
high=`cat "$out/ywtemp.xml" | grep -o high=\".* -m 1 | sed s/high=\"// | sed s/\".*//` || { exit 1; }
loww=`cat "$out/ywtemp.xml" | grep -o low=\".* -m 1  | sed s/low=\"//  | sed s/\".*//` || { exit 1; }

# Getting the icon...
# The icon has been changed to GIF by Yahoo, writing it with a PNG extension works.
wget --user-agent="" -q -t 1 -T 10 -O "$out/ywtemp.png" "$image" || { exit 1; }

echo "Current: $curr"
echo "Conditions: $cond"
echo "High: $high"
echo "Low: $loww"
echo "Image: $out/ywtemp.png"

2. Weatherwidget.sh executes ok manually with user permissions, puts everything into /tmp correctly, weather conditions are sent to stdout as plain text.

The problems are:
- weatherwidget.sh is not being executed automatically by qtlockscreen (it doesn't get both ywtemp.xml and ywtemp.png into /tmp) - exec perms set (+x for all), owner root.root, network is up
- both the weather icon and weather conditions are NOT displayed on lockscreen, even on the default theme.

I suspect this may have something to do with dependencies towards QBW and alarmed, but the installation of those packages didn't help and I'm not sure I can do more without sakya's help.

BTW, I'm on CSSU-Stable and using qtlockscreen-0.1.27 from devel.

ThomasAH 2015-04-17 12:25

Re: [Announce] QtLockscreen: highly configurable lockscreen replacement
 
Thanks a lot for this app sakya, installed it last week, works really well! :D

I was wondering about the possibility of adding two features:
1.) Display Yappari notifications on the lockscreen,
2.) Let the music controls control the Qspot app

I've searched this thread, the Yappari thread, the Qspot thread and the QtLockScreen wiki, and I haven't found anything documented on such functionality. Would it be possible?


All times are GMT. The time now is 18:23.

vBulletin® Version 3.8.8