Compare commits

..

No commits in common. "24093d52a768e624a3ecd9d834f3239f64e1bf2c" and "3df6a603e4753f08bc44cdbbb45832970466f436" have entirely different histories.

6 changed files with 52 additions and 48 deletions

View File

@ -6,10 +6,11 @@ import sys
from PyInstaller.__main__ import run as run_pyinstaller
OS_NAME, MACHINE, ARCH = sys.platform, platform.machine(), platform.architecture()[0][:2]
if MACHINE in ('x86_64', 'AMD64') or ('i' in MACHINE and '86' in MACHINE):
# NB: Windows x86 has MACHINE = AMD64 irrespective of bitness
MACHINE = 'x86' if ARCH == '32' else ''
OS_NAME, MACHINE = sys.platform, platform.machine()
if MACHINE in ('x86_64', 'amd64'):
MACHINE = ''
elif 'i' in MACHINE and '86' in MACHINE:
MACHINE = 'x86'
def main():
@ -33,6 +34,9 @@ def main():
'--icon=devscripts/logo.ico',
'--upx-exclude=vcruntime140.dll',
'--noconfirm',
# NB: Modules that are only imported dynamically must be added here.
# --collect-submodules may not work correctly if user has a yt-dlp installed via PIP
'--hidden-import=yt_dlp.compat._legacy',
*dependency_options(),
*opts,
'yt_dlp/__main__.py',
@ -47,6 +51,7 @@ def parse_options():
# Compatibility with older arguments
opts = sys.argv[1:]
if opts[0:1] in (['32'], ['64']):
ARCH = platform.architecture()[0][:2]
if ARCH != opts[0]:
raise Exception(f'{opts[0]}bit executable cannot be built on a {ARCH}bit system')
opts = opts[1:]

View File

