突然發現淘寶88vip到期後,網易雲音樂的下載音樂是ncm格式的,不能播放,做一下轉換

ncm 轉換 爲mp3, pip3 install ncmdump

from ncmdump import dump
import os
import fnmatch

print("如留空,默認: D:\\CloudMusic\\\VipSongsDownload\\")
download_folder = input("下載路徑:") or "D:\\CloudMusic\\\VipSongsDownload\\"
os.system('cls')
waiting = True
print("當前下載路徑:" + download_folder)
print("等待轉換...")


def all_files(root, patterns='*', single_level=False, yield_folder=False):
    patterns = patterns.split(';')
    for path, subdirs, files in os.walk(root):
        if yield_folder:
            files.extend(subdirs)
        files.sort()
        for fname in files:
            for pt in patterns:
                if fnmatch.fnmatch(fname, pt):
                    yield os.path.join(path, fname)
                    break
        if single_level:
            break


while 1:
    thefile = list(all_files(download_folder, '*.ncm'))
    print(thefile)
    for item in thefile:
        if (waiting == True):
            waiting = False
            os.system('cls')
        print(item, dump(item), "轉換成功!")
        delete = os.remove(item)
    break
View Code

python main.py, 轉換完成了, 想備份原來的ncm文件的,提前手動備份

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章