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

Add "new" command #1

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6981bba
Convert to pyproject.toml
stephengrice Mar 9, 2024
5f81155
Add BlenderDriver MVP
stephengrice Mar 9, 2024
4c93ca2
Remove scripts that should no longer be needed
stephengrice Mar 9, 2024
6fef681
Add new subcommand
stephengrice Mar 9, 2024
4afb4a4
Add basic new command
stephengrice Mar 10, 2024
b451906
Refactor, get render to do a bland 10 framer
stephengrice Mar 10, 2024
e5a4dfe
Get video to add properly again
stephengrice Mar 10, 2024
58e1f79
Get sequential clips, duration working
stephengrice Mar 10, 2024
e0589f5
Get text working again
stephengrice Mar 10, 2024
7870aa7
Get subprojects to work again
stephengrice Mar 10, 2024
2850565
Add offset, scale to video render
stephengrice Mar 10, 2024
ce6d9fc
Add channel, add offset/scale to text
stephengrice Mar 10, 2024
dbdbb42
Get start_with_last working fairly well
stephengrice Mar 10, 2024
9cb709b
Get filters working! Add goggins.mp4
stephengrice Mar 10, 2024
5c05c46
Delete unused project.py
stephengrice Mar 10, 2024
305068c
Reorganize code
stephengrice Mar 10, 2024
90e63ff
Add first pass at CLI wizard for new
stephengrice Mar 10, 2024
41f06e7
Get serialization working for "new" cmd
stephengrice Mar 10, 2024
8cd5cfa
Update README.md
stephengrice Mar 10, 2024
05dfe94
major: Add new command, re-architect to use BlenderDriver
stephengrice Mar 10, 2024
39e1ad9
feat!: Re-architect to use BlenderDriver
stephengrice Mar 10, 2024
bc62c40
Update releaserc to contain custom prefixes
stephengrice Mar 10, 2024
7b35ebc
chore(release): 2.0.0
semantic-release-bot Mar 10, 2024
7720e85
Remove .releaserc (use default)
stephengrice Mar 10, 2024
131233d
docs: Add sphinx template to site.yaml
stephengrice Mar 22, 2024
6224d7e
chore(release): 2.0.1
semantic-release-bot Mar 22, 2024
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ __pycache__
!sample.mp4
*.egg-info
*.blend
build/
build/
blender_driver_debug.py
pkvid.yaml
25 changes: 0 additions & 25 deletions .releaserc

This file was deleted.

