Feature/fix export on url (#4823)

* added callbacks

* added back callback to main

* added save_dir to callback output

* merged in upstream

* removed ghost code

* added url check

* Add url2file()

* Update file-only

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Kalen MichaelandGlenn Jocher authored and GitHub committed 2021-09-16 13:33:54 +02:00
1 parent 0dc725e3dc
commit 43b2817f6e
2 files changed
+9 -2

No files matched your search

+7
View File
@@ -360,6 +360,13 @@ def check_dataset(data, autodownload=True):
return data # dictionary
def url2file(url):
# Convert URL to filename, i.e. https://url.com/file.txt?auth -> file.txt
url = str(Path(url)).replace(':/', '://') # Pathlib turns :// -> :/
file = Path(urllib.parse.unquote(url)).name.split('?')[0] # '%2F' to '/', split https://url.com/file.txt?auth
return file
def download(url, dir='.', unzip=True, delete=True, curl=False, threads=1):
# Multi-threaded file download and unzip function, used in data.yaml for autodownload
def download_one(url, dir):