emericg / OpenSubtitlesDownload

Automatically find and download the right subtitles for your favorite videos!
https://emeric.io/OpenSubtitlesDownload
GNU General Public License v3.0
579 stars 63 forks source link

Selection Table sorts number alphabetically #81

Open GoulartNogueira opened 2 years ago

GoulartNogueira commented 2 years ago

When I run the script, a pop-up appears so I can select an option. There I can see the number of rating and downloads.

Problem:

When I click on a column header to sort that list, numbers sorted alphabetically:

10
2
300
4
500
51
6
75
...

Expected:

Numbers sorted numerically:

2
4
6
10
51
75
300
500
...

What I've tried:

            subtitlesItems += '"' + item['SubDownloadsCnt'] + '" '

Removing " from entry:

            subtitlesItems += ' ' + item['SubDownloadsCnt'] + ' '

Code works normally, but still sorted like numbers are string.

I believe it's something about zenity. But I'm not sure.

emericg commented 2 years ago

Indeed this doesn't seem to work. I tried a couple of things, including integer number, or real number with dots or comma to try and force zenity to handle them as numbers. I also try similar things directly in bash. If there is a solution to this problem, it isn't documented either...

JayKuswahey commented 1 year ago

Might it be an option to pad the numbers, so you can leave the type alone?

002
004
006
010
051
075
300
500

Can't code myself out of a paper bag though... :(

emericg commented 6 months ago

Ok I wanted to try padding the numbers as a workaround, but it looks like the latest zenity version doesn't even bother sorting the texts anymore, so...