From 974c4b47bb856d9eac4c5bcf1d8f32b005fc1643 Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Tue, 2 Jul 2024 14:16:42 +0100 Subject: [PATCH 01/19] Updated README for Fork. --- CONTRIBUTING.md | 10 +++++++--- DEVELOPMENT.md | 13 +++++++++---- README.md | 22 +++++++++++----------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 09cdba4..d49dffc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,14 +1,18 @@ ## Contributing -When contributing to this repository, first discuss the change you wish to make via issue or email with the owner(s) of this repository. By contributing to the project you agree to publish your changes under the [MIT License](/LICENSE). +When contributing to this repository, first discuss the change you wish to make +via issue or email with the owner(s) of this repository. By contributing to the +project you agree to publish your changes under the [MIT License](/LICENSE). ## Pull Request Process -Unless there's an obvious error in the repository please first create an issue and only then create a pull request. +Unless there's an obvious error in the repository please first create an issue +and only then create a pull request. Also read [DEVELOPMENT.md](/DEVELOPMENT.md) before creating a pull request. ## Code of Conduct -Try your best to use welcoming and inclusive language and be respectful. That's it. Don't want a big Code of Conducts for this small project. +Try your best to use welcoming and inclusive language and be respectful. That's +it. Don't want a big Code of Conducts for this small project. diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 46767b0..df592a2 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -2,12 +2,14 @@ ### Code formatting -We use the [black](https://github.com/psf/black) code formatter. Always format the code with black before +We use the [black](https://github.com/psf/black) code formatter. Always format +the code with black before submitting a pull request. ### Testing -Before submitting a pull request, make sure the code passes all the tests and is formatted by black: +Before submitting a pull request, make sure the code passes all the tests and is +formatted by black: ```bash # Inside the project root (directory containing this file) @@ -18,11 +20,14 @@ mypy pytest black . ``` -This should create a virtual environment and install project's all dependencies including the ones required for running the tests, run the tests and finally format the code with black. +This should create a virtual environment and install project's all dependencies +including the ones required for running the tests, run the tests and finally +format the code with black. ### Packaging (uploading to PyPI) -In the project root run the following command inside the virtual environment created for testing. +In the project root run the following command inside the virtual environment +created for testing. ```bash pip install setuptools wheel twine diff --git a/README.md b/README.md index 3039dd0..263ce5b 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@
-
+

The Python package for near duplicate video detection

-Build Status -Build Status -Build Status +Build Status +Build Status +Build Status codecov Total alerts Language grade: Python pypi Downloads -GitHub lastest commit +GitHub lastest commit PyPI - Python Version