56 changes: 39 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,71 @@ See the docs site at [docs.pkvid.pagekey.io](https://docs.pkvid.pagekey.io/).

## Getting Started

1. Build the Docker image. It will take a while. Final image will be huge, ~10-15 GB.
1. Ensure blender is installed on your system and on your PATH as `blender`. If you can run `blender --version` in a terminal, you're good to go.

2. Install `pkvid`. You must have at least Python 3.9 for this.

```bash
docker-compose build
pip install pkvid
```

2. Install the helper script.
3. Generate a new project:

```bash
sudo ./scripts/install.sh
pkvid new
```

3. Run pkvid in a directory with `pkvid.yaml`.
4. You should now see `pkvid.yaml` in the current directory. Run:

```bash
pkvid render
```

5. Check the `build/` folder for your rendered project. You may also open the Blender project file to explore/debug.


## Building Blender with Sound in Docker (Advanced)

1. Build the Docker image. It will take a while. Final image will be huge, ~10-15 GB.

```bash
cd your-project
pkvid
docker-compose build
```

## Developer Instructions

Run the test suite:
1. Install poetry.

```bash
docker-compose run dev pytest
pip install poetry
```

Run integration test:
2. Install dependencies.

```bash
docker-compose run dev pkvid test/integration/pkvid.yaml
poetry install --with dev --with filters
```

Get a shell:
3. Run the test suite:

```bash
docker-compose run dev bash
poetry run pytest
```

## Usage without Docker (Not Recommended)
4. Run integration test:

```bash
cd test/integration
poetry run pkvid render
```

## Old GUides

Do not follow these guides. I need to find a better place to put them, or just delete them.

These are old guides - leaving them here in case they're useful at some point.

### Installation Guide
### OLD Installation Guide

This package is not meant to be installed in a regular Python environment. Instead, you must install it from the Python that is embedded in Blender.

Expand Down Expand Up @@ -82,15 +103,15 @@ $BLENDER_PYTHON -m pip install --upgrade pip
$BLENDER_PYTHON -m pip install pkvid
```

### Development Install
### OLD Development Install

Same process, but for the last step, run this instead:

```bash
$BLENDER_PYTHON -m pip install -e .
```

### Example Run Command
### OLD Example Run Command

```bash
blender -b -P pkvid/__main__.py test/sample_config.json
Expand All @@ -104,3 +125,4 @@ Building Blender from scratch:
- [Blender Community YouTube video](https://www.youtube.com/watch?v=WBAnd-r_x64)
- [Building on Ubuntu](https://wiki.blender.org/wiki/Building_Blender/Linux/Ubuntu)
- [Building bpy module](https://wiki.blender.org/wiki/Building_Blender/Other/BlenderAsPyModule)

4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [2.0.1](https://gitlab.com/pagekey/apps/pkvid/pkvid/compare/2.0.0...2.0.1) (2024-03-22)

# [2.0.0](https://gitlab.com/pagekey/apps/pkvid/pkvid/compare/1.0.0...2.0.0) (2024-03-10)

# 1.0.0 (2024-02-09)


Expand Down
1 change: 1 addition & 0 deletions docs/site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ copyright: '2024, PageKey'
author: 'Steve'
release: 'latest'
package: '../../../pkvid'
template: sphinx
92 changes: 0 additions & 92 deletions pkvid/blender.py

This file was deleted.

56 changes: 41 additions & 15 deletions pkvid/cli.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,54 @@
import argparse
import os
import shutil
import sys

import pkvid.blender as blender
from pkvid.config import get_config
from pkvid.project import Project
from pkvid.project import ProjectConfig, Text, Video


def main(cli_args=sys.argv[1:]):
parser = argparse.ArgumentParser(description='Video editing toolkit')
parser.add_argument('filename', help='Name of config file')
subparsers = parser.add_subparsers(dest='command')

new_parser = subparsers.add_parser('new', help='Create a new project')

render_parser = subparsers.add_parser('render', help='Render a project')
render_parser.add_argument('-f', '--filename', help='Name of config file', default='pkvid.yaml')

args = parser.parse_args(cli_args)

if args.filename:
project_config = get_config(args.filename)
project = Project(project_config)
print(f"Successfully parsed project: {project.config.name}")
dirname = os.path.dirname(args.filename)
if len(dirname) > 0:
# if not already in that dir, go to it
os.chdir(os.path.dirname(args.filename))
os.makedirs('render', exist_ok=True)
os.chdir('render')
project.render()
if args.command == 'new':
print("Create a new project here")
# Read a string for the name from the user
name = input("What is the name of the project? ")
config = ProjectConfig(name=name, clips=[])
while input("Add a clip? (y/n) ") == 'y':
print("Choose a clip type:")
print("v) Video")
print("t) Text")
clip_type = input("> ")
if clip_type == 'v':
path = input("Enter path to video: ")
config.clips.append(Video(path=path))
elif clip_type == 't':
body = input("Enter text: ")
config.clips.append(Text(body=body))
else:
print("Invalid clip type")
config.save('pkvid.yaml')
elif args.command == 'render':
print("render", args.filename)
config = ProjectConfig.load(args.filename)
print(f"Successfully parsed project: {config.name}")
# Set up build directory
shutil.rmtree('build', ignore_errors=True)
orig_dir = os.getcwd()
os.makedirs('build', exist_ok=True)
os.chdir('build')
# Perform render of project
config.render()
# Restore original directory
os.chdir(orig_dir)
else:
parser.print_usage()

Expand Down
48 changes: 0 additions & 48 deletions pkvid/config.py

This file was deleted.

Loading