• 1


    歌词解析

    s = '''[ti:蓝莲花]
    [ar:许巍]
    [al:留声十年绝版青春北京演唱会]
    [00:-01.70]蓝莲花
    [00:-00.70]演唱:许巍
    [00:00.00]
    [00:00.70]没有什么能够阻挡
    [00:06.01]你对自由的向往
    [00:11.43]天马行空的生涯
    [00:16.99]你的心了无牵挂
    [00:21.20]
    [02:11.55][01:50.60][00:22.63]穿过幽暗的岁月
    [02:16.93][01:55.60][00:27.81]也曾感到彷徨
    [02:22.21][02:01.09][00:33.13]当你低头的瞬间
    [02:27.62][02:06.33][00:38.32]才发觉脚下的路
    [02:31.64][02:10.23][00:42.37]
    [02:32.97][00:43.79]心中那自由的世界
    [02:38.23][00:49.50]如此的清澈高远
    [02:43.30][00:54.31]盛开着永不凋零
    [02:47.70][00:58.50]蓝莲花
    [02:53.95][03:00.06][01:05.41]'''

    lrc_dict = {}
    song_dict ={}
    song1 = s.splitlines()
    for song2 in song1:
    # print(song2)
    if song2[1].isdecimal():
    song3 = song2.split(']')
    # print(song3)
    lrc_xinxi = song3[-1]
    # print(lrc_xinxi)
    lrc_shijian = song3[:-1]
    for lrc_shijian1 in lrc_shijian:
    # print(lrc_shijian1)
    lrc_shijian2 = lrc_shijian1[1:]
    # print(lrc_shijian2)
    lrc_shijian3 = lrc_shijian2.split(':')[0]
    lrc_shijian4 = lrc_shijian2.split(':')[-1]
    # print(lrc_shijian3)
    # print(lrc_shijian4)
    lrc_shijian5 = float(lrc_shijian3)*60+float(lrc_shijian4)
    # print(lrc_shijian5)
    lrc_dict[lrc_shijian5] = lrc_xinxi
    else:
    song4 = song2[1:-1]
    # print(song4)
    song5 = song4.split(':')
    # print(song5)
    if 'ti' == song5[0]:
    song_dict['歌名'] = song5[-1]
    elif 'ar' == song5[0]:
    song_dict['歌手'] = song5[-1]
    elif 'al' == song5[0]:
    song_dict['地点'] = song5[-1]
    # print(song_dict)
    lrc_time_list = list(lrc_dict)
    lrc_time_list.sort(reverse=True)
    # print(lrc_time_list[-1])

    def cha_lrc(t):
    for s in lrc_time_list:
    if t>=s:
    return lrc_dict.get(s)
    return lrc_dict[lrc_time_list[-1]]

    import time
    import os

    t= -2
    lrc99 = None
    while True:
    lrc100 = cha_lrc(t)
    if lrc99 != lrc100:
    os.system('cls')
    print(lrc100)
    lrc99 = lrc100
    t += 0.5
    time.sleep(0.5)
  • 相关阅读:
    内存溢出OutOfMemory
    系统问题定位
    final域的内存语义
    volatile内存语义
    锁的内存语义
    happens-before
    python 安装brew(国内的自动安装)
    【Mac】点击dmg文件后无反应,解决方案
    Mac----xmind 8 下载与破解方法
    面试中可向HR 提的问题总结?
  • 原文地址:https://www.cnblogs.com/wenjiangtao/p/10443894.html
Copyright © 2020-2023  润新知