Closed kodxana closed 3 years ago
I wonder if there is a way to do this via the API https://lbry.tech/api/sdk#file_delete
Maybe just check
lbrynet file list --completed=false
If it is not in this list, then we can assume the blob files are generated. I could not find a way to remove the file using the lbry API without also removing the blob files.
From my testing, if a file gets deleted before it has downloaded all the blobs, the file will be just be recreated.
I do not see the harm in simply deleting all the files each time the script is run.
If that causes problems then something like this might be the solution
def clean_downloads(videos):
for video in videos:
if video['blobs_remaining'] == '0':
path = '/home/lbrynet/'
subprocess.call("rm " + path + video['metadata']['source']['name'], shell=True)
For now, just delete the downloads folder. I did a few tests and it does not seem to break anything.
https://github.com/tuxfoo/lbry-seedit/commit/7d9c615494dd083fed7a45e40126c2707ca94cc5
Delete Downloads folder after blob files gets created :)