def get_milliseconds(t):
    """
    格式化时长字符串为毫秒（00:00:25.173 -> 毫秒数）

    :param t: 时长h:m:s或h:m:s.ms或m:s.ms格式字符串
    :returns: 毫秒数
    """
    millisecond = 0
    t = t.split('.')
    if len(t) > 1 and t[1].isdigit():
        millisecond += int(t[1])
    s = t[0].split(':')
    if len(s) == 3:
        millisecond += int(s[0]) * 60 * 60 * 1000
        millisecond += int(s[1]) * 60 * 1000
        millisecond += int(s[2]) * 1000
    elif len(s) == 2:
        millisecond += int(s[0]) * 60 * 1000
        millisecond += int(s[1]) * 1000
    return millisecond
