bugy / script-server

Web UI for your scripts with execution management
Other
1.61k stars 249 forks source link

How to get live progress of aria2c Downloader #490

Open anaschaudhary33 opened 3 years ago

anaschaudhary33 commented 3 years ago

When using script-server the aria2c prints only summary of downloding file but not live progress.

09/09 00:40:21 [NOTICE] Downloading 1 item(s)
 *** Download Progress Summary as of Thu Sep  9 00:41:22 2021 *** 
=
[#aa8b6f 20MiB/100MiB(20%) CN:8 DL:304KiB ETA:4m27s]
FILE: /home/pi/USB/home/Media/100MB.bin
-

 *** Download Progress Summary as of Thu Sep  9 00:42:31 2021 *** 
=
[#aa8b6f 41MiB/100MiB(41%) CN:8 DL:0B]
FILE: /home/pi/USB/home/Media/100MB.bin

While in shell it prints the live progress and also the summary in between as,

09/09 01:01:49 [NOTICE] Downloading 1 item(s)
 *** Download Progress Summary as of Thu Sep  9 01:02:49 2021 ***
====================================================
[#0f8c67 56MiB/100MiB(56%) CN:8 DL:0.9MiB ETA:46s]
FILE: /home/pi/USB/home/Media/100MB.bin
----------------------------------------------------

[#0f8c67 65MiB/100MiB(65%) CN:7 DL:874KiB ETA:40s]^C
09/09 01:03:01

Is there any way to get live downloading progress output in web-server??

Edit: Log file appears as

id:1
user_name:pi
user_id:pi
script:Simple Downloader
start_time:1631127991303
command:/home/pi/app/bugy/conf/scripts/Simple_Downloader.sh add https://speed.hetzner.de/100MB.bin
output_format:terminal
exit_code:-15
>>>>>  OUTPUT STARTED <<<<<

09/09 00:36:31 [NOTICE] Downloading 1 item(s)



















 *** Download Progress Summary as of Thu Sep  9 00:36:41 2021 *** 
=
[#7ddcef 3.0MiB/100MiB(3%) CN:8 DL:365KiB ETA:4m31s]
FILE: /home/pi/USB/home/Media/100MB.bin
-





















 *** Download Progress Summary as of Thu Sep  9 00:36:52 2021 *** 
=
[#7ddcef 6.3MiB/100MiB(6%) CN:8 DL:336KiB ETA:4m44s]
FILE: /home/pi/USB/home/Media/100MB.bin
-
















>> STOPPED BY USER
bugy commented 3 years ago

Hi, could you check the log file for whitespace characters? Are there any caret returns? Also, please make sure, that https://github.com/bugy/script-server/wiki/Script-config#requires_terminal is set to true

anaschaudhary33 commented 3 years ago

Already setup the requires_terminal as true. Here is the log file I have also attached the runner and script

bugy commented 3 years ago

Interesting... How do you see this in a history section? For me it looks correct: image

anaschaudhary33 commented 3 years ago

Interesting... How do you see this in a history section? For me it looks correct: image

My history looks similar as yours.

anaschaudhary33 commented 3 years ago

When using terminal it shows the download progress as gif.

And when the the output is redirect to a file using terminal, aria2c --conf-path=/home/pi/.aria2/aria2_alt.conf https://speed.hetzner.de/100MB.bin > test.log Than test.log

bugy commented 3 years ago

Cool, looks like a bug indeed.

To help me reproduce it, may I ask you to run your script in script server till the end (without stopping it) and:

  1. Notice if new rows are always added or sometimes they are replaced
  2. Send me the log file after execution (so it have more data than the previous example)
anaschaudhary33 commented 3 years ago

Done that. Noticed that no line replaced and only the new lines added. screenshot of output and full output copied from script server.

Log file.

bugy commented 3 years ago

Hi @anaschauhan33, I tried to reproduce it locally by using your logs, without any success. I believe aria2c behaves differently when run from script server or .sh file. Could you try to execute aria2c directly from script server "script_path"? i.e. "script_path": "aria2c --conf-path=/home/pi/.aria2/aria2_alt.conf"

bugy commented 3 years ago

Hi @anaschauhan33, I tried to reproduce it locally by using your logs, without any success. I believe aria2c behaves differently when run from script server or .sh file. Could you try to execute aria2c directly from script server "script_path"? i.e. "script_path": "aria2c --conf-path=/home/pi/.aria2/aria2_alt.conf"

anaschaudhary33 commented 3 years ago

You mean should I try to execute the same script (in terminal) which is in script-server's path??

{
  "name": "test",
  "script_path": "conf/scripts/test.sh",
  "requires_terminal": true,
  "output_format": "terminal",
  "parameters": [
    {
      "name": "text",
      "required": false,
      "type": "text"
    }
  ]
}

https://user-images.githubusercontent.com/70742968/133368353-791055ea-7758-4ef7-a9c4-5c19c47ae861.mp4

It is working fine in terminal.

bugy commented 3 years ago

No, I mean to use this configuration in Script server:

{
  "name": "test",
  "script_path": "aria2c --conf-path=/home/pi/.aria2/aria2_alt.conf",
  "requires_terminal": true,
  "output_format": "terminal",
  "parameters": [
    {
      "name": "text",
      "required": false,
      "type": "text"
    }
  ]
}

If it won't work, I'll try it in ~10 days. I have very limited access to internet now and cannot use a downloader for testing. And from the log files you provided, I don't see any root cause for a problem

anaschaudhary33 commented 3 years ago

I have tried. But got the same result. Here is the log file

anaschaudhary33 commented 3 years ago

If it won't work, I'll try it in ~10 days. I have very limited access to internet now and cannot use a downloader for testing. And from the log files you provided, I don't see any root cause for a problem

Thank you very much. I appreciate your efforts ☺️