Skip to main content

Python wrapper allowing developers to communicate with adobe applications

Project description

Pydobe

Python 3.8 License Code style: black SemVer GitHub last commit (branch)

A Python wrapper allowing developers to communicate with adobe applications

This package is based upon Pymiere - created by Quentin Masingarbe (https://github.com/qmasingarbe/pymiere)

Installation

Windows:

pip install pydobe

Use cases and examples

Snippets and examples for potential uses within After Effects

Working with projects

app = pydobe.objects.app

# Open a Project
project_path = "path/to/my/project.aep"
app.open(project_path)

# Get path of current project
current_project = app.project.file
print(current_project)

# Save a Project
app.project.save()

# Save a Project to a new path
new_path = "path/to/my/new/project.aep"
app.project.save(new_path)

# Make some changes to your project

# Check if scene has been modified
print(app.project.dirty)

# # Close a Project
app.project.close()  # This will display a user prompt
# app.project.close(save=True)  # This will save before opening a new project
# app.project.close(save=False)  # This will not save before opening a new project


# Create a new Project
app.new_project()  # This will display a user prompt
# app.new_project(save=True)  # This will save before opening a new project
# app.new_project(save=False)  # This will not save before opening a new project

Working with items

project = pydobe.objects.app.project

# Check how many items are in the project
print(project.num_items)

# Get the names of all the items in the project
for item in project.items:
    print(item.name)
    # check which items are selected
    if item.selected:
        print(f'{item.name} is selected')

# Get the active item
my_item = project.active_item  # This attribute requires precisely 1 item to be selected

# Find out what type of item it is
print(my_item.type_name)

# Find the parent folder of the item
print(my_item.parent_folder)

# Get the names of all the compositions
for comp in project.compositions:
    print(comp.name)

# Get item by name
footage_folder = project.item_by_name("My Footage")

# Remove items from the scene:
for child in footage_folder.items:
    child.remove()
    

Adding items to a project

import pydobe

project = pydobe.objects.app.project

# Create some folders
# Add a comment and set a label colour
footage_folder = project.items.add_folder("Footage")
footage_folder.comment = "This is where we keep our footage"
footage_folder.label = "Fuchsia"

comps_folder = project.items.add_folder("Compositions")
comps_folder.comment = "This is where we keep our comps"
comps_folder.label = "Blue"

# Create a composition
my_comp = project.items.add_comp("My New Comp", 1920, 1080, 1, 100, 25)
my_comp.parent_folder = comps_folder
# duration is set using frames, to set duration using seconds
# ("My New Comp", 1920, 1080, 1, 4, 25, duration_as_frames=False)

# Add some footage
list_of_paths = [
    "path/to/my/file_01_v001_0000.png",
    "path/to/my/file_02_v001_0000.png",
    "path/to/my/file_03_v001_0000.png",
]

for path in list_of_paths:
    footage = project.import_file(path)
    # Set the frame rate
    footage.main_source.conform_frame_rate = 24
    # Set the parent
    footage.parent_folder = footage_folder

# Replace the footage with a new version
list_of_replacement_paths = [
    "path/to/my/file_01_v002_0000.png",
    "path/to/my/file_02_v002_0000.png",
    "path/to/my/file_03_v002_0000.png",
]

for footage in footage_folder.items:
    for new_path in list_of_replacement_paths:
        file_name = new_path.split("/")[-1]
        unique_file = file_name.rsplit("_", 2)[0]
        unique_footage = footage.name.rsplit("_", 2)[0]
        if unique_file == unique_footage:
            footage.replace(new_path)

Thanks

Thank you to Quentin Masingarbe for his Pymiere repository, as well as sharing his knowledge with me.

Thank you to Corentin Charron for constant mentoring.

License

This project is licensed under the MIT License. See the LICENSE file for details. Copy it, steal it, modify it, share it!

Contact

For support, questions, or interest, please contact me at lisa.gg89@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydobe-0.3.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydobe-0.3.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file pydobe-0.3.0.tar.gz.

File metadata

  • Download URL: pydobe-0.3.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for pydobe-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d987dacfc5021bf0e3d2901c2cd9bac867b52ea076c4499f6c2f2309a96aade1
MD5 d0a4f855ee047a2a4589cf77aea8cdfc
BLAKE2b-256 d63b34d9e24a96027969a5febe1b3ef09de0e022b78e291e0d4016f7fec9d3e5

See more details on using hashes here.

File details

Details for the file pydobe-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pydobe-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for pydobe-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2a22b2922414dec07d624756cd5155808ba70a714abdd76086725ffbc3fa093
MD5 d688cc52fa2ef6b6e252acee262cd610
BLAKE2b-256 ed0f77101b3be8fdbbd90224947805094497be0def7c3274697cb3d502ee1832

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page