Skip to content
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

Initial sorting for add-file-sort-dialog is not sorting correctly #86

Open
MojitoJoe1813 opened this issue Nov 28, 2024 · 2 comments
Open

Comments

@MojitoJoe1813
Copy link

MojitoJoe1813 commented Nov 28, 2024

I tried to add three different file formats in order to get an audiobook of 64 files into TeddyBench (latest version) locally (to transfer it to TeddyCloud): M4B, OGG and MP3

Apart from that M4B and OGG didn't create a proper taf-file (without any indication about the reason and me too upset about the sorting in order to report that issue as well) the sorting dialog is a pita:
For each file format the files got sorted by some unreasonable criteria and I had to sort them or manually edit their tags upfront , or , or, or. Also with the MP3-files - which all contain a correct ID3v2.3-Tag and a correct filename and get listed anywhere else in the correct order - TeddyBench isn't capable to show them in the right order initially when showing the sort-dialog:
TeddyBench-Sort

See the selected file which actually should be the second in the list - in case this dialog would use any comprehensible criteria!
The dialog is sorting somehow (as every second chapter of each episode is at the lower 32 items - but that sorting is nonsense according to the information shown in that dialog.

You might consider clicking any column-header shown in that dialog, however, cklicking does not have any effect, unfortunately.

These files get selected from top to bottom all at once from the windows explorer window which opens when you click "Add..." and which sorts them absolutely correct. The result in this teddybench sorting dialog is requesting me to move 32 files 31 times up each - ** hundreds of clicks for just 64 audio files** to get them into the right order. I don't think that should be requested from any user of any application ;-)

@MojitoJoe1813
Copy link
Author

I'm not able to work with C# code however, I assume some code changes like this could add some benefit/convenience to users:

private void lstTracks_ColumnClick(object sender, ColumnClickEventArgs e)
{
    int clickedColumnIndex = e.ColumnIndex;
    SortFileList(clickedColumnIndex);
    UpdateView();
}

private void SortFileList(int columnIndex)
{
    switch (columnIndex)
    {
        case 0: // Sort by filename
            FileList.Sort((x, y) => string.Compare(x.Item1, y.Item1));
            break;
        case 1: // Sort by ID3-Tag-Title
            FileList.Sort((x, y) =>
            {
                if (x.Item2?.Title == null) return 1;
                if (y.Item2?.Title == null) return -1;
                return string.Compare(x.Item2.Title, y.Item2.Title);
            });
            break;
    }
}

No guarantee that this code is completely correct but one dealing with that code should get what I'm after.

@MojitoJoe1813
Copy link
Author

I added a pull request which is addressing this issue: #87

Now, having dealt with the code, I can see the reason why the application was behaving like mentioned above. So it actually "works as designed" - even though very confusing for certain files (see the screenshot above). However, now with my pull request a user can actually see the criteria the list is ordered by (Track No.) as I added that data as another subitem to the list - with the current code base in master one couldn't see that.

The PR doesn't change the initial sorting when the dialog shows up - it is still the track no. But it introduces the opportunity (optional) to sort by the other columns (filename or ID3 Tag) simply by clicking the column header - or go back to sort by track no. again. This issue can be closed when the PR got merged or the functionality has been implemented in another way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant