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
option: add --watch-later-blacklist-properties option #8213
Conversation
I'd prefer the term "blacklist" here (is this not hip anymore?) personally. Seems clearer.
Yes. |
Wow, didn't know I'm at least the 3rd attempt. If I read it correctly, @wnoun wants to always write the value, but ignore when reading, which is what #6541 did, but @ghost (a deleted account?) wants the not write to begin with, which is what this PR and #6373 did? So which direction are we proceeding? What is the benefit of having those properties in the watch-later but not using them? I can see the argument be because user could change his mind and remove this new option, he can get them back. Counter argument would be it complicates already complex logic of processing options at read time. I'm OK either way.
Will do once settled. |
Yeah, it's a little strange that this never got implemented.
I would greatly argue in favor of simply not writing the properties to begin with. It's much cleaner. |
Question: in Does this mean the property values from If that's true, can't we move the |
There's no need to worry about it here. |
It was also wm4's favored approach judging from his comment on @jgreco's PR (/pull/6373). Seems to make the most sense from my layman perspective. |
Ah, I misunderstood what "defaults" meant. They needed to call Updated to address comments.
Who is wm4? ghost? Why is his account deleted? |
ugh, yes he is the |
Start to know mpv last Friday ;-) Also let me know or feel free to change if the option name is too long or verbose. |
Seems reasonable. The |
Squashed. One more question: like you said, the list of properties is large, and can change over time. How does user know what properties are available for this option? I'd love to include a permalink to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think what properties actually get saved in watch_later
are documented anywhere. Perhaps it should be but no need to worry about it here. Anyways LGTM.
OK. Can any of you merge? I'm new I don't have access. Thanks. |
@garoto @Dudemanguy What's going on? Nobody can merge this? Why is this approved but no action? Is there something I need to do at this point? |
it will be merged when it's merged. please don't get impatient. |
Also FYI, responses are generally much better on IRC, so if you want to ping on a PR or patch set, I'd recommend joining the IRC channel if possible. I did find some things about this patch set and am in process of reviewing it. Currently checking what is the seemingly least bad way of handling this, as I did get some ideas from some of the d3d11 option addition which I did quite some time ago. |
I apologize. I thought there was something I'm supposed to do and I forgot. I'm not in a rush or pushy, just wondering what's going on. Feel free to change anything to your liking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, sorry for taking a sweet time, kind of been a tiring month+. There are some general comments which touch upon the code, as well as a somewhat larger idea on how to make this feel a bit less bad :) .
So, my main issue where my brain would just not like this was the constant looping over the blacklist. Not to mention the loop being within the semi-complex property writing loop already :) Thus an idea sparked out.
- Make the list of strings a list of structs.
- Have the struct contain a flag
skip_writing
. - In the best case we'd register for updates for that option, but I think for now even calling a function that first resets everything to "don't skip" first, and then goes through the set values would be quite nice in the beginnings of
mp_write_watch_later_conf
(since those are usually the shorter list of strings). Warn in case of unknown properties being set. - Instead of looping through properties that are set to be skipped in the loop going over the properties, just...
for (int i = 0; backup_properties[i].name; i++) { if (backup_properties[i].skip_writing) { continue; } }
- ???
- Profit.
The first bit of this idea to just show how possible it is can be seen in jeeb@4daccf7 . How does something like that sound? It would nicely separate the parsing of the option from the looping and writing.
Alternatively one could just make a dynamic list a la the char * allocation in mp_get_resume_defaults
, and only add to that list things that are actually requested, but that is somewhat more complex :P .
Also the special value of all
is making this harder than it should be, you could just make it a separate bool and if that is set, early exit. Although watch-later-skip-properties
VS watch-later-skip-all-properties
kind of naming/split is kind of meh, I do agree.
P.S. This sort of string-matching stuff kind of makes me wish we had a hash map here somewhere :/ (and we probably do, and I just don't know about it).
player/configfiles.c
Outdated
for (int n = 0; opts->watch_later_blacklist_properties[n]; n++) { | ||
const char *opt = opts->watch_later_blacklist_properties[n]; | ||
if (opt[0]) { | ||
if (strcmp(opt, "all") == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, strcmp completely ignores the length of strings, just if the initial bit matches or not.
I think there's two ways around this:
strncmp
, and set the length of the string that's being checked against, (in this case it'd be3
for "all", or in case of dynamic variablesstrlen
).- Using the
bstr
string wrapper. Really nice if you get into it, seemisc/bstr.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String literals are always null-terminated, so strcmp
will behave as strncmp(... , 3)
, which is safe. Plus the "else" part is pretty much the same and needs strcmp
anyway. Plus there are other cases strncmp
is worse when used on literals (e.g. if the string is long and developer miscount the length, or if the literal is changed in a future patch and the person forgot to update the length).
I did a quick search and found https://stackoverflow.com/questions/448563/am-i-correct-that-strcmp-is-equivalent-and-safe-for-literals. I'm sure this must have been discussed many times.
I'm OK either way. If you want to take over the PR, feel free to do so. I just want to see this happen. But either way, it is gonna be a O(m * n) loop without hash map or sorting.
How? Just loop the input array to find "all" first. Ideally if people use "all", that should be the only value, so O(1). Worst case would be O(n), not making the whole run time worse.
I don't think this feature warrant two options, let alone two options with very similar names.
I mostly copied the handling of So let me know what do you want to do (or want me to do). |
Brace yourselves, thread was posted to entitled twats in r/linux. Shitfest is a bit of an understatement. |
This option allows user to blacklist specific backup properties for watch-later feature. The special value "all" blacklists all properties.
@jeeb After cleanup with your suggestion, it doesn't look bad now. Like I said, without hashmap or sorting, there will be a nested loop, either before the main logic or inside the main loop. However, my version avoid changing the data structure of Would you consider OK if I leave a comment saying if more metadata are associated with these backup properties, we should retrospectively change the data structure and loop. But for now let's leave as is? |
what I want is an option like |
I wished it started as a configurable option as you said. However, to change it now means
|
for list options, we have the
No, the the option default should depend on its usage and suitable for most people, the |
I didn't notice that suffix until now. I'm OK either way. I don't know how to proceed with this PR. If I change the design, will you (@wnoun) review it? Otherwise the other folks might not like that design and this PR will never go anywhere. |
the problem is how to implement it. one possible implementation is to save the key-value list of properties and their default values to |
I think the biggest problem is that this conversation even exist. I created this PR more than a month ago. And we still haven't figure out how to implement a small and seemingly normal feature. It is very discouraging, at least to me, to want to contribute anymore to this project. Who is the leader figure of this project? According to garoto, wm4 was once the leader but no longer. So who is going to decide how a feature is implemented and give shipit? The oldest open PR is dated March 2018, and I don't know how many were closed due to lack of activity. Akimi said "it will be merged when it's merged", which is true but also a meaningless tautology. wnoun, I actually like your redesign idea on this feature better, but where were you for the last 29 days when the previous design was discussed? And where are @Dudemanguy and @jeeb now who agreed on the previous design? Shouldn't these design questions be sorted out by you guys who have authority on the project's direction/future/path? jeeb recommended to use IRC, but the project is hosted here in GitHub. So no member of the project ever browse the list of pending PRs unless getting pinged? If any of you is interested to push through this, be my guest. I'm done with it. |
I'm sorry you feel this way, but mpv is a purely volunteer project run on member's free time. We don't have any sort of formalities, deadlines, schedules or anything like that. Different projects have different rules, but I do not believe a month of waiting is a particularly long time. Also, it is out of line to attack wnoun who is not a member of the project. |
Oh, I meant absolutely no offense to wnoun, or any of you. I'm sorry if I chose wrong words or bad syntax. I'm not native English speaker. Let me explain more. I just feel this form of project management is not friendly to an "outsider". Of course anyone could have their opinion, but then who should I listen to? If all of you folks are on equal, and everyone thinks his idea has sound ground, then there won't be progress. If I'm "insider", I'll just choose an approach and do it despite of some objection. But I'm not. Also, considering features this small that takes only 5 minutes to write and maybe 5 minutes to review, I don't think a month is a good turnaround period, not to mention we are not even close to be done here. I'm not an expert on this, but I think the parallel here is Python vs Linux. After Guido's "departure" from Python, many feel Python lost it's spirit. Many think Python is too rigid on being a "reference implementation" and fear of adopting new features. Whereas for Linux kernel, Linus' presence plays an important role on the project's general direction and path, despite the existence of the Linux kernel community. |
This option allows user to skip backing up specific properties for watch later feature. The "all" special value skips all properties.
I chose to do "skipping" to preserve backward compatibility. Let me know if the opposite is desired.
Since the list of properties is fixed and fairly short, I don't think it is worth sorting or using hash set to accelerate the lookup.
Do I also need to update documentation?
Related issue: #4641