forked from localhorst/media_management_scripts
Compare commits
1 Commits
allow-whit
...
dejavu-mac
Author | SHA1 | Date | |
---|---|---|---|
90a43e2491
|
@ -7,9 +7,11 @@
|
||||
"""
|
||||
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
import time
|
||||
import subprocess
|
||||
import shlex
|
||||
import shutil
|
||||
import glob
|
||||
import PIL
|
||||
@ -49,12 +51,17 @@ def get_codec(filename):
|
||||
return str(result.stdout.decode("utf-8")).rstrip("\n")
|
||||
|
||||
def extract_frame(video_file, time_offset, output_file):
|
||||
cmd = ["ffmpeg", "-y", "-ss", time.strftime('%H:%M:%S', time.gmtime(time_offset)) + ".00",
|
||||
"-i", str(video_file), "-frames:v", "1", str(output_file)]
|
||||
cmd = "ffmpeg -y -ss " + time.strftime('%H:%M:%S', time.gmtime(time_offset)) + ".00 -i " + str(video_file) + " -frames:v 1 " + str(output_file)
|
||||
devnull = open(os.devnull, 'w')
|
||||
subprocess.call(cmd, stdout=devnull, stderr=devnull)
|
||||
subprocess.call(shlex.split(cmd),stdout=devnull, stderr=devnull)
|
||||
|
||||
def get_font_path():
|
||||
if platform.system() == "Darwin":
|
||||
# Assume DejaVu to be installed in the user library
|
||||
path = "~/Library/Fonts/DejaVuSans-Bold.ttf"
|
||||
return os.path.expanduser(path)
|
||||
|
||||
# Default platform: Linux
|
||||
path = "/usr/share/fonts"
|
||||
files = glob.glob(path + "/**/DejaVuSans-Bold.ttf", recursive = True)
|
||||
return files[0]
|
||||
|
Reference in New Issue
Block a user