summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNayil Mukhametshin <66028747+nlscc@users.noreply.github.com>2020-07-30 14:38:56 +0200
committerNayil Mukhametshin <66028747+nlscc@users.noreply.github.com>2020-07-30 14:38:56 +0200
commit8899c8d5821ac06f0dd09fbb2a7a0577fa9d5eb2 (patch)
tree9addb5a837ec69f24d0e28ec43fca48709a89c98
parentfix #3 (broken checkupdate command) (diff)
downloadsamloader-8899c8d5821ac06f0dd09fbb2a7a0577fa9d5eb2.tar
samloader-8899c8d5821ac06f0dd09fbb2a7a0577fa9d5eb2.tar.gz
samloader-8899c8d5821ac06f0dd09fbb2a7a0577fa9d5eb2.tar.bz2
samloader-8899c8d5821ac06f0dd09fbb2a7a0577fa9d5eb2.tar.lz
samloader-8899c8d5821ac06f0dd09fbb2a7a0577fa9d5eb2.tar.xz
samloader-8899c8d5821ac06f0dd09fbb2a7a0577fa9d5eb2.tar.zst
samloader-8899c8d5821ac06f0dd09fbb2a7a0577fa9d5eb2.zip
-rw-r--r--README.md4
-rw-r--r--samloader/main.py8
2 files changed, 7 insertions, 5 deletions
diff --git a/README.md b/README.md
index de66c0e..af0633c 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@ Download firmware for Samsung devices (without any extra Windows drivers).
## Usage
`checkupdate [model] [region]`: Check the latest firmware version
-`download [version] [model] [region] [outfile]`: Download the specified firmware version for a given phone and region
+`download [version] [model] [region] [out]`: Download the specified firmware version for a given phone and region to a specified file or directory
`decrypt2 [version] [model] [region] [infile] [outfile]`: Decrypt enc2 encrypted firmwares
@@ -12,7 +12,7 @@ Download firmware for Samsung devices (without any extra Windows drivers).
```
$ samloader checkupdate GT-I8190N BTU
I8190NXXAMJ2/I8190NBTUAMJ1/I8190NXXAMJ2/I8190NXXAMJ2
-$ samloader download I8190NXXAMJ2/I8190NBTUAMJ1/I8190NXXAMJ2/I8190NXXAMJ2 GT-I8190N BTU GT-I8190N_BTU_1_20131118100230_9ae3yzkqmu_fac.zip.enc2
+$ samloader download I8190NXXAMJ2/I8190NBTUAMJ1/I8190NXXAMJ2/I8190NXXAMJ2 GT-I8190N BTU .
Downloading file /neofus/9/GT-I8190N_BTU_1_20131118100230_9ae3yzkqmu_fac.zip.enc2 ...
[################################] 10570/10570 - 00:02:02
Done!
diff --git a/samloader/main.py b/samloader/main.py
index e8fca4f..a4896bb 100644
--- a/samloader/main.py
+++ b/samloader/main.py
@@ -38,15 +38,17 @@ def checkupdate(model, region):
@click.argument("version")
@click.argument("model")
@click.argument("region")
-@click.argument("outfile")
-def download(version, model, region, outfile):
+@click.argument("out")
+def download(version, model, region, out):
client = fusclient.FUSClient()
path, filename = getbinaryfile(client, version, region, model)
print("Downloading file {} ...".format(path+filename))
initdownload(client, filename)
r = client.downloadfile(path+filename)
length = int(r.headers["Content-Length"])
- with open(outfile, "wb") as f:
+ if os.path.isdir(out):
+ out = os.path.join(out, filename)
+ with open(out, "wb") as f:
for chunk in progress.bar(r.iter_content(chunk_size=0x10000), expected_size=(length/0x10000)+1):
if chunk:
f.write(chunk)