ytdl-sub
ytdl-sub copied to clipboard
Add JSON-based transaction log support
Is there a programmatically reliable way to find out what files a particular command (sub/dl) created?
The transaction log is nice, but it's meant for a human to read, not a machine. Unless I'm missing something?
Inside the download archive file is the best place
Hmm, hadn't though about that.
But the archive is only generated for sub
-commands, it seems. Not on dl
's (where I was actually most needing it).
The idea was to run ytdl-sub dl
and then capture the paths of the created files and delete them automatically after a given amount of time. This is all taken care of with subscriptions, because the delete-after-a-certain-time is built in, but with dl
's I think I need to fix something myself, right?
I'm not asking you to add a way of doing this (it feels like a niche feature), but if you come up with a more reliable way than regexing the transaction log and hoping for the best - feel free let me know!
Either way - thanks for the help! Keep up the good work :)
I see, yeah regexing is probably your best bet at this time. What is the use-case for deleting after dl?
Another idea is to delete based off of mtime
I have a custom web server running alongside ytdl-sub in a container. The webserver takes HTTP calls and invokes ytdl-sub dl
for videos that aren't part of my subscriptions, but that I want to download and have a look at. I don't want to keep those videos around, and don't want to have to manually clean up. Currently, I just have a hardcoded clean-process running every night, that just removes all files in a temp-videos folder. But I wanted to try and see if I could generalize it, and be able to send in a timespan value along with the HTTP request that represents the amount of time I want to keep the files before deleting.
And this is where being able to get the exact files created by ytdl-sub would be useful :)
Have you given any thought to making the regular log/transaction log structured? Or an option to have it structured? A lot of CLI applications have options like --output-as-json
or similar. That way it could adhere to a set schema.
A json transaction log is a great idea. Going to repurpose this issue for that
Nice! Do let me know if there's anything I can help with. Otherwise, I'm looking forward to testing it.
If you're python-savvy, a PR would be appreciated :wink: probably won't get to this for a while as it's low on my priority list
I'm generally more in the C# camp, but I might take a look :)