diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d070518169..ad175cf44a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,8 +25,8 @@ jobs: run: sudo apt-get -y install zip pandoc man - name: Bump version id: bump_version - run: python scripts/update-version-workflow.py - - name: Check the output from My action + run: python devscripts/update-version-workflow.py + - name: Check the version run: echo "${{ steps.bump_version.outputs.ytdlc_version }}" - name: Run Make run: make @@ -86,7 +86,7 @@ jobs: - name: Install Requirements run: pip install pyinstaller - name: Bump version - run: python scripts/update-version-workflow.py + run: python devscripts/update-version-workflow.py - name: Run PyInstaller Script run: python pyinst.py - name: Upload youtube-dlc.exe Windows binary @@ -121,7 +121,7 @@ jobs: - name: Install Requirements for 32 Bit run: pip install pyinstaller==3.5 - name: Bump version - run: python scripts/update-version-workflow.py + run: python devscripts/update-version-workflow.py - name: Run PyInstaller Script for 32 Bit run: python pyinst32.py - name: Upload Executable youtube-dlc_x86.exe diff --git a/.gitignore b/.gitignore index 189ada254b..60706f39e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,35 +1,43 @@ +# Python *.pyc *.pyo -*.class -*~ -*.DS_Store wine-py2exe/ py2exe.log -*.kate-swp build/ dist/ zip/ +tmp/ +venv/ + +# Misc +*~ +*.DS_Store +*.kate-swp MANIFEST -README.txt -youtube-dl.1 -youtube-dlc.1 -youtube-dl.bash-completion -youtube-dlc.bash-completion -youtube-dl.fish -youtube-dlc.fish -youtube_dl/extractor/lazy_extractors.py -youtube_dlc/extractor/lazy_extractors.py -youtube-dl -youtube-dlc -youtube-dl.exe -youtube-dlc.exe -youtube-dl.tar.gz -youtube-dlc.tar.gz -youtube-dlc.spec +test/local_parameters.json .coverage cover/ updates_key.pem *.egg-info +.tox +*.class + +# Generated +README.txt +*.1 +*.bash-completion +*.fish +*.exe +*.tar.gz +*.zsh +*.spec + +# Binary +youtube-dl +youtube-dlc +*.exe + +# Downloaded *.srt *.ttml *.sbv @@ -46,32 +54,29 @@ updates_key.pem *.swf *.part *.ytdl -*.conf *.swp +*.ogg +*.opus + +# Config +*.conf *.spec -*.exe -test/local_parameters.json -.tox -youtube-dl.zsh -youtube-dlc.zsh - -# IntelliJ related files -.idea -*.iml - -tmp/ -venv/ - -# VS Code related files -.vscode - -# SublimeText files -*.sublime-workspace - -# Cookies cookies cookies.txt + + +# Text Editor / IDE +.idea +*.iml +.vscode +*.sublime-workspace +*.sublime-project +!yt-dlp.sublime-project + +# Lazy extractors +*/extractor/lazy_extractors.py + # Plugins ytdlp_plugins/extractor/* !ytdlp_plugins/extractor/__init__.py diff --git a/scripts/update-version-workflow.py b/devscripts/update-version-workflow.py similarity index 82% rename from scripts/update-version-workflow.py rename to devscripts/update-version-workflow.py index bb3d8c83e3..4ac130a0d2 100644 --- a/scripts/update-version-workflow.py +++ b/devscripts/update-version-workflow.py @@ -1,8 +1,11 @@ from __future__ import unicode_literals from datetime import datetime +# import urllib.request + +# response = urllib.request.urlopen('https://blackjack4494.github.io/youtube-dlc/update/LATEST_VERSION') +# _LATEST_VERSION = response.read().decode('utf-8') exec(compile(open('youtube_dlc/version.py').read(), 'youtube_dlc/version.py', 'exec')) - _LATEST_VERSION = locals()['__version__'] _OLD_VERSION = _LATEST_VERSION.replace('-', '.').split(".", 4) diff --git a/scripts/update-version.py b/scripts/update-version.py deleted file mode 100644 index e1eb53f382..0000000000 --- a/scripts/update-version.py +++ /dev/null @@ -1,33 +0,0 @@ -# Unused - -from __future__ import unicode_literals -from datetime import datetime -import urllib.request - -response = urllib.request.urlopen('https://blackjack4494.github.io/youtube-dlc/update/LATEST_VERSION') - -_LATEST_VERSION = response.read().decode('utf-8') - -_OLD_VERSION = _LATEST_VERSION.rsplit("-", 1) - -if len(_OLD_VERSION) > 0: - old_ver = _OLD_VERSION[0] - -old_rev = '' -if len(_OLD_VERSION) > 1: - old_rev = _OLD_VERSION[1] - -now = datetime.now() -# ver = f'{datetime.today():%Y.%m.%d}' -ver = now.strftime("%Y.%m.%d") -rev = '' - -if old_ver == ver: - if old_rev: - rev = int(old_rev) + 1 - else: - rev = 1 - -_SEPARATOR = '-' - -version = _SEPARATOR.join(filter(None, [ver, str(rev)])) diff --git a/setup.cfg b/setup.cfg index ffc0fd2fd2..e1f03714e8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,5 +2,5 @@ universal = True [flake8] -exclude = youtube_dlc/extractor/__init__.py,devscripts/buildserver.py,devscripts/lazy_load_template.py,devscripts/make_issue_template.py,setup.py,build,.git,venv,devscripts/create-github-release.py,devscripts/release.sh,devscripts/show-downloads-statistics.py,scripts/update-version.py +exclude = youtube_dlc/extractor/__init__.py,devscripts/buildserver.py,devscripts/lazy_load_template.py,devscripts/make_issue_template.py,setup.py,build,.git,venv,devscripts/create-github-release.py,devscripts/release.sh,devscripts/show-downloads-statistics.py ignore = E402,E501,E731,E741,W503 \ No newline at end of file diff --git a/setup.py b/setup.py index 6820a88b80..7cc2bff483 100644 --- a/setup.py +++ b/setup.py @@ -41,10 +41,8 @@ else: params = { 'data_files': data_files, } - #if setuptools_available: params['entry_points'] = {'console_scripts': ['youtube-dlc = youtube_dlc:main']} - #else: - # params['scripts'] = ['bin/youtube-dlc'] + class build_lazy_extractors(Command): description = 'Build the extractor lazy loading module' @@ -62,6 +60,9 @@ class build_lazy_extractors(Command): dry_run=self.dry_run, ) + +packages = find_packages(exclude=("youtube_dl","test",)) + setup( name="yt-dlp", version=__version__, @@ -71,7 +72,7 @@ setup( long_description=LONG_DESCRIPTION, long_description_content_type="text/markdown", url="https://github.com/pukkandan/yt-dlp", - packages=find_packages(exclude=("youtube_dl","test",)), + packages=packages, project_urls={ 'Documentation': 'https://github.com/pukkandan/yt-dlp#yt-dlp', 'Source': 'https://github.com/pukkandan/yt-dlp', diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.py index 20a4af7511..e88299f19f 100644 --- a/youtube_dlc/YoutubeDL.py +++ b/youtube_dlc/YoutubeDL.py @@ -1119,15 +1119,15 @@ class YoutubeDL(object): if not ensure_dir_exists(encodeFilename(infofn)): return if self.params.get('overwrites', True) and os.path.exists(encodeFilename(infofn)): - self.to_screen('[info] Playlist description metadata is already present') + self.to_screen('[info] Playlist metadata is already present') else: - self.to_screen('[info] Writing description playlist metadata as JSON to: ' + infofn) + self.to_screen('[info] Writing playlist metadata as JSON to: ' + infofn) playlist_info = dict(ie_result) playlist_info.pop('entries') try: write_json_file(self.filter_requested_info(playlist_info), infofn) except (OSError, IOError): - self.report_error('Cannot write playlist description metadata to JSON file ' + infofn) + self.report_error('Cannot write playlist metadata to JSON file ' + infofn) if self.params.get('writedescription', False): descfn = replace_extension( @@ -2144,13 +2144,13 @@ class YoutubeDL(object): if not ensure_dir_exists(encodeFilename(infofn)): return if not self.params.get('overwrites', True) and os.path.exists(encodeFilename(infofn)): - self.to_screen('[info] Video description metadata is already present') + self.to_screen('[info] Video metadata is already present') else: - self.to_screen('[info] Writing video description metadata as JSON to: ' + infofn) + self.to_screen('[info] Writing video metadata as JSON to: ' + infofn) try: write_json_file(self.filter_requested_info(info_dict), infofn) except (OSError, IOError): - self.report_error('Cannot write metadata to JSON file ' + infofn) + self.report_error('Cannot write video metadata to JSON file ' + infofn) return info_dict['__infojson_filepath'] = infofn diff --git a/youtube_dlc/extractor/anvato.py b/youtube_dlc/extractor/anvato.py index 9b38676059..ab69b69bd5 100644 --- a/youtube_dlc/extractor/anvato.py +++ b/youtube_dlc/extractor/anvato.py @@ -31,6 +31,7 @@ try: except ImportError: NFLTokenGenerator = None + def md5_text(s): if not isinstance(s, compat_str): s = compat_str(s) diff --git a/youtube_dlc/extractor/youtube.py b/youtube_dlc/extractor/youtube.py index f9e60f03ef..7c32d32000 100644 --- a/youtube_dlc/extractor/youtube.py +++ b/youtube_dlc/extractor/youtube.py @@ -2492,8 +2492,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor): def get_continuation(continuation, session_token, replies=False): query = { - 'pbj': 1, - 'ctoken': continuation, + 'pbj': 1, + 'ctoken': continuation, } if replies: query['action_get_comment_replies'] = 1 diff --git a/youtube_dlc/postprocessor/embedthumbnail.py b/youtube_dlc/postprocessor/embedthumbnail.py index 2bce72bea3..b9205a5ca4 100644 --- a/youtube_dlc/postprocessor/embedthumbnail.py +++ b/youtube_dlc/postprocessor/embedthumbnail.py @@ -153,7 +153,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor): elif info['ext'] in ['ogg', 'opus']: if not _has_mutagen: - raise EmbedThumbnailPPError('module mutagen was not found. Please install.') + raise EmbedThumbnailPPError('module mutagen was not found. Please install') size_regex = r',\s*(?P\d+)x(?P\d+)\s*[,\[]' size_result = self.run_ffmpeg(thumbnail_filename, thumbnail_filename, ['-hide_banner']) mobj = re.search(size_regex, size_result) diff --git a/yt-dlc.sublime-project b/yt-dlp.sublime-project similarity index 100% rename from yt-dlc.sublime-project rename to yt-dlp.sublime-project