1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-23 19:55:38 +01:00

logging f-strings fixes

This commit is contained in:
Johan Andersson 2021-12-18 21:36:16 +01:00
parent 96544ae2f8
commit e20d753a15
8 changed files with 18 additions and 15 deletions

View File

@ -72,5 +72,5 @@ def main():
except KeyboardInterrupt:
print("")
except (yaml.YAMLError, yaml.MarkedYAMLError) as e:
logging.error(f"Your settings file(s) contain invalid YAML syntax! Please fix and restart!, {str(e)}")
logging.error("Your settings file(s) contain invalid YAML syntax! Please fix and restart!, %s", str(e))
sys.exit(2)

View File

@ -57,9 +57,9 @@ class postprocess:
videotrack, audiotrack = _checktracks(streams)
if self.config.get("merge_subtitle"):
logging.info(f"Merge audio, video and subtitle into {new_name.name}")
logging.info("Merge audio, video and subtitle into %s", new_name.name)
else:
logging.info(f"Merge audio and video into {new_name.name}")
logging.info("Merge audio and video into %s", new_name.name)
tempfile = orig_filename.with_suffix(".temp")
arguments = ["-c:v", "copy", "-c:a", "copy", "-f", "matroska" if self.config.get("output_format") == "mkv" else "mp4"]

View File

@ -55,7 +55,7 @@ class Service:
else:
self.http = http
logging.debug(f"service: {self.__class__.__name__.lower()}")
logging.debug("service: %s", self.__class__.__name__.lower())
@property
def url(self):

View File

@ -38,7 +38,7 @@ class subtitle:
self.output["ext"] = output_ext
dupe, fileame = find_dupes(self.output, self.config, False)
if dupe and not self.config.get("force_subtitle"):
logging.warning(f"File ({fileame.name}) already exists. Use --force-subtitle to overwrite")
logging.warning("File (%s) already exists. Use --force-subtitle to overwrite", fileame.name)
return
subdata = self.http.request("get", self.url)
if subdata.status_code != 200:

View File

@ -44,7 +44,7 @@ def get_media(url, options, version="Unknown"):
url = f"http://{url}"
if options.get("verbose"):
logging.debug(f"version: {version}")
logging.debug("version: %s", version)
stream = service_handler(sites, options, url)
if not stream:
@ -141,8 +141,11 @@ def get_one_media(stream):
pub_date = None
if after_date is not None and pub_date is not None and pub_date.date() < after_date.date():
logging.info(
f"Video {stream.output['title']}S{stream.output['season']}E{stream.output['episode']}"
f" skipped since published {pub_date.date()} before {after_date.date()}.",
"Video %sS%dE%d skipped since published %s.",
stream.output["title"],
stream.output["season"],
stream.output["episode"],
pub_date.date(),
)
return
@ -163,7 +166,7 @@ def get_one_media(stream):
else:
errormsg = str(exc)
if errormsg:
logging.error(f"No videos found. {errormsg}")
logging.error("No videos found. %s", errormsg)
else:
logging.error("No videos found.")
else:
@ -188,7 +191,7 @@ def get_one_media(stream):
dupe, fileame = find_dupes(fstream.output, stream.config)
if dupe and not stream.config.get("force"):
logging.warning(f"File ({fileame.name}) already exists. Use --force to overwrite")
logging.warning("File (%s) already exists. Use --force to overwrite", fileame.name)
return
if fstream.config.get("output_format") and fstream.config.get("output_format").lower() not in ["mkv", "mp4"]:
logging.error("Unknown output format. please choose mp4 or mkv")
@ -206,7 +209,7 @@ def get_one_media(stream):
stream.get_thumbnail(stream.config)
if fstream.config.get("silent_semi") and fstream.finished:
logging.log(25, f"Download of {formatname(fstream.output, fstream.config, fstream.output_extention)} was completed")
logging.log(25, "Download of %s was completed", formatname(fstream.output, fstream.config, fstream.output_extention))
if fstream.config.get("no_postprocess") is True or all(fstream.config.get(x) for x in ["no_remux", "no_merge"]) is True:
logging.info("All done. Not postprocessing files, leaving them completely untouched.")

View File

@ -33,7 +33,7 @@ def write_nfo_episode(output, config):
filename = formatname(loutout, config)
dupe, fileame = find_dupes(loutout.copy(), config, False)
if dupe and not config.get("force_nfo"):
logging.warning(f"File ({fileame.name}) already exists. Use --force-nfo to overwrite")
logging.warning("File (%s) already exists. Use --force-nfo to overwrite", fileame.name)
return
logging.info("NFO episode: %s", filename)
@ -67,7 +67,7 @@ def write_nfo_tvshow(output, config):
filename = formatname(loutput, cconfig)
dupe, fileame = find_dupes(loutput, cconfig, False)
if dupe and not cconfig.get("force_nfo"):
logging.warning(f"File ({fileame.name}) already exists. Use --force-nfo to overwrite")
logging.warning("File (%s) already exists. Use --force-nfo to overwrite", fileame.name)
return
logging.info("NFO show: %s", filename)

View File

@ -463,7 +463,7 @@ def readconfig(config, configfile, service=None, preset=None):
data = fd.read()
configdata = safe_load(data)
except PermissionError:
logging.error(f"Permission denied while reading config: {configfile}")
logging.error("Permission denied while reading config: %s", configfile)
if configdata is None:
return config

View File

@ -8,5 +8,5 @@ def run_program(cmd, show=True):
stderr = stderr.decode("utf-8", "replace")
if p.returncode != 0 and show:
msg = stderr.strip()
logging.error(f"Something went wrong: {msg}")
logging.error("Something went wrong: %s", msg)
return p.returncode, stdout, stderr