@ -24,6 +24,7 @@ import urllib.request
from string import ascii_letters
from .cache import Cache
from .compat import HAS_LEGACY as compat_has_legacy
from .compat import compat_os_name, compat_shlex_quote
from .cookies import load_cookies
from .downloader import FFmpegFD, get_suitable_downloader, shorten_protocol_name
@ -588,8 +589,8 @@ class YoutubeDL:
current_version = sys.version_info[:2]
if current_version < MIN_RECOMMENDED:
msg = ('Support for Python version %d.%d has been deprecated. '
'See https://github.com/yt-dlp/yt-dlp/issues/3764 for more details.'
'\n You will no longer recieve updates on this version')
'See https://github.com/yt-dlp/yt-dlp/issues/3764 for more details. '
'You will recieve only one more update on this version')
if current_version < MIN_SUPPORTED:
msg = 'Python version %d.%d is no longer supported'
self.deprecation_warning(
@ -622,6 +623,8 @@ class YoutubeDL:
self.deprecation_warning(msg)
self.params['compat_opts'] = set(self.params.get('compat_opts', ()))
if not compat_has_legacy:
self.params['compat_opts'].add('no-compat-legacy')
if 'list-formats' in self.params['compat_opts']:
self.params['listformats_table'] = False

View File

@ -8,8 +8,14 @@ from ._deprecated import * # noqa: F401, F403
from .compat_utils import passthrough_module
# XXX: Implement this the same way as other DeprecationWarnings without circular import
passthrough_module(__name__, '._legacy', callback=lambda attr: warnings.warn(
try:
passthrough_module(__name__, '._legacy', callback=lambda attr: warnings.warn(
DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=2))
HAS_LEGACY = True
except ModuleNotFoundError:
# Keep working even without _legacy module
HAS_LEGACY = False
del passthrough_module
# HTMLParseError has been deprecated in Python 3.3 and removed in
@ -70,9 +76,3 @@ if compat_os_name in ('nt', 'ce'):
return userhome + path[i:]
else:
compat_expanduser = os.path.expanduser
# NB: Add modules that are imported dynamically here so that PyInstaller can find them
# See https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/438
if False:
from . import _legacy # noqa: F401

View File

@ -1,6 +1,9 @@
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import try_get
from ..utils import (
try_get,
urljoin,
)
class PhilharmonieDeParisIE(InfoExtractor):
@ -9,29 +12,27 @@ class PhilharmonieDeParisIE(InfoExtractor):
https?://
(?:
live\.philharmoniedeparis\.fr/(?:[Cc]oncert/|embed(?:app)?/|misc/Playlist\.ashx\?id=)|
pad\.philharmoniedeparis\.fr/(?:doc/CIMU/|player\.aspx\?id=)|
philharmoniedeparis\.fr/fr/live/concert/|
otoplayer\.philharmoniedeparis\.fr/fr/embed/
pad\.philharmoniedeparis\.fr/doc/CIMU/
)
(?P<id>\d+)
'''
_TESTS = [{
'url': 'https://philharmoniedeparis.fr/fr/live/concert/1129666-danses-symphoniques',
'md5': '24bdb7e86c200c107680e1f7770330ae',
'url': 'http://pad.philharmoniedeparis.fr/doc/CIMU/1086697/jazz-a-la-villette-knower',
'md5': 'a0a4b195f544645073631cbec166a2c2',
'info_dict': {
'id': '1129666',
'id': '1086697',
'ext': 'mp4',
'title': 'Danses symphoniques. Orchestre symphonique Divertimento - Zahia Ziouani. Bizet, de Falla, Stravinski, Moussorgski, Saint-Saëns',
'title': 'Jazz à la Villette : Knower',
},
}, {
'url': 'https://philharmoniedeparis.fr/fr/live/concert/1032066-akademie-fur-alte-musik-berlin-rias-kammerchor-rene-jacobs-passion-selon-saint-jean-de-johann',
'url': 'http://live.philharmoniedeparis.fr/concert/1032066.html',
'info_dict': {
'id': '1032066',
'title': 'Akademie für alte Musik Berlin, Rias Kammerchor, René Jacobs : Passion selon saint Jean de Johann Sebastian Bach',
'title': 'md5:0a031b81807b3593cffa3c9a87a167a0',
},
'playlist_mincount': 2,
}, {
'url': 'https://philharmoniedeparis.fr/fr/live/concert/1030324-orchestre-philharmonique-de-radio-france-myung-whun-chung-renaud-capucon-pascal-dusapin-johannes',
'url': 'http://live.philharmoniedeparis.fr/Concert/1030324.html',
'only_matching': True,
}, {
'url': 'http://live.philharmoniedeparis.fr/misc/Playlist.ashx?id=1030324&track=&lang=fr',
@ -40,15 +41,16 @@ class PhilharmonieDeParisIE(InfoExtractor):
'url': 'https://live.philharmoniedeparis.fr/embedapp/1098406/berlioz-fantastique-lelio-les-siecles-national-youth-choir-of.html?lang=fr-FR',
'only_matching': True,
}, {
'url': 'https://otoplayer.philharmoniedeparis.fr/fr/embed/1098406?lang=fr-FR',
'url': 'https://live.philharmoniedeparis.fr/embed/1098406/berlioz-fantastique-lelio-les-siecles-national-youth-choir-of.html?lang=fr-FR',
'only_matching': True,
}]
_LIVE_URL = 'https://live.philharmoniedeparis.fr'
def _real_extract(self, url):
video_id = self._match_id(url)
config = self._download_json(
'https://otoplayer.philharmoniedeparis.fr/fr/config/%s.json' % video_id, video_id, query={
'%s/otoPlayer/config.ashx' % self._LIVE_URL, video_id, query={
'id': video_id,
'lang': 'fr-FR',
})
@ -70,8 +72,9 @@ class PhilharmonieDeParisIE(InfoExtractor):
if not format_url or format_url in format_urls:
continue
format_urls.add(format_url)
m3u8_url = urljoin(self._LIVE_URL, format_url)
formats.extend(self._extract_m3u8_formats(
format_url, video_id, 'mp4', entry_protocol='m3u8_native',
m3u8_url, video_id, 'mp4', entry_protocol='m3u8_native',
m3u8_id='hls', fatal=False))
if not formats and not self.get_param('ignore_no_formats'):
return
@ -79,19 +82,21 @@ class PhilharmonieDeParisIE(InfoExtractor):
return {
'title': title,
'formats': formats,
'thumbnail': files.get('thumbnail'),
}
thumbnail = urljoin(self._LIVE_URL, config.get('image'))
info = extract_entry(config)
if info:
info.update({
'id': video_id,
'thumbnail': thumbnail,
})
return info
entries = []
for num, chapter in enumerate(config['chapters'], start=1):
entry = extract_entry(chapter)
if entry is None:
continue
entry['id'] = '%s-%d' % (video_id, num)
entries.append(entry)

View File

@ -116,6 +116,5 @@ class WSJArticleIE(InfoExtractor):
article_id = self._match_id(url)
webpage = self._download_webpage(url, article_id)
video_id = self._search_regex(
r'(?:id=["\']video|video-|iframe\.html\?guid=|data-src=["\'])([a-fA-F0-9-]{36})',
webpage, 'video id')
r'data-src=["\']([a-fA-F0-9-]{36})', webpage, 'video id')
return self.url_result('wsj:%s' % video_id, WSJIE.ie_key(), video_id)

View File

@ -88,7 +88,8 @@ class Updater:
@functools.cached_property
def _tag(self):
if version_tuple(__version__) >= version_tuple(self.latest_version):
latest = self._get_version_info('latest')['tag_name']
if version_tuple(__version__) >= version_tuple(latest):
return 'latest'
identifier = f'{detect_variant()} {system_identifier()}'
@ -112,15 +113,8 @@ class Updater:
@property
def new_version(self):
"""Version of the latest release we can update to"""
if self._tag.startswith('tags/'):
return self._tag[5:]
return self._get_version_info(self._tag)['tag_name']
@property
def latest_version(self):
"""Version of the latest release"""
return self._get_version_info('latest')['tag_name']
return self._get_version_info(self._tag)['tag_name']
@property
def has_update(self):
@ -167,15 +161,13 @@ class Updater:
"""Report whether there is an update available"""
try:
self.ydl.to_screen(
f'Latest version: {self.latest_version}, Current version: {self.current_version}')
if not self.has_update:
if self._tag == 'latest':
return self.ydl.to_screen(f'yt-dlp is up to date ({__version__})')
return self.ydl.report_warning(
'yt-dlp cannot be updated any further since you are on an older Python version')
f'Latest version: {self.new_version}, Current version: {self.current_version}')
except Exception:
return self._report_network_error('obtain version info', delim='; Please try again later or')
if not self.has_update:
return self.ydl.to_screen(f'yt-dlp is up to date ({__version__})')
if not is_non_updateable():
self.ydl.to_screen(f'Current Build Hash {_sha256_file(self.filename)}')
return True