Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to main branch development #419

Merged
merged 14 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
git checkout refs/remotes/origin/resources -- tests/resources/

- name: Download FFMPEG ${{ env.ffmpeg-version }}
uses: dsaltares/[email protected].1
uses: dsaltares/[email protected].2
with:
repo: 'GyanD/codexffmpeg'
version: 'tags/${{ env.ffmpeg-version }}'
Expand Down Expand Up @@ -91,10 +91,11 @@ jobs:
./dist/scenedetect/scenedetect -i tests/resources/goldeneye.mp4 detect-content time -e 2s

- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: PySceneDetect-win64_portable
path: dist/scenedetect
include-hidden-files: true

test:
runs-on: windows-latest
Expand All @@ -104,7 +105,7 @@ jobs:
with:
ref: resources

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: PySceneDetect-win64_portable
path: build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:

- name: Upload Package
if: ${{ matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: scenedetect-dist
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ jobs:
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
uses: actions/dependency-review-action@v4
6 changes: 0 additions & 6 deletions .style.yapf

This file was deleted.

29 changes: 20 additions & 9 deletions dist/pre_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
sys.path.append(os.path.abspath("."))

import scenedetect


VERSION = scenedetect.__version__

if len(sys.argv) <= 2 or not ("--ignore-installer" in sys.argv):
run_version_check = ("--ignore-installer" not in sys.argv)

if run_version_check:
installer_aip = ''
with open("dist/installer/PySceneDetect.aip", "r") as f:
installer_aip = f.read()
Expand All @@ -16,12 +20,19 @@
with open("dist/.version_info", "wb") as f:
v = VERSION.split(".")
assert 2 <= len(v) <= 3, f"Unrecognized version format: {VERSION}"

if len(v) == 3:
(maj, min, pat) = int(v[0]), int(v[1]), int(v[2])
else:
(maj, min, pat) = int(v[0]), int(v[1]), 0

if len(v) < 3:
v.append("0")
(maj, min, pat, bld) = v[0], v[1], v[2], 0
# If either major or minor have suffixes, assume it's a dev/beta build and set
# the final component to 999.
if not min.isdigit():
assert "-" in min
min = min[:min.find("-")]
bld = 999
if not pat.isdigit():
assert "-" in pat
pat = pat[:pat.find("-")]
bld = 999
f.write(f"""# UTF-8
#
# For more details about fixed file info 'ffi' see:
Expand All @@ -30,8 +41,8 @@
ffi=FixedFileInfo(
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
# Set not needed items to zero 0.
filevers=(0, {maj}, {min}, {pat}),
prodvers=(0, {maj}, {min}, {pat}),
filevers=({maj}, {min}, {pat}, {bld}),
prodvers=({maj}, {min}, {pat}, {bld}),
# Contains a bitmask that specifies the valid bits 'flags'r
mask=0x3f,
# Contains a bitmask that specifies the Boolean attributes of the file.
Expand Down
10 changes: 5 additions & 5 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ To get started, the :func:`scenedetect.detect` function takes a path to a video
.. code:: python

from scenedetect import detect, ContentDetector
scene_list = detect('my_video.mp4', ContentDetector())
scene_list = detect("my_video.mp4", ContentDetector())

``scene_list`` is now a list of :class:`FrameTimecode <scenedetect.frame_timecode.FrameTimecode>` pairs representing the start/end of each scene (try calling ``print(scene_list)``). Note that you can set ``show_progress=True`` when calling :func:`detect <scenedetect.detect>` to display a progress bar with estimated time remaining.

Expand All @@ -70,7 +70,7 @@ Next, let's print the scene list in a more readable format by iterating over it:
.. code:: python

for i, scene in enumerate(scene_list):
print('Scene %2d: Start %s / Frame %d, End %s / Frame %d' % (
print("Scene %2d: Start %s / Frame %d, End %s / Frame %d" % (
i+1,
scene[0].get_timecode(), scene[0].get_frames(),
scene[1].get_timecode(), scene[1].get_frames(),))
Expand All @@ -80,8 +80,8 @@ Now that we know where each scene is, we can also :ref:`split the input video <s
.. code:: python

from scenedetect import detect, ContentDetector, split_video_ffmpeg
scene_list = detect('my_video.mp4', ContentDetector())
split_video_ffmpeg('my_video.mp4', scene_list)
scene_list = detect("my_video.mp4", ContentDetector())
split_video_ffmpeg("my_video.mp4", scene_list)

This is just a small snippet of what PySceneDetect offers. The library is very modular, and can integrate with most application workflows easily.

Expand Down Expand Up @@ -149,7 +149,7 @@ Module Reference
Logging
=======================================================================

PySceneDetect outputs messages to a logger named ``pyscenedetect`` which does not have any default handlers. You can use :func:`scenedetect.init_logger <scenedetect.platform.init_logger>` with ``show_stdout=True`` or specify a log file (verbosity can also be specified) to attach some common handlers, or use ``logging.getLogger('pyscenedetect')`` and attach log handlers manually.
PySceneDetect outputs messages to a logger named ``pyscenedetect`` which does not have any default handlers. You can use :func:`scenedetect.init_logger <scenedetect.platform.init_logger>` with ``show_stdout=True`` or specify a log file (verbosity can also be specified) to attach some common handlers, or use ``logging.getLogger("pyscenedetect")`` and attach log handlers manually.


=======================================================================
Expand Down
113 changes: 58 additions & 55 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
Expand All @@ -15,15 +14,15 @@
import os
import sys

sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))

from scenedetect import __version__ as scenedetect_version

# -- Project information -----------------------------------------------------

project = 'PySceneDetect'
copyright = '2014-2024, Brandon Castellano'
author = 'Brandon Castellano'
project = "PySceneDetect"
copyright = "2014-2024, Brandon Castellano"
author = "Brandon Castellano"

# The short X.Y version
version = scenedetect_version
Expand All @@ -36,49 +35,49 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.napoleon',
'sphinx.ext.autodoc',
"sphinx.ext.napoleon",
"sphinx.ext.autodoc",
]

autoclass_content = "both"
autodoc_member_order = "groupwise"
autodoc_typehints = 'description'
autodoc_typehints_format = 'short'
autodoc_typehints = "description"
autodoc_typehints_format = "short"

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The root toctree document.
root_doc = 'index'
root_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# -- Options for HTML output -------------------------------------------------

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_css_files = ['pyscenedetect.css']
html_static_path = ["_static"]
html_css_files = ["pyscenedetect.css"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand All @@ -93,72 +92,76 @@
# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'PySceneDetectdoc'
htmlhelp_basename = "PySceneDetectdoc"

# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(root_doc, 'PySceneDetect.tex', 'PySceneDetect Documentation', 'Brandon Castellano', 'manual'),
(root_doc, "PySceneDetect.tex", "PySceneDetect Documentation", "Brandon Castellano", "manual"),
]

# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(root_doc, 'pyscenedetect', 'PySceneDetect Documentation', [author], 1)]
man_pages = [(root_doc, "pyscenedetect", "PySceneDetect Documentation", [author], 1)]

# -- Options for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(root_doc, 'PySceneDetect', 'PySceneDetect Documentation', author, 'PySceneDetect',
'Python API and `scenedetect` command reference.', 'Miscellaneous'),
(
root_doc,
"PySceneDetect",
"PySceneDetect Documentation",
author,
"PySceneDetect",
"Python API and `scenedetect` command reference.",
"Miscellaneous",
),
]

# -- Theme -------------------------------------------------

# TODO: Consider switching to sphinx_material.

html_theme = 'alabaster'
html_theme = "alabaster"
html_theme_options = {
'sidebar_width': '235px',
'description': 'Version: [%s]' % (release),
'show_relbar_bottom': True,
'show_relbar_top': False,
'github_user': 'Breakthrough',
'github_repo': 'PySceneDetect',
'github_type': 'star',
'tip_bg': '#f0f6fa',
'tip_border': '#c2dcf2',
'hint_bg': '#f0faf0',
'hint_border': '#d3ebdc',
'warn_bg': '#f5ebd0',
'warn_border': '#f2caa2',
'attention_bg': '#f5dcdc',
'attention_border': '#ffaaaa',
'logo': 'pyscenedetect_logo.png',
'logo_name': False,
"sidebar_width": "235px",
"description": "Version: [%s]" % (release),
"show_relbar_bottom": True,
"show_relbar_top": False,
"github_user": "Breakthrough",
"github_repo": "PySceneDetect",
"github_type": "star",
"tip_bg": "#f0f6fa",
"tip_border": "#c2dcf2",
"hint_bg": "#f0faf0",
"hint_border": "#d3ebdc",
"warn_bg": "#f5ebd0",
"warn_border": "#f2caa2",
"attention_bg": "#f5dcdc",
"attention_border": "#ffaaaa",
"logo": "pyscenedetect_logo.png",
"logo_name": False,
}
Loading
Loading