Skip to content

Commit

Permalink
🎁🪲🔨Hotfix 3.1.1b
Browse files Browse the repository at this point in the history
- Hotfix: Fixed CivitAI link refuses to be downloaded properly. Seems like CivitAI changes its API.
- Fixed several bugs on Windows, especially SDless
  • Loading branch information
etherealxx committed Mar 30, 2023
1 parent beb4ded commit fceda4d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
<ul><li><a href="#sdless-mode">SDless mode</a></li></ul>
<ul><li><a href="#local-installation-support">Local Installation Support</a></li></ul>
<ul><li><a href="#debug-mode-developer-only">Debug Mode (Developer only)</a></li></ul>
<li><a href="#latest-release-v311">Latest release: v3.1.1</a></li>
<li><a href="#latest-release-v311b">Latest release: v3.1.1b</a></li>
<ul><li><a href="#release-v311b">Release v3.1.1b</a></li></ul>
<ul><li><a href="#release-v311a">Release v3.1.1a</a></li></ul>
<ul><li><a href="#release-v311">Release v3.1.1</a></li></ul>
<ul><li><a href="#release-v310a">Release v3.1.0a</a></li></ul>
<ul><li><a href="#release-v310">Release v3.1.0</a></li></ul>
Expand Down Expand Up @@ -380,7 +382,11 @@ There are some batchlinks syntax features that only available on debug mode (put

`@debugresetdownload` - This command is (supposed to) download a single link with every method available (gdown, curl, wget, aria2), but now i rarely use this command, and haven't updated since. Might be buggy.

## Latest release: v3.1.1a
## Latest release: v3.1.1b

#### Release v3.1.1b
- Hotfix: Fixed CivitAI link refuses to be downloaded properly. Seems like CivitAI changes its API.
- Fixed several bugs on Windows, especially SDless

#### Release v3.1.1a
- Hotfix: Fixed CivitAI 'model type chooser' bug and fixed `@extract` bug on colab
Expand Down
34 changes: 26 additions & 8 deletions scripts/batchlinks-downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,9 @@ def getcivitname(link, frommodeltypechooser=False): #@note getcivitname
print('')
return 'batchlinksskip'
cuttedcontent = contentdis.find('response-content-disposition=attachment%3B%20filename%3D%22') + 59
filename = str(contentdis[cuttedcontent:]).replace('%22&x-id=GetObject', '')
# filename = str(contentdis[cuttedcontent:]).replace('%22&x-id=GetObject', '') #obsolete since 30-03-2023
filename = str(contentdis[cuttedcontent:]).partition('%22&')[0]
# filename = contentdis.split('filename=')[-1].split('%22')[1] #this also works i guess
filename = civitmodeltypename(filename, link)
currentcondition = tempcondition
return filename
Expand Down Expand Up @@ -845,7 +847,10 @@ def civitlinkandnamer(model):

if prockilled == False:
hfdown(image_url, imagejpg_save_path, downloader, currentmode)
civitdown2_convertimage(imagejpg_save_path, imagepng_save_path)
if os.path.exists(imagejpg_save_path):
civitdown2_convertimage(imagejpg_save_path, imagepng_save_path)
else:
print(imagejpg_save_path + " doesn't exist")
print(f"{data_save_path} successfully downloaded.")


Expand Down Expand Up @@ -898,7 +903,10 @@ def hfdown(todownload, folder, downloader, mode='default', torename=''): #@note
filepath = folder
filepath_s = shlex.quote(folder)
todownload_s = todownload
folder_s = pathlib.Path(folder).parent.resolve()
folder = os.path.dirname(filepath)
# folder_s = pathlib.Path(folder).parent.resolve()
folder_s = shlex.quote(folder)
folder_win = folder
else:
if mode=='pixeldrain' or mode=='dropbox':
filename = torename
Expand All @@ -909,6 +917,16 @@ def hfdown(todownload, folder, downloader, mode='default', torename=''): #@note
filepath_s = shlex.quote(filepath)
todownload_s = shlex.quote(todownload)
folder_s = shlex.quote(folder)
folder_win = folder
printvardebug(folder)
printvardebug(todownload)
printvardebug(filename)
printvardebug(filename_s)
printvardebug(filepath)
printvardebug(filepath_s)
printvardebug(todownload_s)
printvardebug(folder_s)
printvardebug(folder_win)
#savestate_folder(folder_s)
if platform.system() == "Windows": #@note windows downloader
localappdata = os.environ['LOCALAPPDATA']
Expand All @@ -934,7 +952,7 @@ def hfdown(todownload, folder, downloader, mode='default', torename=''): #@note
currentcondition = tempcondition
gdownupgraded = True
try:
runwithsubprocess(f"gdown {todownload_s} -O {filepath_s}", folder)
runwithsubprocess(f"gdown {todownload_s} -O {filepath_s}", folder_win)
except FileNotFoundError:
import gdown
gdown.download(todownload, filepath, quiet=False)
Expand All @@ -955,9 +973,9 @@ def hfdown(todownload, folder, downloader, mode='default', torename=''): #@note
print('wget Windows installed!')
print('')
currentcondition = tempcondition
runwithsubprocess(f"{shlex.quote(wgetpath)} -O {filepath_s} {todownload_s} --progress=bar:force", folder)
runwithsubprocess(f"{shlex.quote(wgetpath)} -O {filepath_s} {todownload_s} --progress=bar:force", folder_win)
elif downloader=='curl':
runwithsubprocess(f"curl -Lo {filepath_s} {todownload_s}", folder)
runwithsubprocess(f"curl -Lo {filepath_s} {todownload_s}", folder_win)
elif downloader=='aria2':
# checkaria = subprocess.getoutput(ariapath)
# if "is not recognized" in checkaria or "cannot find the path" in checkaria:
Expand All @@ -976,8 +994,8 @@ def hfdown(todownload, folder, downloader, mode='default', torename=''): #@note
print('')
currentcondition = tempcondition
# ariamode = True
runwithsubprocess(f"{shlex.quote(ariapath)} --summary-interval=1 --console-log-level=error --check-certificate=false -c -x 16 -s 16 -k 1M {todownload_s} -d {folder_s} -o {filename_s}", folder, False, 'aria2')
else:
runwithsubprocess(f"{shlex.quote(ariapath)} --summary-interval=1 --console-log-level=error --check-certificate=false -c -x 16 -s 16 -k 1M {todownload_s} -d {folder_s} -o {filename_s}", folder_win, False, 'aria2')
else: #non-windows
if downloader=='gdown':
printdebug(f"debug gdown {todownload_s} -O {filepath_s}")
runwithsubprocess(f"gdown {todownload_s} -O {filepath_s}", folder_s)
Expand Down
6 changes: 5 additions & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
v3.1.1a
v3.1.1b
(^current version^)

Release notes:

## v3.1.1b
- Hotfix: Fixed CivitAI link refuses to be downloaded properly. Seems like CivitAI changes its API.
- Fixed several bugs on Windows, especially SDless

## v3.1.1a
- Hotfix: Fixed CivitAI 'model type chooser' bug and fixed `@extract` bug on colab

Expand Down

0 comments on commit fceda4d

Please sign in to comment.