remove redundant code
This commit is contained in:
+2
-8
@@ -36,7 +36,6 @@ def normalize_audio_task(file_path):
|
|||||||
export_audio(normalized_audio, file_path, sr) # Save file
|
export_audio(normalized_audio, file_path, sr) # Save file
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeError(f"RuntimeError: {e}")
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
@@ -48,7 +47,6 @@ def trim_audio_task(file_path):
|
|||||||
export_audio(trimmed_audio, file_path, sr)
|
export_audio(trimmed_audio, file_path, sr)
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeError(f"RuntimeError: {e}")
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
@@ -60,7 +58,6 @@ def resample_audio_task(file_path, sr):
|
|||||||
export_audio(resampled_audio, file_path, sr)
|
export_audio(resampled_audio, file_path, sr)
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeError(f"RuntimeError: {e}")
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
@@ -110,13 +107,11 @@ def music_separation_task(file_path):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeError(f"Music source separation task failed: {e}")
|
return False
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def noisereduce_task(file_path):
|
def noisereduce_task(file_path):
|
||||||
"""Celery task to remov noise from audio"""
|
"""Celery task to remove noise from audio"""
|
||||||
file_path = Path(file_path)
|
file_path = Path(file_path)
|
||||||
|
|
||||||
# Run noisereduction
|
# Run noisereduction
|
||||||
@@ -124,5 +119,4 @@ def noisereduce_task(file_path):
|
|||||||
noisereduce(file_path, file_path)
|
noisereduce(file_path, file_path)
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise RuntimeError(f"Noise removal from audio failed")
|
|
||||||
return False
|
return False
|
||||||
Reference in New Issue
Block a user