Incorrect filename after download
Some downloads fail to rename temporary download filename into the requested one.
Reminder: aria2 does not respect the requested local filename when downloading a metalink-ready URI (because it could be multiple files I think). So our downloader looks into aria2 log for the location of the saved file and then moves it to the requested location.
Apparently, sometimes, the downloader doesn't detect this behavior and doesn't move the file (when it does, it's in the log).
[15:57:57] [STAGE 2/5: Download contents - 30%]
[15:57:57] --> Retrieving wikipedia_ar_basketball_novid.ar.zim (154.3 MiB)
[#c0c34e 44MiB/154MiB(28%) CN:3 DL:52MiB ETA:2s]
[#c0c34e 44MiB/154MiB(28%) CN:3 DL:52MiB ETA:2s]
[#c0c34e 82MiB/154MiB(53%) CN:3 DL:45MiB ETA:1s]
[#c0c34e 82MiB/154MiB(53%) CN:3 DL:45MiB ETA:1s]
[#c0c34e 110MiB/154MiB(71%) CN:2 DL:39MiB ETA:1s]
[#c0c34e 110MiB/154MiB(71%) CN:2 DL:39MiB ETA:1s]
[#c0c34e 130MiB/154MiB(84%) CN:2 DL:34MiB]
[#c0c34e 130MiB/154MiB(84%) CN:2 DL:34MiB]
[#c0c34e 140MiB/154MiB(90%) CN:1 DL:29MiB]
[#c0c34e 140MiB/154MiB(90%) CN:1 DL:29MiB]
[#c0c34e 146MiB/154MiB(95%) CN:1 DL:25MiB]
[#c0c34e 146MiB/154MiB(95%) CN:1 DL:25MiB]
[#c0c34e 153MiB/154MiB(99%) CN:1 DL:22MiB]
[#c0c34e 153MiB/154MiB(99%) CN:1 DL:22MiB]
Saved `wikipedia_ar_basketball_novid.ar.zim` successfuly: 154.3 MiB
[15:58:04] [STAGE 2/5: Download contents - 30%]
[15:58:04] --> Retrieving wikipedia_ar_basketball_maxi.ar.zim (68.24 MiB)
[#a1dac1 44MiB/68MiB(65%) CN:2 DL:71MiB]
[#a1dac1 44MiB/68MiB(65%) CN:2 DL:71MiB]
Saved `wikipedia_ar_basketball_maxi.ar.zim` successfuly: 68.24 MiB
[15:58:05] [STAGE 2/5: Download contents - 30%]
[15:58:05] --> Retrieving wikipedia_ar_football_maxi.ar.zim (529.17 MiB)
[#bf9a88 46MiB/529MiB(8%) CN:5 DL:61MiB ETA:7s]
[#bf9a88 46MiB/529MiB(8%) CN:5 DL:61MiB ETA:7s]
[#bf9a88 126MiB/529MiB(23%) CN:5 DL:72MiB ETA:5s]
[#bf9a88 126MiB/529MiB(23%) CN:5 DL:72MiB ETA:5s]
[#bf9a88 201MiB/529MiB(38%) CN:5 DL:73MiB ETA:4s]
[#bf9a88 201MiB/529MiB(38%) CN:5 DL:73MiB ETA:4s]
[#bf9a88 271MiB/529MiB(51%) CN:5 DL:72MiB ETA:3s]
[#bf9a88 271MiB/529MiB(51%) CN:5 DL:72MiB ETA:3s]
[#bf9a88 331MiB/529MiB(62%) CN:5 DL:70MiB ETA:2s]
[#bf9a88 331MiB/529MiB(62%) CN:5 DL:70MiB ETA:2s]
[#bf9a88 398MiB/529MiB(75%) CN:5 DL:69MiB ETA:1s]
[#bf9a88 398MiB/529MiB(75%) CN:5 DL:69MiB ETA:1s]
[#bf9a88 448MiB/529MiB(84%) CN:3 DL:66MiB ETA:1s]
[#bf9a88 448MiB/529MiB(84%) CN:3 DL:66MiB ETA:1s]
[#bf9a88 462MiB/529MiB(87%) CN:3 DL:60MiB ETA:1s]
[#bf9a88 462MiB/529MiB(87%) CN:3 DL:60MiB ETA:1s]
[#bf9a88 485MiB/529MiB(91%) CN:3 DL:55MiB]
[#bf9a88 485MiB/529MiB(91%) CN:3 DL:55MiB]
[#bf9a88 503MiB/529MiB(95%) CN:1 DL:52MiB]
[#bf9a88 503MiB/529MiB(95%) CN:1 DL:52MiB]
[#bf9a88 504MiB/529MiB(95%) CN:1 DL:44MiB]
[#bf9a88 504MiB/529MiB(95%) CN:1 DL:44MiB]
Saved `wikipedia_ar_football_maxi.ar.zim` successfuly: 529.17 MiB
[15:58:17] [STAGE 2/5: Download contents - 30%]
[15:58:17] --> Retrieving wiktionary_ar_all_nopic.ar.zim (31.17 MiB)
[15:58:18] Installation failed: [Errno 2] No such file or directory: '/data/kiwix-hotspot.cache/wiktionary_ar_all_nopic.ar.zim'
--- Exception Trace ---
Traceback (most recent call last):
File "run_installation.py", line 224, in run_installation
File "backend/download.py", line 244, in download_content
File "backend/download.py", line 218, in download_if_missing
File "backend/download.py", line 202, in download_file
File "genericpath.py", line 50, in getsize
FileNotFoundError: [Errno 2] No such file or directory: '/data/kiwix-hotspot.cache/wiktionary_ar_all_nopic.ar.zim'
---
Restoring system sleep policy
Resuming xdg-screensaver (wid #None)
*** DURATIONS SUMMARY ***
[1/5] Retrieve Master Image: 1 minute and 17.08 seconds (Mon Sep 2 15:51:56 2019 to Mon Sep 2 15:53:13 2019)
[2/5] Download contents: 5 minutes and 4.86 seconds (Mon Sep 2 15:53:13 2019 to Mon Sep 2 15:58:18 2019)
TOTAL: 6 minutes and 21.96 seconds (Mon Sep 2 15:51:56 2019 to Mon Sep 2 15:58:18 2019)