used the proper filename sanitizer

As reported by KajeArch on GitHub on issue #3
(https://github.com/swolegoal/squid-dl/issues/3), I was not correctly
handling playlists named with characters invalid for a file path.  As
it turns out, I was using the wrong helper function from yt_dlp.utils.

I changed all the calls from sanitize_path(), a function made to clean
up Windows paths to the more fully-featured sanitize_filename().  If any
Windows users notice any bad behavior after this change, please feel
free to make a ticket at:
  https://github.com/swolegoal/squid-dl/issues/new/choose
This commit is contained in:
Andrea Rogers 2022-08-22 18:17:27 -05:00
commit 7ab21cccb2
2 changed files with 5 additions and 5 deletions

View file

@ -38,7 +38,7 @@ from random import randint
from time import sleep
import typing
from yt_dlp import YoutubeDL
from yt_dlp.utils import encodeFilename, sanitize_path
from yt_dlp.utils import encodeFilename, sanitize_filename
from yt_dlp.extractor.common import InfoExtractor as IE
from .linode import LinodeProxy
@ -233,7 +233,7 @@ def check_dl(in_q: Queue, out_q: Queue):
y = YoutubeDL({"ignoreerrors": True})
basename = os.path.splitext(
sanitize_path(encodeFilename(y.prepare_filename(entry)))
sanitize_filename(encodeFilename(y.prepare_filename(entry)))
)[0]
try:
if check_subs_done(entry, basename):
@ -458,7 +458,7 @@ def main(args: [str], name: str) -> int:
print("[INFO]: Starting squid-dl...")
dirname = info_dict["title"]
dirname = sanitize_filename(info_dict["title"])
print('[INFO]: saving videos to "{}" directory'.format(dirname))
if not (os.path.exists(dirname) and os.path.isdir(dirname)):
os.mkdir(dirname)