#7 Bugfix: Replace illegal character with ' '.

This commit is contained in:
codezjx 2017-08-12 21:00:15 +08:00
parent d175c368e3
commit cd3d043d46
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
import re
import requests import requests
from ncm import config from ncm import config
@ -19,7 +20,7 @@ def download_song_by_song(song, download_folder, sub_folder=True):
# get song info # get song info
api = CloudApi() api = CloudApi()
song_id = song['id'] song_id = song['id']
song_name = song['name'].replace('/', '-') # Replace '/' with '-', open() method not support '/' yet! song_name = re.sub(r'[\\/:*?"<>|]', ' ', song['name']) # Replace illegal character with ' '
artist_name = song['artists'][0]['name'] artist_name = song['artists'][0]['name']
album_name = song['album']['name'] album_name = song['album']['name']