Next: , Previous: Filters, Up: Top



ZDL
How to use ZDL
Tools and functions
Expanding ZDL
English version Versione italiana

Create new extensions

How to add custom and experimental extensions.

ZDL incorporates the code it finds in all the bash scripts with the extension .sh in the directory $HOME/.zdl/extensions /

Example bash script:

     if [[ "$url_in" = ~ PATTERN ]]
     then
        url_in_file = $(sed -r 's|http://(.+)|http://USER:PASSWORD@\1|g' \
                            <<< "$url_in")
        file_in="NOME_DEL_FILE"
        max_dl=1
        axel_parts=3
        aria2_connections=3
     
        end_extension
     fi

The example can be used as a template for a link recognized through a regex in the PATTERN. The script modifies the download link in $url_in to get the URL of the file in $url_in_file, adding USER and PASSWORD to access the server. Also, indicate how to get the name of the file to download (variable $file_in) and add or change options: disable the --max-downloads= option if applied to the command and establishes the number of parts to be downloaded with Axel (the degree of acceleration, which by default is 32 but for several servers may be excessive or insufficient, worsening performance) and that of Aria2 (maximum 16 connections). The end_extension function check if an file_in exists and if url_in_file is valid.

In this way, it is possible to extend ZDL to other file services hosting (also for experimental purposes), add targeted options and customized or implement program operation, using the variables and functions available in ZDL without change the source