Skip to content
This repository was archived by the owner on Mar 15, 2025. It is now read-only.

Primarily updates to add parameters which improve performance.#68

Open
slootsky wants to merge 1 commit into
xtream1101:mainfrom
slootsky:main
Open

Primarily updates to add parameters which improve performance.#68
slootsky wants to merge 1 commit into
xtream1101:mainfrom
slootsky:main

Conversation

@slootsky

Copy link
Copy Markdown

I have been using the following parameters:
--chunk_size 16k
--write-buffer 1G
--timeout 30

I have been using the following parameters:
--chunk_size 16k
--write-buffer 1G
--timeout 30
Comment on lines +17 to +49
# convert a string representing size to an integer
def parse_size(size):
# Base10 unit definitions
# K=x1000 M=x10000000 G=x1000000000
# units = {"K": 10**3, "M": 10**6, "G": 10**9, "T": 10**12}
# Binary unit definitions:
# K=x1024 M=x1024x1024 etc
units = {"K": 2**10, "M": 2**20, "G": 2**30, "T": 2**40}
try:
return int(size) # if it's an int already just return it
except ValueError: # it wasn't an int
size=size.upper()
if size.endswith('B'):
return parse_size(size[:-1])
unit=size[-1:]
number=size[:-1]
if unit not in units.keys():
raise ValueError(f'Invalid Unit: {unit}')
return int(float(number)*units[unit])

# convert a string represting time to an integer number of seconds
def parse_seconds(size):
# convert parameter to number of seconds
units = {"S": 1, "M": 60, "H": 60*60, "D": 60*60*24, 'W': 60*60*24*7}
try:
return int(size) # if it's an int already just return it
except ValueError: # it wasn't an int
size=size.upper()
unit=size[-1:]
number=size[:-1]
if unit not in units.keys():
raise ValueError(f'Invalid Unit: {unit}')
return int(float(number)*units[unit])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://pypi.org/project/humanfriendly/ is a library option for this functionality

)
parser.add_argument(
'-b', '--write-buffer',
type=str, default=1024*1024,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this the only argument with a default set here while all the others are set in the download_library.py init?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants