mirror of
https://github.com/Xevion/v1.xevion.dev.git
synced 2025-12-10 04:09:09 -06:00
updated delete method to attempt removal and procede on failure
still need a method to delete random files that get scattered in an attempted "conversion" attempt (these were left around when ffmpeg failed). also need further excepts based on FileNotExistsError, PermissionError etc.
This commit is contained in:
@@ -66,7 +66,11 @@ class YouTubeAudio(db.Model):
|
||||
return data if noConvert else json.dumps(data)
|
||||
|
||||
def delete(self):
|
||||
os.remove(os.path.join('app', 'sounds', 'youtube', self.filename))
|
||||
path = os.path.join('app', 'sounds', 'youtube', self.filename)
|
||||
try:
|
||||
os.remove(path)
|
||||
except:
|
||||
print(f'[{self.id}] Could not delete relevant file "{path}".')
|
||||
db.session.delete(self)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user