[fixed] Sort by Size problem (1 Viewer)

greybox

MP Donator
  • Premium Supporter
  • January 23, 2009
    621
    132
    Home Country
    Canada Canada
    When I try to sort the video files by size, it doesn't always work. For example, see the attached screenshot: an 8GB file should never be in the middle of the list because this is the largest file in the folder. Try to change the order - same problem.

    You may also try to mix different extensions (avi, mkv, flv, vob) and different file size, expecially huge and tiny and you will see that the sort by size feature doesn't work properly. If I select "Sort by: Size", the feature should ignore anything else except for the file size.

    MediaPortal Version: MediaPortal 1.2.0 Beta
    MediaPortal Skin: Default Wide with MePo added and analog clock removed
    Windows Version: Windows 7 Ultimate
    CPU Type: Intel Core I7 2.8GHz
    HDD: WDC SATA-2 80GB; Samsung SATA2, 750GB; Blu Ray drive: LiteOn iHES108
    Memory: 4GB DDR3
    Motherboard: Asus P7P55D PRO
    Video Card: ASUS GeForce 9600GT Silent 650MHZ 512MB 1.8GHZ DDR3 PCI-E Dual DVI-I HDCP HDTV
    Video Card Driver: Latest
    Sound Card: IDT High Definition
    Sound Card AC3: Optical out
    Sound Card Driver: Latest
    1. TV Card: Hauppauge WinTV HVR-1800, PCIe
    1. TV Card Type: analog, ATSC
    1. TV Card Driver: Latest
    2. TV Card: Twinhan AD-SE200 (1028), PCIe
    2. TV Card Type: DVB-S
    2. TV Card Driver: Latest
    3. TV Card:
    3. TV Card Type:
    3. TV Card Driver:
    4. TV Card:
    4. TV Card Type:
    4. TV Card Driver:
    MPEG2 Video Codec:
    MPEG2 Audio Codec:
    h.264 Video Codec:
    Satelite/CableTV Provider: FTA/Cable/OTA
    HTPC Case: Custom
    Cooling:
    Power Supply:
    Remote: Universal, URC 200
    TV: Samsung 58" 1080p Plasma HDTV (PN58B530)
    TV - HTPC Connection: DVI/HDMI
     

    Attachments

    • Sort by Size problem.jpg
      Sort by Size problem.jpg
      89.8 KB

    elliottmc

    Retired Team Member
  • Premium Supporter
  • August 7, 2005
    14,927
    6,061
    Cardiff, UK
    Home Country
    United Kingdom United Kingdom
    As a follow-up, I tried to reproduce this on my system, and could not.

    However, most of my files are the same type and all are under 1GB.

    Looking at your screenshot, could it simply be that it is only using the number, and is ignoring MB or GB ?

    I have a folder of mixed .avi, .mkv and probably .mpg files under 1GB and they are sorted correctly.

    You'll have to provide more information I think.

    Mark
     

    greybox

    MP Donator
  • Premium Supporter
  • January 23, 2009
    621
    132
    Home Country
    Canada Canada
    My files are stored locally on same PC, so it is not a network share. I think in order to reproduce the problem you need to have a mixture of KB, MB and GB sized files. You might be right that the nature of the bug is that the program is simply ignoring KB/MB/GB. If you don't have a multiGB video file, maybe you can manually record a TV broadcast until it reaches the appropriate size. Then you can place the .ts files into My Videos folder and try.
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    Yup, correct. I also think that only numbers seen in the list are used for sorting.

    In your example:
    500 > 8 > 3

    which looks correct but add KB/MB/GB and it's clearly wrong :)


    It might also be that items are sorted by comparing complete strings from list, which is also wrong:

    "500 MB" > "8 GB" > "3 GB"



    Sorting by size should be always done using original size (bytes) not a display size :) There might be more places in application to check for this bug.
     

    Seidelin

    Retired Team Member
  • Premium Supporter
  • August 14, 2006
    1,755
    652
    Kgs. Lyngby
    Home Country
    Denmark Denmark
    /me thinks it is a 32 bit issue. Files over 4 GiB are probably sorted wrong.

    Edit: It's not. It is as SE tells. Sorted by strings...
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    On unrelated note: isn't the sort direction triangle wrong? I mean \/ is descending and /\ ascending, right? In MediaPortal is other way around :)
     

    Seidelin

    Retired Team Member
  • Premium Supporter
  • August 14, 2006
    1,755
    652
    Kgs. Lyngby
    Home Country
    Denmark Denmark
    My suggestion to resolve this issue would be to add a method like this:

    public static string GetTrueSize(long dwFileSize)
    {
    return string.Format("{D11}", dwFileSize);
    }

    This should return file size as a 0-padded 11 digit string. This string should then be sortable, me thinks...
     

    Users who are viewing this thread

    Top Bottom