@@ -66,10 +66,10 @@ Maintainer is [@step21](https://github.com/step21) conda install -c conda-forge videohash ``` -**Install directly from [the](https://github.com/akamhy/videohash) GitHub repository (NOT recommended)**: +**Install directly from [the](https://github.com/demmenie/videohash) GitHub repository (NOT recommended)**: ```bash -pip install git+https://github.com/akamhy/videohash.git +pip install git+https://github.com/demmenie/videohash.git ``` -------------------------------------------------------------------------- @@ -117,7 +117,7 @@ True 34 >>> videohash3-videohash2 34 ->>> path4 = "/home/akamhy/Downloads/168872267-7c6682f8-7294-4d9a-8a68-8c6f44c06df6.mp4" +>>> path4 = "/home/demmenie/Downloads/168872267-7c6682f8-7294-4d9a-8a68-8c6f44c06df6.mp4" >>> videohash4 = VideoHash(path=path4) >>> videohash4 == videohash1 True @@ -152,12 +152,12 @@ False ### License -[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/akamhy/videohash/blob/main/LICENSE) +[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/demmenie/videohash/blob/main/LICENSE) Copyright (c) 2021-2022 Akash Mahanty. See -[license](https://github.com/akamhy/videohash/blob/main/LICENSE) for details. +[license](https://github.com/demmenie/videohash/blob/main/LICENSE) for details. -The VideoHash logo was created by [iconolocode](https://github.com/iconolocode). See [license](https://github.com/akamhy/videohash/blob/main/assets/logo/LICENSE-LOGO) for details. +The VideoHash logo was created by [iconolocode](https://github.com/iconolocode). See [license](https://github.com/demmenie/videohash/blob/main/assets/logo/LICENSE-LOGO) for details. Videos are from NASA and are in the public domain. > NASA copyright policy states that "NASA material is not protected by copyright unless noted". From e2c94c4e85a591d1aa25a1a29c0430606f417595 Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 14:28:34 +0100 Subject: [PATCH 02/19] Updated documentation to be current. --- LICENSE | 2 +- README.md | 46 ++++++++++++++++++---------------------------- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/LICENSE b/LICENSE index ae87e1f..e7ff510 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021-2022 Akash Mahanty +Copyright (c) 2024 Akash Mahanty Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 263ce5b..2332b87 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,24 @@
-
+

The Python package for near duplicate video detection

-Build Status -Build Status -Build Status -codecov -Total alerts -Language grade: Python -pypi -Downloads -GitHub lastest commit -PyPI - Python Version +Build Status +Build Status +Build Status +pypi +Downloads +GitHub lastest commit +PyPI - Python Version

-------------------------------------------------------------------------- # Introduction -Videohash is a [Python package](https://www.udacity.com/blog/2021/01/what-is-a-python-package.html) for **detecting near-duplicate videos (Perceptual Video Hashing)**. +Videohash2 is a [Python package](https://www.udacity.com/blog/2021/01/what-is-a-python-package.html) for **detecting near-duplicate videos (Perceptual Video Hashing)**. It can take any input video and generate a 64-bit equivalent hash value. Videohash is way more faster than comparing the imagehash values of individual [frames](https://en.wikipedia.org/wiki/Film_frame) of the video and more reliable than hashing [keyframes](https://en.wikipedia.org/wiki/Key_frame). The video-hash-values for identical or near-duplicate videos are the same or similar, implying that if the video is resized (upscaled/downscaled), [transcoded](https://medium.com/videocoin/what-is-video-transcoding-and-why-do-you-do-it-348a2610cefc), [watermark](https://en.wikipedia.org/wiki/Digital_watermarking) added/removed, [stabilized](https://link.springer.com/referenceworkentry/10.1007%2F978-0-387-78414-4_76), [color changed](https://en.wikipedia.org/wiki/Chrominance), [frame rate](https://www.techsmith.com/blog/frame-rate-beginners-guide/) changed, changed [aspect ratio](https://en.wikipedia.org/wiki/Aspect_ratio_(image)), [cropped](https://www.avs4you.com/blog/trim-cut-crop-avs4you/), [black-bars](https://en.wikipedia.org/wiki/Letterboxing_(filming)) added or removed, the hash-value should remain unchanged or not vary substantially. @@ -55,21 +52,13 @@ If you do not want to upgrade pip and the installation fails try appending `--pr **Install from the [PyPi](https://pypi.org/) (recommended)**: ```bash -pip install videohash +pip install videohash2 ``` -**Using [conda](https://en.wikipedia.org/wiki/Conda_(package_manager)), from [conda-forge](https://anaconda.org/conda-forge/videohash) (recommended)**: - -Maintainer is [@step21](https://github.com/step21) - -```bash -conda install -c conda-forge videohash -``` - -**Install directly from [the](https://github.com/demmenie/videohash) GitHub repository (NOT recommended)**: +**Install directly from [the](https://github.com/demmenie/videohash2) GitHub repository (NOT recommended)**: ```bash -pip install git+https://github.com/demmenie/videohash.git +pip install git+https://github.com/demmenie/videohash2.git ``` -------------------------------------------------------------------------- @@ -96,7 +85,7 @@ In the following usage example the first two and the fourth instance of VideoHas - videohash4 video is a local copy of url1, . ```python ->>> from videohash import VideoHash +>>> from videohash2 import VideoHash >>> url1 = "https://user-images.githubusercontent.com/64683866/168872267-7c6682f8-7294-4d9a-8a68-8c6f44c06df6.mp4" >>> videohash1 = VideoHash(url=url1) >>> @@ -147,17 +136,18 @@ False - [Sam Dobson](https://github.com/samdobson) for [image_slicer](https://github.com/samdobson/image_slicer), videohash incorporates some code from image_slicer. - [Eddievin](https://github.com/Eddievin) for README design. - [iconolocode](https://github.com/iconolocode) for the videohash logo. + - [Demmenie](https://github.com/demmenie) for forking and maintaining videohash2. -------------------------------------------------------------------------- ### License -[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/demmenie/videohash/blob/main/LICENSE) +[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/demmenie/videohash2/blob/main/LICENSE) Copyright (c) 2021-2022 Akash Mahanty. See -[license](https://github.com/demmenie/videohash/blob/main/LICENSE) for details. +[license](https://github.com/demmenie/videohash2/blob/main/LICENSE) for details. -The VideoHash logo was created by [iconolocode](https://github.com/iconolocode). See [license](https://github.com/demmenie/videohash/blob/main/assets/logo/LICENSE-LOGO) for details. +The VideoHash logo was created by [iconolocode](https://github.com/iconolocode). See [license](https://github.com/demmenie/videohash2/blob/main/assets/logo/LICENSE-LOGO) for details. Videos are from NASA and are in the public domain. -> NASA copyright policy states that "NASA material is not protected by copyright unless noted". +> NASA copyright policy states that "NASA material is not protected by copyright unless noted". \ No newline at end of file From 1e0ec7d805b617cac97814233c00577c295c19b6 Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 14:29:05 +0100 Subject: [PATCH 03/19] Update requirements to the new imagedominantcolour. --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b365440..4274671 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ ImageHash Pillow -imagedominantcolor +imagedominantcolour yt-dlp From 1457a5df3652656dc1c1a159d9fb01ea31c991d9 Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 14:30:42 +0100 Subject: [PATCH 04/19] Update mypy and videohash.py to include imagedominantcolour. --- mypy.ini | 2 +- videohash/videohash.py | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/mypy.ini b/mypy.ini index cc0dad0..1f5544c 100644 --- a/mypy.ini +++ b/mypy.ini @@ -9,7 +9,7 @@ ignore_missing_imports = True [mypy-imagehash.*] ignore_missing_imports = True -[mypy-imagedominantcolor.*] +[mypy-imagedominantcolour.*] ignore_missing_imports = True [mypy-image_slicer.*] diff --git a/videohash/videohash.py b/videohash/videohash.py index 5b458bf..2f3f239 100644 --- a/videohash/videohash.py +++ b/videohash/videohash.py @@ -8,7 +8,7 @@ import imagehash import numpy as np -from imagedominantcolor import DominantColor +from imagedominantcolour import DominantColour from PIL import Image from .collagemaker import MakeCollage @@ -25,7 +25,6 @@ class VideoHash: - """ VideoHash class provides an interface for computing & comparing the video hash values for videos(codec, containers etc) supported by FFmpeg. @@ -569,15 +568,15 @@ def _calc_hash(self) -> None: self.whash_bitlist: List = [] - self.dominant_color_bitlist: List = [] + self.dominant_colour_bitlist: List = [] for row in imagehash.whash(self.image).hash.astype(int).tolist(): self.whash_bitlist.extend(row) - dominant_color_list = [] + dominant_colour_list = [] for file_path in get_list_of_all_files_in_dir(self.tiles_dir): - dominantcolor = DominantColor(file_path) - dominant_color_list.append(dominantcolor.dominant_color) + dominantcolour = DominantColour(file_path) + dominant_colour_list.append(dominantcolour.dominant_colour) pixels = [ "r", @@ -648,13 +647,13 @@ def _calc_hash(self) -> None: for i in range(64): bit = 0 - if pixels[i] == dominant_color_list[i]: + if pixels[i] == dominant_colour_list[i]: bit = 1 - self.dominant_color_bitlist.append(bit) + self.dominant_colour_bitlist.append(bit) for i in range(64): - x = self.dominant_color_bitlist[i] + x = self.dominant_colour_bitlist[i] y = self.whash_bitlist[i] if x == y and x == 1: From 1b0d8d61f0740001cdc3ececf6f574ea49c927da Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 14:31:46 +0100 Subject: [PATCH 05/19] Changed Image.ANTIALIAS to Resampling.LANCZOS for Pillow update. --- videohash/collagemaker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/videohash/collagemaker.py b/videohash/collagemaker.py index 51c0674..30ea7bf 100644 --- a/videohash/collagemaker.py +++ b/videohash/collagemaker.py @@ -12,7 +12,6 @@ class MakeCollage: - """ Class that creates the collage from list of images. @@ -180,7 +179,8 @@ def make(self) -> None: # scale the opened frame images frame.thumbnail( - (scaled_frame_image_width, scaled_frame_image_height), Image.ANTIALIAS + (scaled_frame_image_width, scaled_frame_image_height), + Image.Resampling.LANCZOS, ) # set the value of x to that of i's value. From a92aba49af098e30a5e3f60e0dc9010bda819f90 Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 14:32:09 +0100 Subject: [PATCH 06/19] black spacing/formatting changes. --- videohash/downloader.py | 1 - videohash/exceptions.py | 10 ---------- videohash/framesextractor.py | 1 - 3 files changed, 12 deletions(-) diff --git a/videohash/downloader.py b/videohash/downloader.py index d2d67c6..79f9922 100644 --- a/videohash/downloader.py +++ b/videohash/downloader.py @@ -9,7 +9,6 @@ class Download: - """ Class that downloads the video prior to frames extraction. diff --git a/videohash/exceptions.py b/videohash/exceptions.py index 6a026c0..33eda7e 100644 --- a/videohash/exceptions.py +++ b/videohash/exceptions.py @@ -6,14 +6,12 @@ class VideoHashError(Exception): - """Base Exception for the videohash package.""" pass class StoragePathDoesNotExist(VideoHashError): - """ The storage path passed by the user does not exist. The collage is the image representing your video as an two dimensional bitmap image. @@ -23,56 +21,48 @@ class StoragePathDoesNotExist(VideoHashError): class FramesExtractorOutPutDirDoesNotExist(VideoHashError): - """The frames output directory passed to the frame extractor does not exist.""" pass class DownloadOutPutDirDoesNotExist(VideoHashError): - """The output directory passed to downloader for storing the downloaded video does not exist.""" pass class DidNotSupplyPathOrUrl(VideoHashError): - """Must supply either a path for the video or a valid URL""" pass class CollageOfZeroFramesError(VideoHashError): - """Raised if zero frames are passed for collage making.""" pass class DownloadFailed(VideoHashError): - """Download software failed to download the video from the url.""" pass class FFmpegError(VideoHashError): - """Base error for the FFmpeg software.""" pass class FFmpegNotFound(FFmpegError): - """FFmpeg is either not installed or not in the executable path of the system.""" pass class FFmpegFailedToExtractFrames(FFmpegError): - """FFmpeg failed to extract any frame at all. Maybe the input video is damaged or corrupt.""" pass diff --git a/videohash/framesextractor.py b/videohash/framesextractor.py index 9c6e81f..e8e29c2 100644 --- a/videohash/framesextractor.py +++ b/videohash/framesextractor.py @@ -18,7 +18,6 @@ class FramesExtractor: - """ Extract frames from the input video file and save at the output directory(frame storage directory). """ From fcd52e407d40f00583bf72439ad29c4904cb444a Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 14:51:44 +0100 Subject: [PATCH 07/19] Changed name to videohash2 --- videohash/__version__.py | 14 -------------- {videohash => videohash2}/__init__.py | 4 ++-- videohash2/__version__.py | 14 ++++++++++++++ {videohash => videohash2}/collagemaker.py | 0 {videohash => videohash2}/downloader.py | 0 {videohash => videohash2}/exceptions.py | 0 {videohash => videohash2}/framesextractor.py | 0 {videohash => videohash2}/tilemaker.py | 0 {videohash => videohash2}/utils.py | 0 {videohash => videohash2}/videoduration.py | 0 {videohash => videohash2}/videohash.py | 0 11 files changed, 16 insertions(+), 16 deletions(-) delete mode 100644 videohash/__version__.py rename {videohash => videohash2}/__init__.py (97%) create mode 100644 videohash2/__version__.py rename {videohash => videohash2}/collagemaker.py (100%) rename {videohash => videohash2}/downloader.py (100%) rename {videohash => videohash2}/exceptions.py (100%) rename {videohash => videohash2}/framesextractor.py (100%) rename {videohash => videohash2}/tilemaker.py (100%) rename {videohash => videohash2}/utils.py (100%) rename {videohash => videohash2}/videoduration.py (100%) rename {videohash => videohash2}/videohash.py (100%) diff --git a/videohash/__version__.py b/videohash/__version__.py deleted file mode 100644 index 8f63119..0000000 --- a/videohash/__version__.py +++ /dev/null @@ -1,14 +0,0 @@ -__title__ = "videohash" -__description__ = ( - "Python package for Near Duplicate Video Detection " - + "(Perceptual Video Hashing) - Get a 64-bit comparable " - + "hash-value for any video." -) - -__url__ = "https://akamhy.github.io/videohash/" -__version__ = "3.0.1" -__status__ = "production" -__author__ = "Akash Mahanty" -__author_email__ = "akamhy@yahoo.com" -__license__ = "MIT" -__copyright__ = "Copyright 2021-2022 Akash Mahanty" diff --git a/videohash/__init__.py b/videohash2/__init__.py similarity index 97% rename from videohash/__init__.py rename to videohash2/__init__.py index 0a289a5..17fa587 100644 --- a/videohash/__init__.py +++ b/videohash2/__init__.py @@ -13,7 +13,7 @@ Usage: ->>> from videohash import VideoHash +>>> from videohash2 import VideoHash >>> # video: Artemis I Hot Fire Test >>> videohash1 = VideoHash(url="https://www.youtube.com/watch?v=PapBjpzRhnA", download_worst=False) >>> @@ -67,7 +67,7 @@ :copyright: (c) 2021 Akash Mahanty :license: MIT, see LICENSE for more details. -:pypi: https://pypi.org/project/videohash/ +:pypi: https://pypi.org/project/videohash2/ :wiki: https://github.com/akamhy/videohash/wiki :cite: https://doi.org/10.5281/zenodo.4448295 """ diff --git a/videohash2/__version__.py b/videohash2/__version__.py new file mode 100644 index 0000000..cd8ba47 --- /dev/null +++ b/videohash2/__version__.py @@ -0,0 +1,14 @@ +__title__ = "videohash2" +__description__ = ( + "Python package for Near Duplicate Video Detection " + + "(Perceptual Video Hashing) - Get a 64-bit comparable " + + "hash-value for any video." +) + +__url__ = "https://demmenie.github.io/videohash2/" +__version__ = "3.0.2" +__status__ = "production" +__author__ = "Akash Mahanty and Chico Demmenie" +__author_email__ = "cdemmenie@gmail.com" +__license__ = "MIT" +__copyright__ = "Copyright 2024 Akash Mahanty" diff --git a/videohash/collagemaker.py b/videohash2/collagemaker.py similarity index 100% rename from videohash/collagemaker.py rename to videohash2/collagemaker.py diff --git a/videohash/downloader.py b/videohash2/downloader.py similarity index 100% rename from videohash/downloader.py rename to videohash2/downloader.py diff --git a/videohash/exceptions.py b/videohash2/exceptions.py similarity index 100% rename from videohash/exceptions.py rename to videohash2/exceptions.py diff --git a/videohash/framesextractor.py b/videohash2/framesextractor.py similarity index 100% rename from videohash/framesextractor.py rename to videohash2/framesextractor.py diff --git a/videohash/tilemaker.py b/videohash2/tilemaker.py similarity index 100% rename from videohash/tilemaker.py rename to videohash2/tilemaker.py diff --git a/videohash/utils.py b/videohash2/utils.py similarity index 100% rename from videohash/utils.py rename to videohash2/utils.py diff --git a/videohash/videoduration.py b/videohash2/videoduration.py similarity index 100% rename from videohash/videoduration.py rename to videohash2/videoduration.py diff --git a/videohash/videohash.py b/videohash2/videohash.py similarity index 100% rename from videohash/videohash.py rename to videohash2/videohash.py From 2596cc2a6eb180b5da354d94a8ae14c48482628b Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 14:52:19 +0100 Subject: [PATCH 08/19] Changes to setup, mypy and pytest to accomodate name change. --- mypy.ini | 2 +- pytest.ini | 2 +- setup.py | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mypy.ini b/mypy.ini index 1f5544c..62845ee 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,7 +1,7 @@ [mypy] files = - videohash + videohash2 [mypy-numpy.*] ignore_missing_imports = True diff --git a/pytest.ini b/pytest.ini index 6f2b13e..daefc2b 100644 --- a/pytest.ini +++ b/pytest.ini @@ -5,7 +5,7 @@ addopts = # enable all warnings -Wd # coverage and html report - --cov=videohash + --cov=videohash2 --cov-report=html testpaths = tests diff --git a/setup.py b/setup.py index cc9618b..d017c02 100644 --- a/setup.py +++ b/setup.py @@ -6,16 +6,16 @@ long_description = f.read() about = {} -with open(os.path.join(os.path.dirname(__file__), "videohash", "__version__.py")) as f: +with open(os.path.join(os.path.dirname(__file__), "videohash2", "__version__.py")) as f: exec(f.read(), about) version = str(about["__version__"]) -download_url = f"https://github.com/akamhy/videohash/archive/{version}.tar.gz" +download_url = f"https://github.com/demmenie/videohash2/archive/{version}.tar.gz" setup( name=about["__title__"], - packages=["videohash"], + packages=["videohash2"], version=version, description=about["__description__"], long_description=long_description, @@ -26,7 +26,7 @@ url=about["__url__"], download_url=download_url, keywords=[ - "videohash", + "videohash2", "near duplicate video detection", "NDVD", "perceptual video hashing", @@ -39,7 +39,7 @@ install_requires=[ "Pillow", "ImageHash", - "imagedominantcolor", + "imagedominantcolour", "yt-dlp", ], python_requires=">=3.6", @@ -61,16 +61,16 @@ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: Implementation :: CPython", ], project_urls={ - "Source": "https://github.com/akamhy/videohash", + "Source": "https://github.com/demmenie/videohash2", "Documentation": "https://github.com/akamhy/videohash/wiki", - "Tracker": "https://github.com/akamhy/videohash/issues", + "Tracker": "https://github.com/demmenie/videohash2/issues", }, ) From cf3fb9bd0e7c8e08cfb3810e0a05aef0ecec34bb Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 15:00:37 +0100 Subject: [PATCH 09/19] Added Python 3.11 to tests. --- .github/workflows/ci_linux.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 96ecfe2..7475a4a 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} @@ -42,6 +42,4 @@ jobs: - name: Test with pytest run: | pytest - - name: Upload coverage to Codecov - run: | - bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }} + - name: Upload coverage to Codecovs From 20ddacbfe64ae0d9d58b4a67bcde2a8f6894a76b Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 15:05:17 +0100 Subject: [PATCH 10/19] Updated tests to videohash2 --- tests/test_collagemaker.py | 6 +++--- tests/test_downloader.py | 6 +++--- tests/test_framesextractor.py | 6 +++--- tests/test_videoduration.py | 2 +- tests/test_videohash.py | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/test_collagemaker.py b/tests/test_collagemaker.py index cda2275..b80dc01 100644 --- a/tests/test_collagemaker.py +++ b/tests/test_collagemaker.py @@ -2,9 +2,9 @@ import pytest -from videohash.collagemaker import MakeCollage -from videohash.exceptions import CollageOfZeroFramesError -from videohash.utils import create_and_return_temporary_directory +from videohash2.collagemaker import MakeCollage +from videohash2.exceptions import CollageOfZeroFramesError +from videohash2.utils import create_and_return_temporary_directory def test_all(): diff --git a/tests/test_downloader.py b/tests/test_downloader.py index 80ed6f2..af38c1f 100644 --- a/tests/test_downloader.py +++ b/tests/test_downloader.py @@ -2,9 +2,9 @@ import pytest -from videohash.downloader import Download -from videohash.exceptions import DownloadFailed, DownloadOutPutDirDoesNotExist -from videohash.utils import ( +from videohash2.downloader import Download +from videohash2.exceptions import DownloadFailed, DownloadOutPutDirDoesNotExist +from videohash2.utils import ( create_and_return_temporary_directory, get_list_of_all_files_in_dir, ) diff --git a/tests/test_framesextractor.py b/tests/test_framesextractor.py index b8feb52..8203e19 100644 --- a/tests/test_framesextractor.py +++ b/tests/test_framesextractor.py @@ -2,9 +2,9 @@ import pytest -from videohash.exceptions import FFmpegNotFound, FramesExtractorOutPutDirDoesNotExist -from videohash.framesextractor import FramesExtractor -from videohash.utils import create_and_return_temporary_directory +from videohash2.exceptions import FFmpegNotFound, FramesExtractorOutPutDirDoesNotExist +from videohash2.framesextractor import FramesExtractor +from videohash2.utils import create_and_return_temporary_directory script_path = os.path.dirname(os.path.realpath(__file__)) diff --git a/tests/test_videoduration.py b/tests/test_videoduration.py index 516df48..27fc2e6 100644 --- a/tests/test_videoduration.py +++ b/tests/test_videoduration.py @@ -2,7 +2,7 @@ import pytest -from videohash.videoduration import video_duration +from videohash2.videoduration import video_duration this_dir = os.path.dirname(os.path.realpath(__file__)) diff --git a/tests/test_videohash.py b/tests/test_videohash.py index 031f4d6..e6c5baf 100644 --- a/tests/test_videohash.py +++ b/tests/test_videohash.py @@ -2,9 +2,9 @@ import pytest -from videohash.exceptions import DidNotSupplyPathOrUrl, StoragePathDoesNotExist -from videohash.utils import create_and_return_temporary_directory -from videohash.videohash import VideoHash +from videohash2.exceptions import DidNotSupplyPathOrUrl, StoragePathDoesNotExist +from videohash2.utils import create_and_return_temporary_directory +from videohash2.videohash import VideoHash this_dir = os.path.dirname(os.path.realpath(__file__)) From eaa5e71ede478b57a739926cdf8f274b453a5733 Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 15:10:23 +0100 Subject: [PATCH 11/19] Added patool install to fix windows testing workflow. --- .github/workflows/ci_windows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci_windows.yml b/.github/workflows/ci_windows.yml index 2065c31..590e686 100644 --- a/.github/workflows/ci_windows.yml +++ b/.github/workflows/ci_windows.yml @@ -28,6 +28,7 @@ jobs: pip install -r requirements.txt pip install -r requirements-test.txt pip install -U setuptools wheel + pip install patool python assets/windows_ffmpeg_downloader_at_cwd.py $env:Path += ";D:\a\videohash\videohash" ffmpeg -version From 8de50142f648f706e79627975ae1e8abcd1c70c9 Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 15:12:50 +0100 Subject: [PATCH 12/19] Removed codecov upload. --- .github/workflows/ci_linux.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 7475a4a..bed2b82 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -42,4 +42,3 @@ jobs: - name: Test with pytest run: | pytest - - name: Upload coverage to Codecovs From 825ff7b821f999873307581096d378f205e9c5ae Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 15:15:29 +0100 Subject: [PATCH 13/19] Moved to videohash2 in linux workflow. --- .github/workflows/ci_linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index bed2b82..eb6d589 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -33,9 +33,9 @@ jobs: - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names - flake8 videohash/ --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 videohash2/ --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 videohash/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --per-file-ignores="videohash/__init__.py:F401" + flake8 videohash2/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --per-file-ignores="videohash/__init__.py:F401" - name: Static type test with mypy run: | mypy From cd7f2e1be8986e0f5600b09c5982edb05a187072 Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 15:51:40 +0100 Subject: [PATCH 14/19] Potential fix for windows workflow patool install issue --- .github/workflows/ci_windows.yml | 3 +-- assets/windows_ffmpeg_downloader_at_cwd.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_windows.yml b/.github/workflows/ci_windows.yml index 590e686..e69b435 100644 --- a/.github/workflows/ci_windows.yml +++ b/.github/workflows/ci_windows.yml @@ -28,9 +28,8 @@ jobs: pip install -r requirements.txt pip install -r requirements-test.txt pip install -U setuptools wheel - pip install patool python assets/windows_ffmpeg_downloader_at_cwd.py - $env:Path += ";D:\a\videohash\videohash" + $env:Path += ";D:\a\videohash2\videohash2" ffmpeg -version - name: Build test the package run: | diff --git a/assets/windows_ffmpeg_downloader_at_cwd.py b/assets/windows_ffmpeg_downloader_at_cwd.py index bb4b631..990f63d 100644 --- a/assets/windows_ffmpeg_downloader_at_cwd.py +++ b/assets/windows_ffmpeg_downloader_at_cwd.py @@ -1,10 +1,21 @@ import os +import sys +import importlib.util import shutil import tempfile from pathlib import Path -import requests -from pyunpack import Archive +#import requests +#from pyunpack import Archive + +currentDir = os.path.dirname(sys.executable) +modDir = currentDir + "\Tools\scripts\win_add2path.py" +spec = importlib.util.spec_from_file_location("add2path", modDir) +add2path = importlib.util.module_from_spec(spec) +sys.modules["add2path"] = add2path +spec.loader.exec_module(add2path) + +add2path.main() cwd = os.getcwd() From ac07032c5c1ab26a1cbe84c03155aa7a732372be Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 15:53:01 +0100 Subject: [PATCH 15/19] videohash2 namechange in windows workflow. --- .github/workflows/ci_windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_windows.yml b/.github/workflows/ci_windows.yml index e69b435..32a43c2 100644 --- a/.github/workflows/ci_windows.yml +++ b/.github/workflows/ci_windows.yml @@ -36,4 +36,4 @@ jobs: python setup.py sdist bdist_wheel - name: Test with pytest run: | - pytest --cov=videohash tests/ -v + pytest --cov=videohash2 tests/ -v From 23c252eca9bc3a7984dcbaedda32b3fa59478b40 Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 15:55:10 +0100 Subject: [PATCH 16/19] Removed commented imports. --- assets/windows_ffmpeg_downloader_at_cwd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/windows_ffmpeg_downloader_at_cwd.py b/assets/windows_ffmpeg_downloader_at_cwd.py index 990f63d..24c780a 100644 --- a/assets/windows_ffmpeg_downloader_at_cwd.py +++ b/assets/windows_ffmpeg_downloader_at_cwd.py @@ -5,8 +5,8 @@ import tempfile from pathlib import Path -#import requests -#from pyunpack import Archive +import requests +from pyunpack import Archive currentDir = os.path.dirname(sys.executable) modDir = currentDir + "\Tools\scripts\win_add2path.py" From 4dfb391e0c94abba2cea4801f003f390ecb727e2 Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 16:01:20 +0100 Subject: [PATCH 17/19] installing patoolib instead of patool. --- requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-test.txt b/requirements-test.txt index 55a27ca..7b00b7b 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -2,7 +2,7 @@ requests pytest pytest-cov codecov -patool +patoolib pyunpack flake8 mypy From d85f4347ad9819760de4ff7f47b53b2cde565712 Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 16:09:22 +0100 Subject: [PATCH 18/19] Moved requests and pyunpack below win_add2path. --- assets/windows_ffmpeg_downloader_at_cwd.py | 6 +++--- requirements-test.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/windows_ffmpeg_downloader_at_cwd.py b/assets/windows_ffmpeg_downloader_at_cwd.py index 24c780a..fc20672 100644 --- a/assets/windows_ffmpeg_downloader_at_cwd.py +++ b/assets/windows_ffmpeg_downloader_at_cwd.py @@ -5,9 +5,6 @@ import tempfile from pathlib import Path -import requests -from pyunpack import Archive - currentDir = os.path.dirname(sys.executable) modDir = currentDir + "\Tools\scripts\win_add2path.py" spec = importlib.util.spec_from_file_location("add2path", modDir) @@ -17,6 +14,9 @@ add2path.main() +import requests +from pyunpack import Archive + cwd = os.getcwd() temp_folder = os.path.join(tempfile.mkdtemp(), ("temp_storage_dir%s" % os.path.sep)) diff --git a/requirements-test.txt b/requirements-test.txt index 7b00b7b..55a27ca 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -2,7 +2,7 @@ requests pytest pytest-cov codecov -patoolib +patool pyunpack flake8 mypy From c44d61c4c587d5c064889f236131fdf10b7707db Mon Sep 17 00:00:00 2001 From: CDemmenie Date: Wed, 3 Jul 2024 16:31:34 +0100 Subject: [PATCH 19/19] Returned windows downloader to original state, disabled windows workflow. --- assets/windows_ffmpeg_downloader_at_cwd.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/assets/windows_ffmpeg_downloader_at_cwd.py b/assets/windows_ffmpeg_downloader_at_cwd.py index fc20672..e527bbc 100644 --- a/assets/windows_ffmpeg_downloader_at_cwd.py +++ b/assets/windows_ffmpeg_downloader_at_cwd.py @@ -1,19 +1,9 @@ import os import sys -import importlib.util import shutil import tempfile from pathlib import Path -currentDir = os.path.dirname(sys.executable) -modDir = currentDir + "\Tools\scripts\win_add2path.py" -spec = importlib.util.spec_from_file_location("add2path", modDir) -add2path = importlib.util.module_from_spec(spec) -sys.modules["add2path"] = add2path -spec.loader.exec_module(add2path) - -add2path.main() - import requests from pyunpack import Archive