more sensible defaults

This commit is contained in:
Ville Rantanen
2021-12-07 21:10:18 +02:00
parent 1adebf7431
commit f6dbd78ffd

View File

@@ -4,9 +4,9 @@ import subprocess
import sys import sys
import os import os
import time import time
import parse
import argparse import argparse
import json import json
import fractions
from ansi.colour import fg, fx from ansi.colour import fg, fx
from datetime import datetime from datetime import datetime
@@ -106,7 +106,12 @@ Language: {tags-lang}""".format(
float(stream["r_frame_rate"].split("/")[0]) float(stream["r_frame_rate"].split("/")[0])
/ float(stream["r_frame_rate"].split("/")[1]) / float(stream["r_frame_rate"].split("/")[1])
) )
stream["display_aspect_ratio"] = stream.get("display_aspect_ratio", "NA") stream["display_aspect_ratio"] = stream.get(
"display_aspect_ratio",
str(
fractions.Fraction(int(stream["width"]), int(stream["height"]))
).replace("/", ":"),
)
msg = """{Y}==== Stream:{index} ===={z} msg = """{Y}==== Stream:{index} ===={z}
Type: {G}{codec_type}{z} Type: {G}{codec_type}{z}
Codec: {codec_long_name} ({codec_name}) Codec: {codec_long_name} ({codec_name})
@@ -122,12 +127,13 @@ Language: {tags-lang}""".format(
def format_audio(self, stream): def format_audio(self, stream):
stream["hrate"] = self._speedfmt(stream.get("bit_rate", 0)) stream["hrate"] = self._speedfmt(stream.get("bit_rate", 0))
stream["channel_layout"] = stream.get("channel_layout", "")
msg = """{Y}==== Stream:{index} ===={z} msg = """{Y}==== Stream:{index} ===={z}
Type: {G}{codec_type}{z} Type: {G}{codec_type}{z}
Codec: {codec_long_name} ({codec_name}) Codec: {codec_long_name} ({codec_name})
Bitrate: {hrate} Bitrate: {hrate}
Sample Rate: {sample_rate} Hz Sample Rate: {sample_rate} Hz
Channels: {channels} ({channel_layout})""".format( Channels: {channels} {channel_layout}""".format(
**stream **stream
) )