pengdaqian commited on
Commit
7511e69
1 Parent(s): b41bb60
Files changed (2) hide show
  1. app.py +3 -3
  2. music/search.py +4 -4
app.py CHANGED
@@ -233,16 +233,16 @@ def svc_main(sid, input_audio):
233
 
234
 
235
  def auto_search(name):
236
- save_music_path = 'downloaded'
237
  if not os.path.exists(save_music_path):
238
  os.makedirs(save_music_path)
239
 
240
- config = {'logfilepath': 'musicdl.log', save_music_path: 'downloaded', 'search_size_per_source': 5, 'proxies': {}}
241
  save_path = os.path.join(save_music_path, name + '.mp3')
242
  # youtube
243
  task1 = threading.Thread(
244
  target=get_youtube,
245
- args=(name, save_path)
246
  )
247
  task1.start()
248
  task2 = threading.Thread(
 
233
 
234
 
235
  def auto_search(name):
236
+ save_music_path = '/tmp/downloaded'
237
  if not os.path.exists(save_music_path):
238
  os.makedirs(save_music_path)
239
 
240
+ config = {'logfilepath': 'musicdl.log', save_music_path: save_music_path, 'search_size_per_source': 5, 'proxies': {}}
241
  save_path = os.path.join(save_music_path, name + '.mp3')
242
  # youtube
243
  task1 = threading.Thread(
244
  target=get_youtube,
245
+ args=(name, os.path.join(save_music_path, name))
246
  )
247
  task1.start()
248
  task2 = threading.Thread(
music/search.py CHANGED
@@ -103,9 +103,9 @@ def download_youtube(info, save_path):
103
  def get_youtube(keywords, save_path):
104
  info = search_youtube(keywords)
105
  if info is None:
106
- return None
107
  else:
108
- return download_youtube(info, save_path)
109
 
110
 
111
  def get_albums(keywords, config):
@@ -164,5 +164,5 @@ if __name__ == '__main__':
164
  # config = {'logfilepath': 'musicdl.log', 'downloaded': 'downloaded', 'search_size_per_source': 5, 'proxies': {}}
165
  # infos = get_albums('李荣浩', config)
166
  # print(infos)
167
- info = search_youtube('李荣浩')
168
- download_youtube(info, "downloaded")
 
103
  def get_youtube(keywords, save_path):
104
  info = search_youtube(keywords)
105
  if info is None:
106
+ return
107
  else:
108
+ download_youtube(info, save_path)
109
 
110
 
111
  def get_albums(keywords, config):
 
164
  # config = {'logfilepath': 'musicdl.log', 'downloaded': 'downloaded', 'search_size_per_source': 5, 'proxies': {}}
165
  # infos = get_albums('李荣浩', config)
166
  # print(infos)
167
+ info = search_youtube('李荣浩 模特')
168
+ download_youtube(info, "downloaded/模特")