]> jfr.im git - yt-dlp.git/commitdiff
Linter and misc cleanup
authorpukkandan <redacted>
Thu, 28 Jan 2021 19:32:37 +0000 (01:02 +0530)
committerpukkandan <redacted>
Thu, 28 Jan 2021 19:33:32 +0000 (01:03 +0530)
:ci skip dl

.github/workflows/build.yml
.gitignore
devscripts/update-version-workflow.py [moved from scripts/update-version-workflow.py with 82% similarity]
scripts/update-version.py [deleted file]
setup.cfg
setup.py
youtube_dlc/YoutubeDL.py
youtube_dlc/extractor/anvato.py
youtube_dlc/extractor/youtube.py
youtube_dlc/postprocessor/embedthumbnail.py
yt-dlp.sublime-project [moved from yt-dlc.sublime-project with 100% similarity]

index d070518169a849815495e600a849edd99d3c424a..ad175cf44ae2a4e8314a94ca0574b0ab400b3703 100644 (file)
@@ -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
index 189ada254bcb37a9be687a0b784d6acd29a2811a..60706f39e6432bf17317e1c365fa49ac0b442e74 100644 (file)
@@ -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,31 +54,28 @@ 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
+cookies
+cookies.txt
 
-# IntelliJ related files
-.idea
-*.iml
 
-tmp/
-venv/
 
-# VS Code related files
+# Text Editor / IDE
+.idea
+*.iml
 .vscode
-
-# SublimeText files
 *.sublime-workspace
+*.sublime-project
+!yt-dlp.sublime-project
 
-# Cookies
-cookies
-cookies.txt
+# Lazy extractors
+*/extractor/lazy_extractors.py
 
 # Plugins
 ytdlp_plugins/extractor/*
similarity index 82%
rename from scripts/update-version-workflow.py
rename to devscripts/update-version-workflow.py
index bb3d8c83e3ac94237ddffd16d476c7eda9fe0e32..4ac130a0d2c126c3653dc6068dc8c3b559b136f9 100644 (file)
@@ -1,8 +1,11 @@
 from __future__ import unicode_literals
 from datetime import datetime
+# import urllib.request
 
-exec(compile(open('youtube_dlc/version.py').read(), 'youtube_dlc/version.py', 'exec'))
+# 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 (file)
index e1eb53f..0000000
+++ /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)]))
index ffc0fd2fd2b9570beb67d23220b69b7760359f9e..e1f03714e8720fdca47bb17673a72bb18cc28eed 100644 (file)
--- 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
index 6820a88b80f6a9df49c27df4bcea1ea8aad893b4..7cc2bff4837742e49a548b0fc5aee64960e2ddb2 100644 (file)
--- a/setup.py
+++ b/setup.py
     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 @@ def run(self):
             dry_run=self.dry_run,
         )
 
+
+packages = find_packages(exclude=("youtube_dl","test",))
+
 setup(
     name="yt-dlp",
     version=__version__,
@@ -71,7 +72,7 @@ def run(self):
     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',
index 20a4af7511f8ced760056790d31723a622e6ff97..e88299f19f815897c8ff255bbb3bfab96a71c6ef 100644 (file)
@@ -1119,15 +1119,15 @@ def ensure_dir_exists(path):
             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 @@ def dl(name, info, subtitle=False):
             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
 
index 9b38676059098a81efb86d8ed5a422d5c1bca0e0..ab69b69bd553607e5055a203d78e73b40a9b37ce 100644 (file)
@@ -31,6 +31,7 @@
 except ImportError:
     NFLTokenGenerator = None
 
+
 def md5_text(s):
     if not isinstance(s, compat_str):
         s = compat_str(s)
index f9e60f03ef42b430b78f4d9eb70e968900690939..7c32d32000e9b2644a9cb891a03059b138f6b6af 100644 (file)
@@ -2492,8 +2492,8 @@ def search_dict(partial, key):
 
             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
index 2bce72bea3d341c794d10deecf81f7e7d40679a3..b9205a5ca404b26e1dc28e5196175b650d2b0413 100644 (file)
@@ -153,7 +153,7 @@ def is_webp(path):
 
         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<w>\d+)x(?P<h>\d+)\s*[,\[]'
             size_result = self.run_ffmpeg(thumbnail_filename, thumbnail_filename, ['-hide_banner'])
             mobj = re.search(size_regex, size_result)