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

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay