Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import csv
- import os
- import wget
- import sys
- #Title ID Region Name PKG direct link RAP Content ID Last Modification Date Download .RAP file File Size SHA256
- if len(sys.argv)<2:
- print("Please specify tsv file")
- sys.exit(1)
- with open(sys.argv[1]) as fd:
- tsvfile = csv.reader(fd, delimiter="\t", quotechar='"')
- next(tsvfile)
- for row in tsvfile:
- if row[0] == "":
- print("Missing Title ID: " + str(row))
- continue
- title_region = row[0] + "_" + row[1]
- dirPath = "data/" + title_region
- if not row[3].startswith("http"):
- if row[3] != "MISSING":
- print(row[3])
- continue
- dl_name = row[3].split("/")[-1]
- #print(dl_name)
- os.makedirs(dirPath, exist_ok=True)
- filePath = dirPath + "/" + dl_name
- if os.path.isfile(filePath) and (os.path.getsize(filePath) == int(row[8])):
- print("Skip already downloaded file" + filePath)
- continue
- print("Download " + filePath)
- wget.download(row[3], filePath)
- print("")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement