mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
patch popen on windows-python <3.8
This commit is contained in:
parent
09cea66aa8
commit
df64a62a03
|
@ -238,7 +238,6 @@ some improvement ideas
|
||||||
|
|
||||||
# bugs
|
# bugs
|
||||||
|
|
||||||
* Windows: python 3.7 and older cannot read tags with FFprobe, so use Mutagen or upgrade
|
|
||||||
* Windows: python 2.7 cannot index non-ascii filenames with `-e2d`
|
* Windows: python 2.7 cannot index non-ascii filenames with `-e2d`
|
||||||
* Windows: python 2.7 cannot handle filenames with mojibake
|
* Windows: python 2.7 cannot handle filenames with mojibake
|
||||||
* `--th-ff-jpg` may fix video thumbnails on some FFmpeg versions (macos, some linux)
|
* `--th-ff-jpg` may fix video thumbnails on some FFmpeg versions (macos, some linux)
|
||||||
|
|
|
@ -262,11 +262,7 @@ class MTag(object):
|
||||||
self.usable = True
|
self.usable = True
|
||||||
self.prefer_mt = not args.no_mtag_ff
|
self.prefer_mt = not args.no_mtag_ff
|
||||||
self.backend = "ffprobe" if args.no_mutagen else "mutagen"
|
self.backend = "ffprobe" if args.no_mutagen else "mutagen"
|
||||||
self.can_ffprobe = (
|
self.can_ffprobe = HAVE_FFPROBE and not args.no_mtag_ff
|
||||||
HAVE_FFPROBE
|
|
||||||
and not args.no_mtag_ff
|
|
||||||
and (not WINDOWS or sys.version_info >= (3, 8))
|
|
||||||
)
|
|
||||||
mappings = args.mtm
|
mappings = args.mtm
|
||||||
or_ffprobe = " or FFprobe"
|
or_ffprobe = " or FFprobe"
|
||||||
|
|
||||||
|
@ -290,11 +286,6 @@ class MTag(object):
|
||||||
msg = "found FFprobe but it was disabled by --no-mtag-ff"
|
msg = "found FFprobe but it was disabled by --no-mtag-ff"
|
||||||
self.log(msg, c=3)
|
self.log(msg, c=3)
|
||||||
|
|
||||||
elif WINDOWS and sys.version_info < (3, 8):
|
|
||||||
or_ffprobe = " or python >= 3.8"
|
|
||||||
msg = "found FFprobe but your python is too old; need 3.8 or newer"
|
|
||||||
self.log(msg, c=1)
|
|
||||||
|
|
||||||
if not self.usable:
|
if not self.usable:
|
||||||
msg = "need Mutagen{} to read media tags so please run this:\n{}{} -m pip install --user mutagen\n"
|
msg = "need Mutagen{} to read media tags so please run this:\n{}{} -m pip install --user mutagen\n"
|
||||||
pybin = os.path.basename(sys.executable)
|
pybin = os.path.basename(sys.executable)
|
||||||
|
|
|
@ -625,6 +625,17 @@ class HMaccas(object):
|
||||||
return self.b(msg.encode("utf-8", "replace"))
|
return self.b(msg.encode("utf-8", "replace"))
|
||||||
|
|
||||||
|
|
||||||
|
if WINDOWS and sys.version_info < (3, 8):
|
||||||
|
_popen = sp.Popen
|
||||||
|
|
||||||
|
def _spopen(c, *a, **ka):
|
||||||
|
enc = sys.getfilesystemencoding()
|
||||||
|
c = [x.decode(enc, "replace") if hasattr(x, "decode") else x for x in c]
|
||||||
|
return _popen(c, *a, **ka)
|
||||||
|
|
||||||
|
sp.Popen = _spopen
|
||||||
|
|
||||||
|
|
||||||
def uprint(msg: str) -> None:
|
def uprint(msg: str) -> None:
|
||||||
try:
|
try:
|
||||||
print(msg, end="")
|
print(msg, end="")
|
||||||
|
|
Loading…
Reference in a new issue