Parse
aria2c
control files from the command line.
The .aria2 (Control File) contains the hash info of the magnet link, so we can parse the file to get the original magnet link. This allows you to resume the download where it left off if it was cancelled or interrupted.
See this issue.
# ================================================================
# 0 1 2 3
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
# +---+-------+-------+-------------------------------------------+
# |VER| EXT |INFO |INFO HASH ... |
# |(2)| (4) |HASH | (INFO HASH LENGTH) |
# | | |LENGTH | |
# | | | (4) | |
# +---+---+---+-------+---+---------------+-------+---------------+
# |PIECE |TOTAL LENGTH |UPLOAD LENGTH |BIT- |BITFIELD ... |
# |LENGTH | (8) | (8) |FIELD | (BITFIELD |
# | (4) | | |LENGTH | LENGTH) |
# | | | | (4) | |
# +-------+-------+-------+-------+-------+-------+---------------+
# |NUM |INDEX |LENGTH |PIECE |PIECE BITFIELD ... |
# |IN- | (4) | (4) |BIT- | (PIECE BITFIELD LENGTH) |
# |FLIGHT | | |FIELD | |
# |PIECE | | |LENGTH | |
# | (4) | | | (4) | |
# +-------+-------+-------+-------+-------------------------------+
#
# ^ ^
# | |
# +-------------------------------------------------------+
# Repeated in (NUM IN-FLIGHT) PIECE times
# More information available at:
# https://aria2.github.io/manual/en/html/technical-notes.html
# ================================================================
python3 aria2_parser.py dahufa.aria2
With multiple files or with a directory:
python3 aria2_parser.py dahufa.aria2 dahufa.aria2 ./folder
Reading aria2 files from folder recursively:
python3 aria2_parser.py ./ -r
python3 setup.py build
python3 setup.py install