Sagnac / streamsave

mpv script aimed at saving live streams and clipping online videos without encoding.
94 stars 4 forks source link

Title file/stream name as a variable #12

Closed brian6932 closed 9 months ago

brian6932 commented 10 months ago

Imo this should kinda match the way screenshot-template works in mpv.conf, with %F/%f as the filename, so for example in streamsave.conf you'd have something like force_title=streamsave_%F

Sagnac commented 10 months ago

mpv's approach is definitely more flexible, but supporting all of those specifiers might take a significant amount of work and add complexity so I'm a bit hesitant on trying to mirror it.

There does seem to be a simple way of supporting what you want using property expansion, however, so you could specify force_title=streamsave_${media-title}. Adding support for this should be fairly straightforward and it would also allow splicing in / interpolating other property values if desired so it would be a definite improvement at a trivial cost.

brian6932 commented 10 months ago

Yea that's fine

Sagnac commented 10 months ago

Pushed to the dev branch. I still need to test a few things and make sure I didn't miss anything before I merge it into master and release, but it should work.

brian6932 commented 10 months ago

When the URL's very long, streamsave seems to fail to create the file, probably due to an OS path length error, should prob be trunc-ed with room to account for the file extension.

Sagnac commented 10 months ago

Yeah, there are currently no checks on the file name length and since we're concatenating the save path and the title the final path could be very long in some cases. I've been meaning to address this for some time, but never got around to it since I assumed it was relatively rare.

I've gone ahead and created a new issue for that as it might be some time before I can get to it. I'm a bit busy at the moment and I also want to perform some slight refactoring and maintenance on this script so this next release might take a while.

I think I'm going to leave this issue open until I merge the property expansion commit into master, since that still requires some changes in order to have it working properly with all labels.

If you have other issues, suggestions, feature requests, etc. feel free to post separate issues so I can address them one-by-one since that makes things easier to track. Thanks for reporting these things.