Author Topic: [Tasker] Openandromaps map downloader  (Read 193 times)

Offline tapio

  • Expert
  • Master of Locus
  • ****
  • Posts: 805
  • Thanked: 184 times
    • View Profile
[Tasker] Openandromaps map downloader
« on: January 07, 2022, 12:00:44 »
Hi,

with this Tasker script you can automatically download OpenAndroMaps.

At first configure Task:
a) Configure which file(s) you wish to download, multiple items are comma separated. Full URLs! Like: http://ftp.gwdg.de/pub/misc/openstreetmap/openandromaps/mapsV5/germany/Ruegen.zip
b) Configure the target directory of your system, where you want the files to be. Like: /extSD/Android/media/menion.android.locus/MapsVector/OAM

Then you are ready to go. The Task first sends only a http-head command, compares file date of the zip file on server with your local maps file time and only downloads, if there's a newer version server side, or if you haven't got that map. So we're friendly to the server.

This is how it operates the downloads per url:

- Task downloads zip file to target dir
- Then it unpacks the zip completely AND OVERWRITES existing .map/.db/.poi
- zip file gets deleted
- .poi file gets deleted (unneeded by Locus)
- Next download

Use at your own risk, enhance task by yourself, I am not planning to add much security/error handling code. I'd use the script only if the whole process does not take too much time, if it takes minutes, not hours. Because by the nature of Tasker, this task may block execution of other tasks while it is running.

[snip - currently only working in Tasker beta]
« Last Edit: January 10, 2022, 09:19:17 by tapio »
LM4 USER ID: 1AACAFF2A2
 

Offline Saturo

  • Padavan of Locus
  • ***
  • Posts: 303
  • Thanked: 17 times
    • View Profile
  • Device: SG III
Re: [Tasker] Openandromaps map downloader
« Reply #1 on: January 07, 2022, 20:15:04 »
Was mache ich verkehrt, wenn ich diese Meldung erhalte?

20.13.49/Variables doreplresult: |%last_modified| -> |25_Dec_2021_16:10:07|
20.13.49/E Error helper execute: java.lang.IllegalArgumentException: Invalid format: "25_Dec_2021_16:10:07" is malformed at "Dec_2021_16:10:07"
   at org.joda.time.format.b.b(Unknown Source:103)
   at com.joaomgcd.taskerm.action.f.s.a(Unknown Source:155)
   at com.joaomgcd.taskerm.action.f.s.a(Unknown Source:2)
   at com.joaomgcd.taskerm.helper.a.a.l.f(Unknown Source:106)
   at net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source:402)
   at net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source:278)
   at net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source:0)
   at net.dinglisch.android.taskerm.ExecuteService$1.run(Unknown Source:489)
   at java.lang.Thread.run(Thread.java:764)

20.13.49/TD getStatic: Active load: true - ExecuteService
20.13.49/TD getStatic: Active load: true - ExecuteService
20.13.49/E Invalid format: "25_Dec_2021_16:10:07" is malformed at "Dec_2021_16:10:07"
20.13.49/E result: stop task (error)
20.13.49/E Fehler: 1
20.13.49/E Invalid format: "25_Dec_2021_16:10:07" is malformed at "Dec_2021_16:10:07"
20.13.49/MacroEdit action finished exeID 1 action no 15 code 394 status: Err next 15
 
The following users thanked this post: tapio

Offline tapio

  • Expert
  • Master of Locus
  • ****
  • Posts: 805
  • Thanked: 184 times
    • View Profile
Re: [Tasker] Openandromaps map downloader
« Reply #2 on: January 07, 2022, 21:49:25 »
Nichts... That is a part of the code dealing with the servers file timestamp.
Please tell me the url you tried...

You can deactivate line 16,19, 26-28 and it will work, force download. Longtap and select lines, on/off symbol in top bar.

Which version do you use?. The date/time command in question is quite new, Tasker has to be up to date.

EDIT OK, you tried Germany south, works here. Please, if you don't mind, does this test task drop the same error or does it output a number?

https://taskernet.com/shares/?user=AS35m8kdDIMDeveQcQfRglam%2Fah1mTW%2FWcg05FZ39c0i1q%2F77iY3E7cIwxCkXqJTaTA%3D&id=Task%3Adatetimetest
« Last Edit: January 07, 2022, 22:38:59 by tapio »
LM4 USER ID: 1AACAFF2A2
 

