Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiShi1313 committed Jan 18, 2022
1 parent b18006b commit ea9a5d5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.
50 changes: 34 additions & 16 deletions differential/constants.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,54 @@
from enum import Enum


BOOLEAN_STATES = {'1': True, 'yes': True, 'true': True, 'on': True,
'0': False, 'no': False, 'false': False, 'off': False}
BOOLEAN_STATES = {
"1": True,
"yes": True,
"true": True,
"on": True,
"0": False,
"no": False,
"false": False,
"off": False,
}

BOOLEAN_ARGS = ('generate_nfo', 'make_torrent', 'easy_upload', 'trim_description', 'combine_screenshots', 'use_short_bdinfo', 'use_short_url', 'reuse_torrent')
BOOLEAN_ARGS = (
"generate_nfo",
"make_torrent",
"easy_upload",
"trim_description",
"combine_screenshots",
"use_short_bdinfo",
"use_short_url",
"reuse_torrent",
"scan_bdinfo",
)

URL_SHORTENER_PATH = 'https://lg.to'
URL_SHORTENER_PATH = "https://lg.to"


class ImageHosting(Enum):
PTPIMG = 'ptpimg'
IMGURL = 'imgurl'
CHEVERETO = 'chevereto'
SMMS = 'smms'
BYR = 'byr'
HDB = 'hdb'
PTPIMG = "ptpimg"
IMGURL = "imgurl"
CHEVERETO = "chevereto"
SMMS = "smms"
BYR = "byr"
HDB = "hdb"

@staticmethod
def parse(s: str):
if isinstance(s, ImageHosting):
return s
if s.lower() == 'ptpimg':
if s.lower() == "ptpimg":
return ImageHosting.PTPIMG
elif s.lower() == 'imgurl':
elif s.lower() == "imgurl":
return ImageHosting.IMGURL
elif s.lower() == 'chevereto':
elif s.lower() == "chevereto":
return ImageHosting.CHEVERETO
elif s.lower() == 'smms':
elif s.lower() == "smms":
return ImageHosting.SMMS
elif s.lower() == 'byr':
elif s.lower() == "byr":
return ImageHosting.BYR
elif s.lower() == 'hdb':
elif s.lower() == "hdb":
return ImageHosting.HDB
raise ValueError(f"不支持的图床:{s}")
2 changes: 1 addition & 1 deletion differential/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def add_parser(cls, parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
parser.add_argument(
"--no-scan-bdinfo",
action="store_false",
dest="scan_bdinfo"
dest="scan_bdinfo",
help="如果为原盘,跳过扫描BDInfo",
default=argparse.SUPPRESS,
)
Expand Down

0 comments on commit ea9a5d5

Please sign in to comment.