Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSON-based transaction log support #746

Open
krafs opened this issue Sep 26, 2023 · 8 comments
Open

Add JSON-based transaction log support #746

krafs opened this issue Sep 26, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@krafs
Copy link

krafs commented Sep 26, 2023

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?

@jmbannon
Copy link
Owner

Inside the download archive file is the best place

@jmbannon jmbannon added the question Further information is requested label Sep 26, 2023
@krafs
Copy link
Author

krafs commented Sep 26, 2023

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 :)

@jmbannon
Copy link
Owner

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

@krafs
Copy link
Author

krafs commented Sep 27, 2023

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.

@jmbannon
Copy link
Owner

A json transaction log is a great idea. Going to repurpose this issue for that

@jmbannon jmbannon changed the title List of created files Add JSON-based transaction log support Sep 27, 2023
@jmbannon jmbannon added enhancement New feature or request and removed question Further information is requested labels Sep 27, 2023
@krafs
Copy link
Author

krafs commented Sep 27, 2023

Nice! Do let me know if there's anything I can help with. Otherwise, I'm looking forward to testing it.

@jmbannon
Copy link
Owner

If you're python-savvy, a PR would be appreciated 😉 probably won't get to this for a while as it's low on my priority list

@krafs
Copy link
Author

krafs commented Sep 27, 2023

I'm generally more in the C# camp, but I might take a look :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants