Messing with MIUI Weather


xacro

Members
Nov 13, 2010
24
11
Update: http://www.miui-dev.com/forums/show...ith-MIUI-Weather&p=31797&viewfull=1#post31797

I'm not sure which section to put this in, but I've been trying a few things with MIUI weather to workaround the China-weather-only issue. I don't know if anybody's done anything like this yet and whether it was successful or not...but here goes anyway.

Here's what I've done:
  1. Sniffed out the url (http://www.miui.com/weather.api.php?city=101010100) at which the weather app grabs its weather data for Beijing.
  2. Redirected "miui.com" to to point to the IP of a server I am hosting using /system/etc/hosts on my device
  3. Served a bunch of JSON encoded weather data (copy pasted with some values changed as proof of concept) from my server

Now, retrieving weather data yields this (screenshots):
http://miui-dev.com/forums/attachment.php?attachmentid=822&stc=1&d=1296991893
http://miui-dev.com/forums/attachment.php?attachmentid=823&stc=1&d=1296992375

You should be able to see how all of the values have changed to nonsense, as a proof of concept. All of the weather information is in accordance with this JSON data:
Code:
{
    "weatherinfo": {
        "weather4": "weather4",
        "weather5": "weather5",
        "weather6": "weather6",
        "date_y": "2011\u5e742\u67086\u65e5",
        "weather1": "\u5c0f\u96e8(Rain)",
        "weather2": "weather2",
        "weather3": "weather3",
        "\u9493\u9c7c\u6307\u6570": "chinese 1",
        "\u7d2b\u5916\u7ebf\u6307\u6570": "chinese 2",
        "sktime": "13:37",
        "temp3": "temp3",
        "temp2": "temp2",
        "temp1": "temp1",
        "sktq": "sktq",
        "temp6": "temp6",
        "temp5": "temp5",
        "temp4": "temp4",
        "wind3": "wind3",
        "\u8fd0\u52a8\u6307\u6570": "chinese 3",
        "fx2": "fx2",
        "\u611f\u5192\u6307\u6570": "chinese 4",
        "st4": "st4",
        "\u4ea4\u901a\u6307\u6570": "chinese 5",
        "index_ls": "index_ls",
        "jrrc": "13:38",
        "fl1": "fl1",
        "index": "index",
        "fl3": "fl3",
        "fl2": "fl2",
        "fl5": "fl5",
        "fl4": "fl4",
        "fl6": "fl6",
        "cityid": "101010100",
        "st5": "st5",
        "st6": "st6",
        "st1": "st1",
        "city_en": "city_en",
        "index48": "index48",
        "\u667e\u6652\u6307\u6570": "chinese 6",
        "fchh": "fchh",
        "\u6d17\u8f66\u6307\u6570": "chinese 7",
        "week": "week",
        "fx": "fx",
        "\u901b\u8857\u6307\u6570": "chinese 8",
        "\u7ea6\u4f1a\u6307\u6570": "chinese 9",
        "st2": "st2",
        "city": "city",
        "index_xc": "index_xc",
        "index_co": "index_co",
        "index_cl": "index_cl",
        "st3": "st3",
        "\u8212\u9002\u5ea6\u6307\u6570": "chinese 10",
        "\u5212\u8239\u6307\u6570": "chinese 11",
        "\u7f8e\u53d1\u6307\u6570": "chinese 12",
        "\u65c5\u6e38\u6307\u6570": "chinese 13",
        "mrrl": "13:39",
        "\u5316\u5986\u6307\u6570": "chinese 14",
        "\u6668\u7ec3\u6307\u6570": "chinese 15",
        "\u8def\u51b5\u6307\u6570": "chinese 16",
        "date": "date",
        "wind2": "wind2",
        "wind1": "wind1",
        "fl": "fl",
        "wind6": "wind6",
        "wind5": "wind5",
        "wind4": "wind4",
        "mrrc": "13:40",
        "\u7a7f\u8863\u6307\u6570": "chinese 17",
        "\u7a7a\u6c14\u6c61\u67d3\u6269\u6563\u6761\u4ef6\u6307\u6570": "chinese 18",
        "\u96e8\u4f1e\u6307\u6570": "chinese 19",
        "fx1": "fx1",
        "\u591c\u751f\u6d3b\u6307\u6570": "chinese 20",
        "index_tr": "index_tr",
        "index48_uv": "index48_uv",
        "pubtime": "2011-01-01 13:41",
        "index_uv": "index_uv",
        "jrrl": "13:42"
    }
}

Quick Ideas
  • I can replace city codes and city data in the "miui_city.db" in the apk so that the query string to whatever server is hosting the data can serve the weather info for the user's chosen city.
  • I should be able to fetch weather data off another source and translate it into a readable JSON form (in the codeblock above) so that the weather app can read it.
  • Is there a better way to redirect 'miui.com' to an IP of my choice than using the hosts file? Is there a way to overwrite it in the apk? Is decompiling an option?

Potential problems for this workaround:
  • The weather animation changes in accordance with the weather data, but it's matching against a Chinese string, so serving weather data in English won't trigger the correct animation. In the first screenshot, I got the rain animation to show by including, in the string, 2 Chinese characters which mean 'rain'.
  • If using hosts redirection, anything else that points to miui.com won't function unless I pull off some fancy redirection using my server
  • My server is hosted on a dynamic IP and as such I can't do a permanent redirection for anybody else.

I'm kind of tired right now so a lot of this may have been incoherent and meaningless, but if anybody's interested in helping at all or if there's any advice for me, I'll gladly take it. Also, if any of you know for sure that this is a DEAD END EFFORT then please tell me :)