Offline Saturo

  • Padavan of Locus
  • ***
  • Posts: 303
  • Thanked: 17 times
    • View Profile
  • Device: SG III
Re: [Tasker] Openandromaps map downloader
« Reply #3 on: January 08, 2022, 10:46:28 »
I have tested with germany north and south.

Datetimetest also drops an error message:

10.45.06/E Error helper execute: java.lang.IllegalArgumentException: Invalid format: "25_Dec_2021_16:10:07" is malformed at "Dec_2021_16:10:07"
   at org.joda.time.format.b.b(Unknown Source:103)
   at com.joaomgcd.taskerm.action.f.s.a(Unknown Source:155)
   at com.joaomgcd.taskerm.action.f.s.a(Unknown Source:2)
   at com.joaomgcd.taskerm.helper.a.a.l.f(Unknown Source:106)
   at net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source:402)
   at net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source:278)
   at net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source:0)
   at net.dinglisch.android.taskerm.ExecuteService$1.run(Unknown Source:489)
   at java.lang.Thread.run(Thread.java:764)

10.45.06/TD getStatic: Active load: true - ExecuteService
10.45.06/TD getStatic: Active load: true - ExecuteService
10.45.06/E Invalid format: "25_Dec_2021_16:10:07" is malformed at "Dec_2021_16:10:07"
10.45.06/E result: stop task (error)
10.45.06/E Fehler: 1
10.45.06/E Invalid format: "25_Dec_2021_16:10:07" is malformed at "Dec_2021_16:10:07"
10.45.06/MacroEdit action finished exeID 1 action no 0 code 394 status: Err next 0
 

Offline tapio

  • Expert
  • Master of Locus
  • ****
  • Posts: 805
  • Thanked: 184 times
    • View Profile
Re: [Tasker] Openandromaps map downloader
« Reply #4 on: January 08, 2022, 11:53:14 »
What's your Tasker version and is it up to date? I'm on beta, but was convinced, the new but very unforgiving date/time command was already mature in stable version.
« Last Edit: January 08, 2022, 11:55:37 by tapio »
LM4 USER ID: 1AACAFF2A2
 

Offline tapio

  • Expert
  • Master of Locus
  • ****
  • Posts: 805
  • Thanked: 184 times
    • View Profile
Re: [Tasker] Openandromaps map downloader
« Reply #5 on: January 08, 2022, 12:11:45 »
Re-Download. As an intermediate solution, task will continue (but always download - no date check!) instead of stopping on the error. So the date check may only work for some users. Will find out.
Saturo, may you plase also download the datetimetest script again and let me know what it does? Is your Tasker updated?
« Last Edit: January 08, 2022, 12:25:55 by tapio »
LM4 USER ID: 1AACAFF2A2
 

Offline Saturo

  • Padavan of Locus
  • ***
  • Posts: 303
  • Thanked: 17 times
    • View Profile
  • Device: SG III
Re: [Tasker] Openandromaps map downloader
« Reply #6 on: January 08, 2022, 23:22:18 »
I use version 5.14.6

Next Test with datetimtest drops again the error message:

23.21.47/E Error helper execute: java.lang.IllegalArgumentException: Invalid format: "25_Dec_2021_16:10:07" is malformed at "Dec_2021_16:10:07"
   at org.joda.time.format.b.b(Unknown Source:103)
   at com.joaomgcd.taskerm.action.f.s.a(Unknown Source:155)
   at com.joaomgcd.taskerm.action.f.s.a(Unknown Source:2)
   at com.joaomgcd.taskerm.helper.a.a.l.f(Unknown Source:106)
   at net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source:402)
   at net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source:278)
   at net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source:0)
   at net.dinglisch.android.taskerm.ExecuteService$1.run(Unknown Source:489)
   at java.lang.Thread.run(Thread.java:764)

23.21.47/TD getStatic: Active load: true - ExecuteService
23.21.47/TD getStatic: Active load: true - ExecuteService
23.21.47/E Invalid format: "25_Dec_2021_16:10:07" is malformed at "Dec_2021_16:10:07"
23.21.47/E result: stop task (error)
23.21.47/E Fehler: 1
23.21.47/E Invalid format: "25_Dec_2021_16:10:07" is malformed at "Dec_2021_16:10:07"
23.21.47/MacroEdit action finished exeID 1 action no 0 code 394 status: Err next 0

Without date check, i prefer downloading the files manually.
 
The following users thanked this post: tapio