INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Is there a way to Sort Albums by the first digits?  (Read 757 times)

Hottuna

  • Recent member
  • *
  • Posts: 18
Is there a way to Sort Albums by the first digits?
« on: January 04, 2021, 10:10:55 am »

Just wondering how I can sort my albums based on the first digits of a numbered album rather than the actual value of the number

For example

I'd like these albums
10 from 6
16 of their Greatest Hits
19
1984

to appear before  these albums...
2nd Live
4 Way Street
9 Lives
 
Almost anything is possible in Media Center so I'm sure I'm just missing something.

Thanks
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2565
Re: Is there a way to Sort Albums by the first digits?
« Reply #1 on: January 04, 2021, 12:16:59 pm »

MC seems to always use Natural Sorting, which does precisely that - it recognizes numbers (at the beginning or middle of string, doesn't matter) and orders them numerically instead of alphabetically. This is usually a good thing for us Humans, as we prefer to see Rambo 10 listed after Rambo 9, not after Rambo 1.

There doesn't seem to be a way to turn that off. If you really need it, you can add a calculated Field (or expression column) with an expression that mangles the numbers of [Name] so that you can then sort by this new Field, alphabetically.

Unfortunately MC doesn't have Regex Replace function, so the expression gets silly. Here's one such silly solution:
Code: [Select]
replace(replace(replace(replace(replace(replace(replace(replace(replace(replace([Name],0,.a),1,.b),2,.c),3,.d),4,.e),5,.f),6,.g),7,.h),8,.i),9,.j)
The dots are not required, but they make sure that files starting with numbers appear before files starting with letters.
Logged

Hottuna

  • Recent member
  • *
  • Posts: 18
Re: Is there a way to Sort Albums by the first digits?
« Reply #2 on: January 04, 2021, 01:29:58 pm »

Thanks for the reply and for suggesting a solution.

Unless a better one comes up I may just spell out the numbered albums e.g. Nineteen Eighty Four, Ten from Six, Nine Zero One Two Five, etc., which could get ugly,  or add a custom field with the Album name and use some sort of numbering prefix to order the numbered albums.

Cheers
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2565
Re: Is there a way to Sort Albums by the first digits?
« Reply #3 on: January 04, 2021, 02:08:08 pm »

The idea is to use that ugly expression for sorting, but still display the normal [Name]. You don't need to have that other column visible.
Anyway, here's an identical expression that uses Unicode numbers as replacements so that it looks almost natural:

replace(replace(replace(replace(replace(replace(replace(replace(replace(replace([Name],0,0),1,1),2,2),3,3),4,4),5,5),6,6),7,7),8,8),9,9)

Note that 16 now comes after 1492. Rambo 10 will show before Rambo 2 though ;D


Nevermind. These chars confuse MC even more ;D
Logged

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Is there a way to Sort Albums by the first digits?
« Reply #4 on: January 04, 2021, 03:12:33 pm »

The way Zybex is giving you is perfectly good, but I'll offer an alternative.

Programmatic sorting methods often don't or can't account for every possible strange permutation of names, so it's nice to have an override, and MC allows for this. You'll be able to make any individual album sort wherever you want in one easy step.

You can start by creating a field called AlbumSortOverride, relational with one value per album. You don't need to put anything in this field to start with.

Now create a second custom field called AlbumSort, of type calculated data, with this expression:
FirstNotEmpty([AlbumSortOverride],[Album])

Next creating a sorting preset (google or look at this or this thread) using the AlbumSort field.  Use this Sort Preset to sort your view.

That might sound complicated, but it just takes a minute.

Now, when you enter a value into the AlbumSortOverride field for any track in the album, the album will be sorted by that value, not its normal [Album] field.  You could make "10 from 6" come after "Whitney Houston" in this way, simply by entering an appropriate value.  If you don't give an album an override value, it will be sorted normally.

Have fun.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2565
Re: Is there a way to Sort Albums by the first digits?
« Reply #5 on: January 04, 2021, 03:15:57 pm »

Yep, Wer's solution is more flexible. Even handles Rambo 10!
Logged

Hottuna

  • Recent member
  • *
  • Posts: 18
Re: Is there a way to Sort Albums by the first digits?
« Reply #6 on: January 04, 2021, 08:42:48 pm »

The way Zybex is giving you is perfectly good, but I'll offer an alternative.


Thanks! I gave your solution a try and I can see how that would help a lot to manually manage the album order without changing the Album field. The view I was hoping to display in my new sort order is an Album view however, and I couldn't find a way to display the actual album name in Album view in the order I want, but it solves the problem in File view.

Having said that I stumbled on a solution that is good enough for my purposes. By setting AlbumSortOrder to the first letter of the Album using =left([album],1) I was able to create a new Album view using the categories AlbumSortOrder and Album which display an Album view that basically shows an alphabet using AlbumSortOrder. From there I can drill down to see a sorted album view for each number/letter e.g. all the albums that start with a "1" are in 1 and all the ones that begin with a "2" are in 2 etc. Not perfect but it allows me to do what I need to do.

Thanks again.
Logged

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Is there a way to Sort Albums by the first digits?
« Reply #7 on: January 04, 2021, 09:15:27 pm »

The view I was hoping to display in my new sort order is an Album view however, and I couldn't find a way to display the actual album name in Album view in the order I want

We understood you were using an album view. Your comment makes no sense, as what I gave you does not change how the album name is displayed, only how it is sorted, and it works in Album view. You're either not executing correctly or not explaining yourself clearly.

Sounds like what you decided to do was have a top category just of alphabetic letters, so you could browse by that.  That's not what either Zybex or I read in your original question. You asked how to sort, not how to group. Many people have asked how to create "letter categories" to group by and a google search will show that has been asked and answered many times.

Anyway glad you're happy.  Have fun.
Logged

Hottuna

  • Recent member
  • *
  • Posts: 18
Re: Is there a way to Sort Albums by the first digits?
« Reply #8 on: January 04, 2021, 10:24:21 pm »

We understood you were using an album view.

OK, I wasn't sure that I made that clear in my initial post. The image that Zybex posted was a list, which made me wonder if that's why it didn't work in album view.

...and it works in Album view.

Good to know.

You're either not executing correctly or not explaining yourself clearly.

Well, I thought I followed the instructions. The links you provided to the presets were a bit confusing but I thought I figured it out. Maybe with some practice I'll get it right some day.

Sounds like what you decided to do was have a top category just of alphabetic letters, so you could browse by that.  That's not what either Zybex or I read in your original question. You asked how to sort, not how to group.

It's not what I was hoping for either but it's all I could get to work, so I settled. It doesn't work as well as I thought it did anyway, so I aborted it.

Many people have asked how to create "letter categories" to group by and a google search will show that has been asked and answered many times.

Uh-huh, wasn't looking for that so I didn't bother to Google it.

Anyway glad you're happy.  Have fun.

Well I'm not really but I'll get over it, after all, there are a lot of people in this world with real problems.

Logged

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Is there a way to Sort Albums by the first digits?
« Reply #9 on: January 04, 2021, 10:43:44 pm »

Ok well if you'd like to post screenshots of what you've achieved and what you're actually trying to do, maybe we can figure it out.  We can only try to answer the questions as we understand them.
Logged

Hottuna

  • Recent member
  • *
  • Posts: 18
Re: Is there a way to Sort Albums by the first digits?
« Reply #10 on: January 04, 2021, 11:47:48 pm »

We can only try to answer the questions as we understand them.

I get it, and I appreciate the help.

After going back over everything I figured out where it went wrong, it's working now. 

What I did after creating the fields as per your instructions:
1. I added the AlbumSortOverride field to the top of my tag list
2. Changed the list style in the Albums view to Details view (by clicking on the arrow beside the word Albums in the bar above the album thumbnails)
3. Added the AlbumSort and AlbumSortOverride columns
4. Sorted the list by AlbumSort (1) and Name (2)
5. Right-clicked on AlbumSort, selected Presets, select Save, select Enter Name, and gave the Preset the name AlbumSortPreset
6. I selected all the Albums that had a name starting with a "1", clicked on Tags, and entered a value of 10 into the AlbumSortOverride field
7. I repeated step 6 for album names starting with a "2" and entered a value of 20, and did the same for albums starting with "3" to "9" in increments of 10
8. I changed the list style back to Thumbnails and the albums were in the order I was looking for.

In retrospect, I'm not sure if the preset is required. I didn't need to enter it anywhere.

That was fun! :)
Time for bed. Good night.
Logged

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Is there a way to Sort Albums by the first digits?
« Reply #11 on: January 05, 2021, 12:34:51 am »

