29 lines
562 B
Python
29 lines
562 B
Python
#! /bin/env python3
|
|
# encoding: utf-8
|
|
|
|
import os
|
|
import pathlib
|
|
|
|
# --------------------------------------------------
|
|
|
|
def parse_fps(raw):
|
|
if '/' in raw:
|
|
num, den = (int(x) for x in raw.split('/'))
|
|
|
|
return float(num) / float(den)
|
|
|
|
return float(raw)
|
|
|
|
# --------------------------------------------------
|
|
|
|
def to_Path(raw_path):
|
|
'''
|
|
Returns pathlib.Path pointing to raw_path, handling '~/' correctly.
|
|
|
|
To be removed after python:3.5 move.
|
|
'''
|
|
|
|
if raw_path.startswith('~'):
|
|
raw_path = os.path.expanduser(raw_path)
|
|
|
|
return pathlib.Path(raw_path)
|