-
Notifications
You must be signed in to change notification settings - Fork 15
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
trackma > fzf gets cutoff in small terminal sizes #44
Comments
Hmm,
So if I remove the LINES and COLUMNS I get the trackma default, which can still be too wide. As such the COLUMN has to be changed manually, but you see... then it looks kinda cramped on bigger terminal sizes. I like your approach to change how the output looks like in the first place, though this will also require changes in other places like process_list, frece, and exception checking (some anime have . at the end of their names). If you are capable, please make a PR; I might look into this as well. So you know, I have opened an issue on trackma side: z411/trackma#660 |
Most certainly the I am not opposed to the idea of processing the trackma output before sending in to fzf as in your previous example. If we do this then the process_list function has to change. So it will be more like:
or even
Like in your example. Just that in this case process_list simply has to change.
This processing should also take in consideration the exceptions array. Alternatively we could take inspiration from this: https://github.com/justchokingaround/trackma-wrapper.
Initially I was against this as trackma can be rather slow in my experience. Not sure why, maybe python. Pre-caching the info also kinda doesn't work on larger lists, as the initial creation will be very very slow. I personally think a combination of this 2 things can be the solution to this issue. |
I will have to test this for things such as:
As per your last comment, it fails decimal scores, ? number of last episodes too: |
I have a much better idea.
As such I can do something like this (keep color) with awk:
I just need to use printf align with awk |
Consider the following: trackma -a 1 list | head -n -2 | tail -n +2 >> /tmp/trackma Then: cat /tmp/trackma | perl -pe 's/^.+?[^\s]\s+(.+?(?=\.\.))\.+\ +(\d+).[^\d]\ (\d+|\?)\s+(\d*[.]?\d+).+$/\1|\2|\3|\4|/g' | awk -F'|' '{printf "@%s",NR-1} {printf "%8s - %-5s",$2,$3} {printf " %-6s %s\n",$4,$1}' |
Your perl is broking some of the entries, my tmp/trackma: trackma output| 1 3D Kanojo: Real Girl........................... 12 / 12 5 | perl output:3D Kanojo: Real Girl|12|12|5| |
Ah yes, that isn't my perl regex, but instead the trackma output getting cutoff. |
Try using COLUMNS. Why indexing from 0 when can from 1? |
Yeah the NR-1 was just a copy paste. Don't worry I have fixed it. |
for #44 the regex works in most cases; if trackma output is smaller than anime title then issues arise > COLUMNS=250 tested this new code with `adl -fgr` and `adl -fgr -l` and also with `-q "completed` at this point I just don't remember what the 318-323 block was for... seems fine in testing
@Darukutsu test this new branch. Does work on pretty small size, but you know, the choices and animdl outputs can be an issue: |
As my code needs the process_list() {
perl -pe "s/\x1b\[[0-9;]*m//g ; s/${regex}/g"
}
fzf_process_list() {
perl -pe "s/${regex}/g" |\
awk -F'|' '{printf "%-2s",NR} {printf "%6s - %-5s",$2,$3} {printf " %-6s %s\n",$4,$1}'
# print columns in the format INDEX CURRENT - LAST SCORE TITLE with proper padding
}
get_entry() {
debug_print "get_entry()"
fzf_selection="$(echo "$tlist" | fzf_process_list | fzf_select )"
# now get the line number from selection
line_nr=$(echo "$fzf_selection" | awk '{print $1}')
# find the entry from tlist that has that number so we have the expected |||| format
entry="$(echo "$tlist" | sed -n "$line_nr p" | process_list)"
present=""
debug_print_vars "fzf_selection" "line_nr" "entry"
} Basically after you pick something, I am going through trackma output again (tlist) find the corresponding index line and process it as before. |
|
I fixed the |
For
Considering a format like so it has to print just the titles
|
I have fixed the issues. |
The query changing seems to have been broken from before. Fixed now. Does the awk change look better in your opinion? Or you have another reason? |
The script has become rather complex so even I forget some functions 😅 |
Anyhow, I will close this issue for now. If you find anything broken please reopen. |
I will make the change. |
@Baitinq if you like test this new branch. |
for #44 the regex works in most cases; if trackma output is smaller than anime title then issues arise > COLUMNS=250 tested this new code with `adl -fgr` and `adl -fgr -l` and also with `-q "completed` at this point I just don't remember what the 318-323 block was for... seems fine in testing
When having smaller sizes of terminal, output is not properly displayed due to its length. Maybe getting rid of excess dots or switching position of elements...
I didn't read through the whole code, this will break scraping.
Some of the ideas:
Or maybe come with other solutions since
trackma
is displaying list correctly with any sizes:I don't think it's important at all. I personally like trackma style.
The text was updated successfully, but these errors were encountered: