-
Notifications
You must be signed in to change notification settings - Fork 8
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
Improve conditional profile #12
Improve conditional profile #12
Conversation
find is faster then match, especially when plain find is used. Plain find also prevents users from accidentally using any of the pattern matching.
The auto profile example is only an example. I like the first commit, and how the third commit moves the string that actually matters to the user closer to the beginning of the line with an assignment. Your URL check wouldn't work for memo, as it returns false on I don't want something even more complex in readme, and the URL check should be lax. Unrelated thought, maybe should add a keybind to manually log an entry for the current file, if someone wants to use it for bookmarks. I don't know how you use memo, curious to hear. |
As suggested in po5#12 (comment)
a0b57f8
to
2e08119
Compare
I've dropped the two profile thing and made the function a bit faster. So far I've been using memo mostly to open files that are in the same folder as a file I had open recently, instead of going there via the file manager. In that sense a sort of "recent directories" would actually be more useful then a "recent files" 😆, but it has also been useful for opening recent URLs without having to find them again on the web. |
You forgot to remove |
Paths to be excluded can be simply added to the list. That makes the profile more complicated, but user only have to adjust the list, so it's not so bad.
As suggested in po5#12 (comment)
2e08119
to
9f1d5b8
Compare
Oops that got accidentally dropped during the rebase, I wanted to keep it in to make it clear to users that this is a comma separated list (probably not obvious for people unfamiliar with lua).
Sounds like a good idea (and easy to implement). In that case they would permanently have Edit: Random thought, but a "recent folders" would work well for continuing e.g. TV Shows, as the episodes themselves don't always have descriptive names (e.g. "Episode 1.mp4", but from which show?). |
tomasklaen/uosc@f857d46 reminded me that magnet links start with a query string we can match against.
I don't think it's possible without introducing reliability or privacy issues, see #7. The only thing that could fit the current model would be hiding the entry, but it can't be erased from the actual history file.
Then a user with files named for Plex comes along and says "Cool Show/Season 01/Episode 01.mp4" only shows the season. This kind of issue is why |
The check could actually be quite simple, no need for text distances. Assuming a directory structure like local shows = {}
for file in recent_files do
local season_path, filename = utils.split_path(file.path)
if season_path:find(".+/Season %d+$") then
local show_path, season = utils.split_path(season_path)
local _, show_name = utils.split_path(show_path)
shows[#shows + 1] = { label = show_name, file = file}
end
end Obviously I didn't actually look at your code to see if that fits your data structures, but that should be able to share pretty much all the code paths with the regular menu, the only difference being the filtering at the beginning.
While that would technically work, I imagine that would end up being pretty bad ux. |
I have used the method with two profiles for a while now and it works fine, but I wanted the ability to exclude multiple paths with that method, and this is the result of that. It's probably quite a bit slower then before, but that shouldn't cause any problems.
Better support for URLs would also be great, but we'd have to add an URL check for that.
URLs actually already work, but are treated as relative paths, so the working-directory gets prefixed, which might result in false positives. I could port my URL-check from quality-menu if you think that's worth it.