mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[cli/models/lfs] Clean up some old code/comments
This commit is contained in:
parent
ead2bdc16c
commit
c4695d2b99
|
@ -1094,7 +1094,6 @@ class LegendaryCore:
|
||||||
delta = max(0, analysis.install_size - current_size)
|
delta = max(0, analysis.install_size - current_size)
|
||||||
min_disk_space = delta + analysis.biggest_file_size
|
min_disk_space = delta + analysis.biggest_file_size
|
||||||
|
|
||||||
# todo when resuming, only check remaining files
|
|
||||||
_, _, free = shutil.disk_usage(os.path.split(install.install_path)[0])
|
_, _, free = shutil.disk_usage(os.path.split(install.install_path)[0])
|
||||||
if free < min_disk_space:
|
if free < min_disk_space:
|
||||||
free_mib = free / 1024 / 1024
|
free_mib = free / 1024 / 1024
|
||||||
|
|
|
@ -103,7 +103,8 @@ class LGDLFS:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._installed = json.load(open(os.path.join(self.path, 'installed.json')))
|
self._installed = json.load(open(os.path.join(self.path, 'installed.json')))
|
||||||
except Exception as e: # todo do not do this
|
except Exception as e:
|
||||||
|
self.log.debug(f'Loading installed games failed: {e!r}')
|
||||||
self._installed = None
|
self._installed = None
|
||||||
|
|
||||||
# load existing app metadata
|
# load existing app metadata
|
||||||
|
|
|
@ -10,7 +10,6 @@ from uuid import uuid4
|
||||||
from legendary.utils.rolling_hash import get_hash
|
from legendary.utils.rolling_hash import get_hash
|
||||||
|
|
||||||
|
|
||||||
# ToDo do some reworking to make this more memory efficient
|
|
||||||
class Chunk:
|
class Chunk:
|
||||||
header_magic = 0xB1FE3AA2
|
header_magic = 0xB1FE3AA2
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,4 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
# ToDo more custom exceptions where it makes sense
|
|
||||||
|
|
||||||
|
|
||||||
class CaptchaError(Exception):
|
|
||||||
"""Raised by core if direct login fails"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidCredentialsError(Exception):
|
class InvalidCredentialsError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -16,8 +16,8 @@ def read_fstring(bio):
|
||||||
|
|
||||||
# if the length is negative the string is UTF-16 encoded, this was a pain to figure out.
|
# if the length is negative the string is UTF-16 encoded, this was a pain to figure out.
|
||||||
if length < 0:
|
if length < 0:
|
||||||
# utf-16 chars are 2 bytes wide but the length is # of characters, not bytes
|
# utf-16 chars are (generally) 2 bytes wide, but the length is # of characters, not bytes.
|
||||||
# todo actually make sure utf-16 characters can't be longer than 2 bytes
|
# 4-byte wide chars exist, but best I can tell Epic's (de)serializer doesn't support those.
|
||||||
length *= -2
|
length *= -2
|
||||||
s = bio.read(length - 2).decode('utf-16')
|
s = bio.read(length - 2).decode('utf-16')
|
||||||
bio.seek(2, 1) # utf-16 strings have two byte null terminators
|
bio.seek(2, 1) # utf-16 strings have two byte null terminators
|
||||||
|
|
Loading…
Reference in a new issue