Ok I think I see where you went wrong... But you're making it harder for us by not providing screenshots. Some of your terminology is not standard/understood so I'm guessing a bit.  If what I'm saying below isn't on target, then you're going to have to post screenshots if you want help.

If by "tag list" you mean the categories list you get in the Customize View dialog box when you right-click on the name of a view in the tree and select Customize View, then no, that's wrong, you don't need to go in there at all.  If you added AlbumSort in there, take it out; that's counter-productive, and will make you see a field you don't want to see in your view.

Here's what you do:

Simply create the fields exactly as described.  Once the field are created, go to your regular default Albums view, the one that.

Now at the tab at the top of the window, just to the right of where it says Albums, there's a little downward pointing triangle. That's a menu. Pull it down, and one of the options you get is "Sort By..."

That is where you want to go.

Now go to Sort By -> Custom, and use the dialog box as you see in this screenshot:

to ADD the AlbumSort field.  Ignore the AlbumArtist and other fields you see in that screenshot, just put the [AlbumSort] field in tehre.This will give you the custom sort. You can save it as a named Sorting Preset by hitting the PRESET button and clicking SAVE.

You don't need to do any sorting of the file list down below. You want to leave that sorted normally by track.  By defining the sort order in the upper pane, where the thumbnails are, THAT is what will control the sorting for your albums.

I hope this is more clear.

Good luck.
Logged
Pages: [1]   Go Up