Messing with MIUI Weather

Discussion in 'Mi General' started by xacro, Feb 6, 2011.

  1. xacro

    xacroMembers

    Nov 13, 2010
    24
    0
    11
    Australia
    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
     

    Attached Files:

  2. mschmitt01

    mschmitt01Forum donator

    Nov 29, 2010
    119
    0
    26
    Probie, Learn all I can, be used and abused as muc
    New Glarus, Wisconsin, United States
    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.
     
  3. xacro

    xacroMembers

    Nov 13, 2010
    24
    0
    11
    Australia
    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' ;)
     

    Attached Files:

    • w1.jpg
      w1.jpg
      File size:
      53.7 KB
      Views:
      269
    • w2.jpg
      w2.jpg
      File size:
      58.5 KB
      Views:
      255
  4. TreyM

    TreyMMember

    Nov 24, 2010
    378
    7
    40
    Male
    Music Producer / Studio Owner
    South East Texas, US
    Bravo! Very nice!
     
  5. mrchambo

    mrchamboMembers

    Nov 10, 2010
    153
    0
    26
    Gorgeous!

    Thanks for all your effort.

    jc
     
  6. xacro

    xacroMembers

    Nov 13, 2010
    24
    0
    11
    Australia
    Mark is the real hero, as usual. Please give him most of the credit, and wait patiently for more good news from him!
     
  7. dougiefreshness

    Jan 18, 2011
    21
    0
    11
    This app and 4g would really make this rom even more the best package out there for an AOSP rom by far!
     
  8. mschmitt01

    mschmitt01Forum donator

    Nov 29, 2010
    119
    0
    26
    Probie, Learn all I can, be used and abused as muc
    New Glarus, Wisconsin, United States
    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
     
  9. roenano

    roenanoMembers

    Nov 7, 2010
    722
    26
    65
    Israel
    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
     
  10. upstreammiami

    Nov 9, 2010
    169
    0
    26
    Miami
    Hurry hurry! Lol so by when can this work

    Sent from my HTC Incredible using the miui-dev.com Forums App
     
  11. Mandor

    MandorMembers

    Nov 23, 2010
    267
    0
    38
    Yeah me too !

    I can test it for you if you want :)


    Localisation : Angers, France
     
  12. matt992

    matt992Members

    Nov 7, 2010
    98
    0
    16
    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
     
  13. mschmitt01

    mschmitt01Forum donator

    Nov 29, 2010
    119
    0
    26
    Probie, Learn all I can, be used and abused as muc
    New Glarus, Wisconsin, United States
  14. SteveEdson

    SteveEdsonMembers

    Jan 7, 2011
    35
    0
    16
    Ill help out if needed, Newcastle, UK :)

    Sent from my HTC Desire using the miui-dev.com Forums App
     
  15. mschmitt01

    mschmitt01Forum donator

    Nov 29, 2010
    119
    0
    26
    Probie, Learn all I can, be used and abused as muc
    New Glarus, Wisconsin, United States
    4g is coming. Please keep in mind though that MIUI is not aosp.

    Sent from my Desire CDMA using Tapatalk
     
  16. mschmitt01

    mschmitt01Forum donator

    Nov 29, 2010
    119
    0
    26
    Probie, Learn all I can, be used and abused as muc
    New Glarus, Wisconsin, United States
  17. mschmitt01

    mschmitt01Forum donator

    Nov 29, 2010
    119
    0
    26
    Probie, Learn all I can, be used and abused as muc
    New Glarus, Wisconsin, United States
    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
     
  18. MarkHUK

    MarkHUKFounder
    Staff Member

    USA is done, Europe is done, all thats left is rest of world e.g. Australia, Japan, China, Canada, New Zeland.
     
  19. InfidelforLife

    Nov 7, 2010
    149
    0
    26
    Sweet where can we download it? For EVO?

    Sent from my Supersonic EVO 4Gees
     
  20. upstreammiami

    Nov 9, 2010
    169
    0
    26
    Miami
    Its probably coming with rom updates.

    Sent from my HTC Incredible using the miui-dev.com Forums App
     
  21. mschmitt01

    mschmitt01Forum donator

    Nov 29, 2010
    119
    0
    26
    Probie, Learn all I can, be used and abused as muc
    New Glarus, Wisconsin, United States
    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
     
  22. roenano

    roenanoMembers

    Nov 7, 2010
    722
    26
    65
    Israel
    What do you need to make it work in Israel???
    Whatever you guys need i'll find it for you, just let me know.
     
  23. nyke

    nykeMembers

    Nov 13, 2010
    41
    0
    16
    Germany
    Fail.......
     
  24. BidShelf

    BidShelfMembers

    Dec 19, 2010
    31
    0
    16
    Don't forget Brazil. :)
     
  25. djlah

    djlahMembers

    Nov 22, 2010
    29
    0
    11
    Amazing.
    looking forward it's integrated on latest MIUI v1.2.11 or later.
    Don't forget South Asia too (Malaysia, Singapore,etc..).
     

Share Our Site