Skip to content

Commit

Permalink
Merge pull request #8 from iluvcapra/master
Browse files Browse the repository at this point in the history
Merging changes for v1.2.1
  • Loading branch information
iluvcapra committed Jun 1, 2023
2 parents d0e2e5b + 6525840 commit cd35f4f
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 96 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/pythonpublish.yml
Expand Up @@ -5,10 +5,15 @@ on:
types: [published]
workflow_dispatch:


permissions:
contents: read
id-token: write

jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: release
steps:
- uses: actions/checkout@v3.5.2
- name: Set up Python
Expand All @@ -18,14 +23,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools build wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_APIKEY }}
run: |
python -m build .
twine upload dist/*
pip install build
- name: Build package
run: python -m build
- name: pypi-publish
uses: pypa/gh-action-pypi-publish@v1.8.6
- name: Report to Mastodon
uses: cbrgm/mastodon-github-action@v1.0.1
with:
Expand Down
9 changes: 5 additions & 4 deletions docs/source/conf.py
Expand Up @@ -15,18 +15,19 @@
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
print(sys.path)

import pycmx

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

project = u'pycmx'
copyright = u'2022, Jamie Hardt'
copyright = u'(c) 2023, Jamie Hardt'
author = u'Jamie Hardt'

# The short X.Y version
version = u''
version = pycmx.__version__
# The full version, including alpha/beta/rc tags
release = u''
release = pycmx.__version__


# -- General configuration ---------------------------------------------------
Expand Down
7 changes: 3 additions & 4 deletions pycmx/__init__.py
@@ -1,14 +1,13 @@
# -*- coding: utf-8 -*-
"""
pycmx is a module for parsing CMX 3600-style EDLs. For more information and
examples see README.md
pycmx is a parser for CMX 3600-style EDLs.
This module (c) 2022 Jamie Hardt. For more information on your rights to
This module (c) 2023 Jamie Hardt. For more information on your rights to
copy and reuse this software, refer to the LICENSE file included with the
distribution.
"""

__version__ = '1.2.0'
__version__ = '1.2.1'

from .parse_cmx_events import parse_cmx3600
from .transition import Transition
Expand Down
28 changes: 14 additions & 14 deletions pycmx/channel_map.py
Expand Up @@ -2,7 +2,7 @@
# (c) 2018 Jamie Hardt

from re import (compile, match)
from typing import Dict, Tuple
from typing import Dict, Tuple, Generator

class ChannelMap:
"""
Expand All @@ -24,62 +24,62 @@ def __init__(self, v=False, audio_channels=set()):
self.v = v

@property
def video(self):
def video(self) -> bool:
'True if video is included'
return self.v

@property
def audio(self):
def audio(self) -> bool:
'True if an audio channel is included'
return len(self._audio_channel_set) > 0

@property
def channels(self):
def channels(self) -> Generator[int, None, None]:
'A generator for each audio channel'
for c in self._audio_channel_set:
yield c

@property
def a1(self):
def a1(self) -> bool:
"""True if A1 is included"""
return self.get_audio_channel(1)

@a1.setter
def a1(self,val):
def a1(self, val: bool):
self.set_audio_channel(1,val)

@property
def a2(self):
def a2(self) -> bool:
"""True if A2 is included"""
return self.get_audio_channel(2)

@a2.setter
def a2(self,val):
def a2(self, val: bool):
self.set_audio_channel(2,val)

@property
def a3(self):
def a3(self) -> bool:
"""True if A3 is included"""
return self.get_audio_channel(3)

@a3.setter
def a3(self,val):
def a3(self, val: bool):
self.set_audio_channel(3,val)

@property
def a4(self):
def a4(self) -> bool:
"""True if A4 is included"""
return self.get_audio_channel(4)

@a4.setter
def a4(self,val):
def a4(self,val: bool):
self.set_audio_channel(4,val)

def get_audio_channel(self,chan_num):
def get_audio_channel(self, chan_num) -> bool:
"""True if chan_num is included"""
return (chan_num in self._audio_channel_set)

def set_audio_channel(self,chan_num,enabled):
def set_audio_channel(self,chan_num, enabled: bool):
"""If enabled is true, chan_num will be included"""
if enabled:
self._audio_channel_set.add(chan_num)
Expand Down
28 changes: 15 additions & 13 deletions pycmx/edit.py
Expand Up @@ -3,7 +3,9 @@

from .transition import Transition
from .channel_map import ChannelMap
from .parse_cmx_statements import StmtEffectsName
# from .parse_cmx_statements import StmtEffectsName

from typing import Optional

class Edit:
"""
Expand All @@ -18,7 +20,7 @@ def __init__(self, edit_statement, audio_ext_statement, clip_name_statement, sou
self.trans_name_statement = trans_name_statement

@property
def line_number(self):
def line_number(self) -> int:
"""
Get the line number for the "standard form" statement associated with
this edit. Line numbers a zero-indexed, such that the
Expand All @@ -27,7 +29,7 @@ def line_number(self):
return self.edit_statement.line_number

@property
def channels(self):
def channels(self) -> ChannelMap:
"""
Get the :obj:`ChannelMap` object associated with this Edit.
"""
Expand All @@ -38,7 +40,7 @@ def channels(self):
return cm

@property
def transition(self):
def transition(self) -> Transition:
"""
Get the :obj:`Transition` object associated with this edit.
"""
Expand All @@ -48,60 +50,60 @@ def transition(self):
return Transition(self.edit_statement.trans, self.edit_statement.trans_op, None)

@property
def source_in(self):
def source_in(self) -> str:
"""
Get the source in timecode.
"""
return self.edit_statement.source_in

@property
def source_out(self):
def source_out(self) -> str:
"""
Get the source out timecode.
"""

return self.edit_statement.source_out

@property
def record_in(self):
def record_in(self) -> str:
"""
Get the record in timecode.
"""

return self.edit_statement.record_in

@property
def record_out(self):
def record_out(self) -> str:
"""
Get the record out timecode.
"""

return self.edit_statement.record_out

@property
def source(self):
def source(self) -> str:
"""
Get the source column. This is the 8, 32 or 128-character string on the
event record line, this usually references the tape name of the source.
"""
return self.edit_statement.source

@property
def black(self):
def black(self) -> bool:
"""
Black video or silence should be used as the source for this event.
"""
return self.source == "BL"

@property
def aux_source(self):
def aux_source(self) -> bool:
"""
An auxiliary source is the source of this event.
"""
return self.source == "AX"

@property
def source_file(self):
def source_file(self) -> Optional[str]:
"""
Get the source file, as attested by a "* SOURCE FILE" remark on the
EDL. This will return None if the information is not present.
Expand All @@ -112,7 +114,7 @@ def source_file(self):
return self.source_file_statement.filename

@property
def clip_name(self):
def clip_name(self) -> Optional[str]:
"""
Get the clip name, as attested by a "* FROM CLIP NAME" or "* TO CLIP
NAME" remark on the EDL. This will return None if the information is
Expand Down
22 changes: 11 additions & 11 deletions pycmx/edit_list.py
Expand Up @@ -5,21 +5,21 @@
from .event import Event
from .channel_map import ChannelMap

from typing import Generator

class EditList:
"""
Represents an entire edit decision list as returned by `parse_cmx3600()`.
Represents an entire edit decision list as returned by :func:`~pycmx.parse_cmx3600()`.
"""
def __init__(self, statements):
self.title_statement = statements[0]
self.event_statements = statements[1:]


@property
def format(self):
def format(self) -> str:
"""
The detected format of the EDL. Possible values are: `3600`,`File32`,
`File128`, and `unknown`
The detected format of the EDL. Possible values are: "3600", "File32",
"File128", and "unknown".
"""
first_event = next( (s for s in self.event_statements if type(s) is StmtEvent), None)

Expand All @@ -37,7 +37,7 @@ def format(self):


@property
def channels(self):
def channels(self) -> ChannelMap:
"""
Return the union of every channel channel.
"""
Expand All @@ -51,15 +51,15 @@ def channels(self):


@property
def title(self):
def title(self) -> str:
"""
The title of this edit list.
"""
return self.title_statement.title


@property
def unrecognized_statements(self):
def unrecognized_statements(self) -> Generator[StmtUnrecognized, None, None]:
"""
A generator for all the unrecognized statements in the list.
"""
Expand All @@ -69,7 +69,7 @@ def unrecognized_statements(self):


@property
def events(self):
def events(self) -> Generator[Event, None, None]:
'A generator for all the events in the edit list'
is_drop = None
current_event_num = None
Expand Down Expand Up @@ -97,7 +97,7 @@ def events(self):
yield Event(statements=event_statements)

@property
def sources(self):
def sources(self) -> Generator[StmtSourceUMID, None, None]:
"""
A generator for all of the sources in the list
"""
Expand Down

0 comments on commit cd35f4f

Please sign in to comment.