Python 101 For Post Production Professionals: Scripting Media Management Operations

March 12, 2024

In Part 3 of his series, Kaur Hendrikson dives into the deep end and teaches you to script a Media Management operation for copying files.


Series

Part 3: Creating the first script you might use in your business

In this Insight, we are moving beyond the simple calculator that introduced the core range of concepts to get you started with Python. Now, in Parts 3 & 4, we are writing a script that you can use in your day-to-day work… we are manipulating media files. You can think of this as a step-by-step guide on leveraging Python libraries to automate tedious file management tasks, offering the potential to transform mundane procedures into a structured and efficient process.

About this Insight

You will learn to write a Python script that facilitates the ingestion of files by copying and sorting them into designated folders based on their file extensions, such as WAV or BRaW files. You will also learn about ‘libraries’, how to invoke them and rename them for brevity in your coding, then import specific functions from those libraries.

Key Python functions and libraries I’m covering today include:

  • tkinter – A library for creating GUI elements, such as file dialogues, enables users to select source and destination folders easily.
  • os – A library for operating system interaction used for directory traversal and path manipulation. It’s essential for locating files within subfolders and generating new paths for sorted files. In this script, you learn to use os.walk, os.path.join, os.splitext, os.makedirs
  • Shutil – We use shutil.copy2 for file duplication. This function copies files while preserving metadata, an important feature for managing media files.
  • Plus many more – You’ll add additional functionality to this script so that it provides user feedback. You’ll invoke additional functions to count and total the number of files being processed.

These concepts are fundamental for any aspiring Python developer, especially those in post-production, looking to automate and enhance their file management system.

As you learn about each of those functions, you’ll test the script to ensure you’re getting the right results.

Key takeaways from this Insight

By the end of this Insight, you should understand how to:

  • Use External Libraries to incorporate external Python libraries into your projects, such as tkinter for GUI dialogues and shutil for file operations, to enhance script functionality without reinventing the wheel.
  • Use tkinter to create graphical user interfaces for folder selection, simplifying the process of choosing source and destination folders through user-friendly dialogues.
  • Implement file handling with os and shutil: Gaining proficiency in using the os library for directory traversal and file path manipulation, paired with employing shutil for copying files and preserving their metadata.
  • Execute Dynamic File Sorting and Organization using os functions for splitting file names and extensions and creating directories to keep files systematically organized.
  • Creative Coding With DCTL – Like Python, DCTLs are a great extension to DaVinci Resolve Studio. Learn how to build your own DCTL in this multi-part series by Contributor Cullen Kelly.

Questions or Comments? Leave a comment!

What do you think? Did I dive off the deep end in this one? Let me know! Mixing Light is all about community and if you have something to add, or if you have more questions, the comments are the place to ask.

– Kaur


Member Content

Sorry... the rest of this content is for members only. You'll need to login or Join Now to continue (we hope you do!).

Need more information about our memberships? Click to learn more.

Membership options
Member Login

Are you using our app? For the best experience, please login using the app's launch screen


1,200+ Tutorials, Articles, and Webinars To Explore

Get 7-day access to our library of over 1,200+ tutorials - for $5!
Do you like what you see? Maintain access for less than $5 per month.


Start Your Test Drive!
Loading...