mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 08:43:58 +03:00
move parse_size to dongting.py
This commit is contained in:
parent
d152c3e78d
commit
388e5f0b1c
@ -1023,12 +1023,3 @@ def any_download_playlist(url, **kwargs):
|
|||||||
def main():
|
def main():
|
||||||
script_main('you-get', any_download, any_download_playlist)
|
script_main('you-get', any_download, any_download_playlist)
|
||||||
|
|
||||||
_unit_prefixes = 'bkmg'
|
|
||||||
|
|
||||||
def parse_size(size):
|
|
||||||
m = re.match(r'([\d.]+)(.(?:i?B)?)', size, re.I)
|
|
||||||
if m:
|
|
||||||
return int(float(m.group(1)) * 1024 **
|
|
||||||
_unit_prefixes.index(m.group(2).lower()))
|
|
||||||
else:
|
|
||||||
return 0
|
|
||||||
|
@ -4,6 +4,16 @@ __all__ = ['dongting_download']
|
|||||||
|
|
||||||
from ..common import *
|
from ..common import *
|
||||||
|
|
||||||
|
_unit_prefixes = 'bkmg'
|
||||||
|
|
||||||
|
def parse_size(size):
|
||||||
|
m = re.match(r'([\d.]+)(.(?:i?B)?)', size, re.I)
|
||||||
|
if m:
|
||||||
|
return int(float(m.group(1)) * 1024 **
|
||||||
|
_unit_prefixes.index(m.group(2).lower()))
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
def dongting_download_lyric(lrc_url, file_name, output_dir):
|
def dongting_download_lyric(lrc_url, file_name, output_dir):
|
||||||
j = get_html(lrc_url)
|
j = get_html(lrc_url)
|
||||||
info = json.loads(j)
|
info = json.loads(j)
|
||||||
|
Loading…
Reference in New Issue
Block a user