Where I got all of my information: http://www.google.com/webhp#hl=en&s...A&q="miui_city.db"&nfpr=1&fp=ac5229e2e8efe107
 

Attachments

  • miui_weather.jpg
    miui_weather.jpg
    43 KB · Views: 729
  • miui_weather2.jpg
    miui_weather2.jpg
    53.1 KB · Views: 711
This is most certainly not a dead effort! I have been working on the city.db for the last few months off and on. Of all the features that MIUI has, this is the most requested app by far. It looks like you may have gotten further than any of us have. I can help with some stuff, just let me know. I think a proper translation is in order once most of the bugs are worked out. As for using your server, I would try and find a weather service to pull data from. DHCP is bound to drop your IP at any time. Let me know what I can do to help.
 
Since this thread seems to be getting viewed a lot, I'll give you guys a quick update on what I've done.

I've been working behind the curtains with Mark and wowthatisrandom and, with a LOT of their help, we have made progress. I won't say how much :p - I'll leave that to Mark with an official announcement sometime in the future (I don't know when either...).

Attached are some screenshots from our testing. This is by no means the final version or a guarantee that we have it working, but let the drooling commence!

We are using weather.com's XML API to get our weather information. If anybody has any information on how to get a list of their weather descriptions, that would be awesome. (i.e. how many types of these phrases do they use? "Partly Cloudy", "Isolated T-Storms", "Fair", "Clear", "Sunny", "Mostly Cloudy". A complete list of these would be oh so helpful...)

Edit: Thanks mschmitt01 for your reply. So many views but only one reply on the 'most requested app by far' ;)
 

Attachments

  • w1.jpg
    w1.jpg
    53.7 KB · Views: 589
  • w2.jpg
    w2.jpg
    58.5 KB · Views: 574
Mark is the real hero, as usual. Please give him most of the credit, and wait patiently for more good news from him!
 
Wow! Way to jump all over this and get this working! Again let me know what needs you have. Great job!

Sent from my Desire CDMA using Tapatalk
 
Nice job, mate!!!
If you need any tester count on me, I'll be happy to help.

Edit: I'm in Tel-Aviv, Israel if it helps
 
I'll test to if you want surrey, canada.... Thanks for your hard work on this

Sent from my Nexus One using the miui-dev.com Forums App
 
Ill help out if needed, Newcastle, UK :)

Sent from my HTC Desire using the miui-dev.com Forums App
 
AOSP = Android Open Source Project

I would say MIUI is based from AOSP, but you couldn't say that MIUI is by definition AOSP.
Exactly. Everything starts from an AOSP build. If MIUI was AOSP than so is HTC Sense... which it is not. Not trying to start a flame war though ...just my 2¢. And now back on topic...

I'm having difficulty with these codes Mark. Does anybody have a full list of weather.com magnet codes for the USA, even states? If so pm me or Mar or wowthatisrandom.



Sent from my Desire CDMA using Tapatalk
 
USA is done, Europe is done, all thats left is rest of world e.g. Australia, Japan, China, Canada, New Zeland.
 
USA is done, Europe is done, all thats left is rest of world e.g. Australia, Japan, China, Canada, New Zeland.

Okay. Can you send me an example if what you are using for codes so I can find exactly what you are looking for.

Sent from my Desire CDMA using Tapatalk
 
What do you need to make it work in Israel???
Whatever you guys need i'll find it for you, just let me know.
 
Amazing.
looking forward it's integrated on latest MIUI v1.2.11 or later.
Don't forget South Asia too (Malaysia, Singapore,etc..).
 

Similar threads

Replies
267
Views
298K
Replies
93
Views
64K
Replies
142
Views
58K
Replies
251
Views
102K
Replies
161
Views
66K