DEV Community

Cover image for Reading metadata of media files using Python
Enis Habul
Enis Habul

Posted on • Edited on

1 3

Reading metadata of media files using Python

Hello there my name is Enis and this is my first post here :D

So where to start, i am IT Enthusiast and i am eager to learn different stuff. Lately i started with Python and i wanted to experiment with it. I am learning stuff from a lot of sources like books, yt tutorials and Udemy courses. When i am at home where i have good internet speed i watch courses on my Udemy account but sometimes when i am out of town i usually download course for offline use. I came to idea that it would be good to make python script to read metadata of videos to calculate my progress so i made this little terminal program.
I am using MediaInfo to read metadata of files. (more info you can find in my github repo README file)

Steps

  • Download course you want and save it in some folder

Pic 1

  • Open your favorite terminal (i am using cmder) and navigate to folder where you placed this script

  • Call this script and pass path to it (place where you saved your course)

    Example
     python VideoLength.py "D:\Udemy\Beginner Python and Coding Intro - Scripting a Virtual Car" 
Enter fullscreen mode Exit fullscreen mode

There is some arguments you can pass into it, if you don't pass anything you get this

Pic 2

Argument Usage Example
-s length of specified section VideoLength.py "path" -s 1
-v open folder location of course VideoLength.py "path" -s 1 -v
-p play all section videos with video player VideoLength.py "path" -s 1 -v -p
-t get course progress VideoLength.py "path" -s 1 -v -p -t

Argument -t must be used with -s argument

If you pass -s with combination of -t you can get how long of course you watched

Pic 3

You can also open location of course folder with argument -v and with argument -p you can play all of your videos with media player.

Alt Text

Image of Datadog

Learn how to monitor AWS container environments at scale

In this eBook, Datadog and AWS share insights into the changing state of containers in the cloud and explore why orchestration technologies are an essential part of managing ever-changing containerized workloads.

Download the eBook

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more