kopia lustrzana https://github.com/yt-dlp/yt-dlp
[utils] `write_xattr`: Use `os.setxattr` if available (#8205)
Closes #8193 Authored by: bashonly, Grub4K Co-authored-by: Simon Sawicki <contact@grub4k.xyz>pull/8042/merge
rodzic
4de94b9e16
commit
84e26038d4
|
@ -280,7 +280,7 @@ While all the other dependencies are optional, `ffmpeg` and `ffprobe` are highly
|
||||||
|
|
||||||
* [**mutagen**](https://github.com/quodlibet/mutagen)\* - For `--embed-thumbnail` in certain formats. Licensed under [GPLv2+](https://github.com/quodlibet/mutagen/blob/master/COPYING)
|
* [**mutagen**](https://github.com/quodlibet/mutagen)\* - For `--embed-thumbnail` in certain formats. Licensed under [GPLv2+](https://github.com/quodlibet/mutagen/blob/master/COPYING)
|
||||||
* [**AtomicParsley**](https://github.com/wez/atomicparsley) - For `--embed-thumbnail` in `mp4`/`m4a` files when `mutagen`/`ffmpeg` cannot. Licensed under [GPLv2+](https://github.com/wez/atomicparsley/blob/master/COPYING)
|
* [**AtomicParsley**](https://github.com/wez/atomicparsley) - For `--embed-thumbnail` in `mp4`/`m4a` files when `mutagen`/`ffmpeg` cannot. Licensed under [GPLv2+](https://github.com/wez/atomicparsley/blob/master/COPYING)
|
||||||
* [**xattr**](https://github.com/xattr/xattr), [**pyxattr**](https://github.com/iustin/pyxattr) or [**setfattr**](http://savannah.nongnu.org/projects/attr) - For writing xattr metadata (`--xattr`) on **Linux**. Licensed under [MIT](https://github.com/xattr/xattr/blob/master/LICENSE.txt), [LGPL2.1](https://github.com/iustin/pyxattr/blob/master/COPYING) and [GPLv2+](http://git.savannah.nongnu.org/cgit/attr.git/tree/doc/COPYING) respectively
|
* [**xattr**](https://github.com/xattr/xattr), [**pyxattr**](https://github.com/iustin/pyxattr) or [**setfattr**](http://savannah.nongnu.org/projects/attr) - For writing xattr metadata (`--xattr`) on **Mac** and **BSD**. Licensed under [MIT](https://github.com/xattr/xattr/blob/master/LICENSE.txt), [LGPL2.1](https://github.com/iustin/pyxattr/blob/master/COPYING) and [GPLv2+](http://git.savannah.nongnu.org/cgit/attr.git/tree/doc/COPYING) respectively
|
||||||
|
|
||||||
### Misc
|
### Misc
|
||||||
|
|
||||||
|
|
|
@ -4441,10 +4441,12 @@ def write_xattr(path, key, value):
|
||||||
raise XAttrMetadataError(e.errno, e.strerror)
|
raise XAttrMetadataError(e.errno, e.strerror)
|
||||||
return
|
return
|
||||||
|
|
||||||
# UNIX Method 1. Use xattrs/pyxattrs modules
|
# UNIX Method 1. Use os.setxattr/xattrs/pyxattrs modules
|
||||||
|
|
||||||
setxattr = None
|
setxattr = None
|
||||||
if getattr(xattr, '_yt_dlp__identifier', None) == 'pyxattr':
|
if callable(getattr(os, 'setxattr', None)):
|
||||||
|
setxattr = os.setxattr
|
||||||
|
elif getattr(xattr, '_yt_dlp__identifier', None) == 'pyxattr':
|
||||||
# Unicode arguments are not supported in pyxattr until version 0.5.0
|
# Unicode arguments are not supported in pyxattr until version 0.5.0
|
||||||
# See https://github.com/ytdl-org/youtube-dl/issues/5498
|
# See https://github.com/ytdl-org/youtube-dl/issues/5498
|
||||||
if version_tuple(xattr.__version__) >= (0, 5, 0):
|
if version_tuple(xattr.__version__) >= (0, 5, 0):
|
||||||
|
|
Ładowanie…
Reference in New Issue