1

I am trying to make a script that pick up a random mkv or mp4 file in a directory and play, only limit is that the file playtime must not be more than 2 hours, how do I do that? A newbee and just startet but my code looks like this:

import os from random import choice directory = 'D:\Johnny-3 Film 2018' files = os.listdir(directory) for i in range(100): movie = choice(files)

jhjorsal
  • 187
  • 2
  • 10

1 Answers1

1

You probably will need to use an external proram. You could use ffprobe or moviepy. There are many examples from similarly asked questions that I found from this stack overflow answer:

jkulskis
  • 124
  • 1
  • 4