Sort songs list by length

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Viisbyxa
    FFR Veteran
    • Jul 2012
    • 358

    #1

    Sort songs list by length

    For a while it's been bothering me that the song list can't be sorted by difficulty, both for consistency and because sometimes I want to find the longest or shortest songs. Now that I know JavaScript, I would be very happy to write the code for it if I could see where the rest of the sorting is. Couldn't find it with the Chrome dev tools.
    Two-handed alt (now main) account of Bobogoobo

    Best AAAs: Gacha Gacha Cute Figu atto Mate [56], Song of the second moon [52], Musicmaker RX [52], Wish (Reprise) [51], Nyanyanyanyanyanyanya! [51], Exogenesis [51]
    Quest for Scarhand: 3+ blackflags on Pure In Asia, blackflag on Iced Innocence
    2020 update: all of these got bumped up 4 (rip Scarhand unlock), rusty, new AAA Power Rocket [56?]
    2021 semiannual return: Connect (HOUSE SOUL REMIX) [57] (was blackflag from 2013), second blackflag on Call Upon the Seaponies; 2023: Polar 240 [56]
    BFs: 127 and counting (as of 2013-11-10)
  • Viisbyxa
    FFR Veteran
    • Jul 2012
    • 358

    #2
    Re: Sort songs list by length

    While I'm here, is there a reason that styles don't apply to the block for regular tokens?
    Two-handed alt (now main) account of Bobogoobo

    Best AAAs: Gacha Gacha Cute Figu atto Mate [56], Song of the second moon [52], Musicmaker RX [52], Wish (Reprise) [51], Nyanyanyanyanyanyanya! [51], Exogenesis [51]
    Quest for Scarhand: 3+ blackflags on Pure In Asia, blackflag on Iced Innocence
    2020 update: all of these got bumped up 4 (rip Scarhand unlock), rusty, new AAA Power Rocket [56?]
    2021 semiannual return: Connect (HOUSE SOUL REMIX) [57] (was blackflag from 2013), second blackflag on Call Upon the Seaponies; 2023: Polar 240 [56]
    BFs: 127 and counting (as of 2013-11-10)

    Comment

    • bmah
      shots FIRED
      Profile Moderator
      FFR Simfile Author
      Global Moderator
      • Oct 2003
      • 8448

      #3
      Re: Sort songs list by length

      Because time has to be represented by a colon (:), songs cannot be sorted by length. On a similar note, sorting it through a numerical value of seconds would be equally meaningless.
      Last edited by bmah; 06-22-2013, 01:58 AM.

      Comment

      • TheSaxRunner05
        The Doctor
        • Apr 2006
        • 6144

        #4
        Re: Sort songs list by length

        I thought there was a thread awhile back that had all that info, as well as listings for highest max NPS, note totals, most time without a step in a song, and stuff like that too.


        Comment

        • Viisbyxa
          FFR Veteran
          • Jul 2012
          • 358

          #5
          Re: Sort songs list by length

          "Cannot" is a strong word. It should be fairly simple to do even without jQuery, by, as you said, converting it to a value of seconds (though I'm pretty sure sorting it as a string would work similarly except for songs longer than ten minutes, which is what, two songs?). How would that be meaningless? Yes, there is a thread for that information, but being able to sort the song list, which is always up to date and more convenient, would be better. Plus, as I said, I don't like it being the only unsortable column for no reason.
          Two-handed alt (now main) account of Bobogoobo

          Best AAAs: Gacha Gacha Cute Figu atto Mate [56], Song of the second moon [52], Musicmaker RX [52], Wish (Reprise) [51], Nyanyanyanyanyanyanya! [51], Exogenesis [51]
          Quest for Scarhand: 3+ blackflags on Pure In Asia, blackflag on Iced Innocence
          2020 update: all of these got bumped up 4 (rip Scarhand unlock), rusty, new AAA Power Rocket [56?]
          2021 semiannual return: Connect (HOUSE SOUL REMIX) [57] (was blackflag from 2013), second blackflag on Call Upon the Seaponies; 2023: Polar 240 [56]
          BFs: 127 and counting (as of 2013-11-10)

          Comment

          • Doug31
            Falcon Paaaauuuunch!!!!!!
            FFR Simfile Author
            • Jun 2004
            • 6811

            #6
            Re: Sort songs list by length

            But it's a problem for songs more than 1 minute. In most languages it would be simple but I assume flash isn't good at handling such things. There is such a thread for it, but it's from when there were only about 500 songs. If only it were something like Java you could just tostring all the times and then split the strings back up to get the information from them. Or you could just change all the times of the songs to just be in seconds and have the stuff with the colon be a calculated field, but I assume it's probably too late to realistically make that kind of change. I don't think there's any easy way it can be done.

            Comment

            • bmah
              shots FIRED
              Profile Moderator
              FFR Simfile Author
              Global Moderator
              • Oct 2003
              • 8448

              #7
              Re: Sort songs list by length

              Originally posted by Viisbyxa
              converting it to a value of seconds (though I'm pretty sure sorting it as a string would work similarly except for songs longer than ten minutes, which is what, two songs?). How would that be meaningless?
              I honestly would like to know that a song is 2:34 and not 154 seconds. Just for sake of standard representation. I can't get a lot of context from 342 seconds worth of music, other than it's probably long to some degree.

              I wonder if there's a way to sort by seconds, and then convert that value into the more conventional time as shown with a colon.

              Comment

              • Viisbyxa
                FFR Veteran
                • Jul 2012
                • 358

                #8
                Re: Sort songs list by length

                I linked to the page I was talking about in my first post; it's nothing about in-game information. And I meant that in the JavaScript code that does the sorting, it would internally convert to a seconds value and use that for sorting. I'll just go write the code, though it'll use jQuery and would need adjustment to work without it, which I can do if you'd like to implement this on the page (though I assume incorporating it into existing code would be more efficient). Though it probably wouldn't be terrible to import jQuery for this one page.

                Well, I'm not done yet, but here's a preview. Go to Chrome's JS console (Ctrl+Shift+J) and paste this code, then click the Length header.
                Code:
                (function() {
                   var head= document.getElementsByTagName('head')[0];
                   var script= document.createElement('script');
                   script.type= 'text/javascript';
                   script.src= 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js';
                   head.appendChild(script);
                }());
                
                $(document).ready(function() {
                    $('table:first tr:first th:nth-child(7)').replaceWith('<th id="lengthSort" nowrap><a>Length</a></th>');
                    $('#lengthSort').css({'color':'#4A84B5', 'cursor':'pointer'}).on('click', function() {
                        var rows = $('table:first tr').toArray(), rowsString = '';
                
                        rows.shift();
                        rows.sort(function(a, b) {
                            var time1 = $(a).children('td:nth-child(7)').text().split(':'),
                            time2 = $(b).children('td:nth-child(7)').text().split(':');
                        
                            time1 = time1[0] * 60 + time1[1] * 1;
                            time2 = time2[0] * 60 + time2[1] * 1;
                
                            return time1 - time2;
                        });
                
                        for (var i = 0; i < rows.length; i++) {
                            rowsString += $(rows[i])[0].outerHTML;
                        }
                
                        $('table:first').replaceWith('<table width="770">' + $('table:first tr:first')[0].outerHTML + rowsString + '</table>');
                    });
                });
                Last edited by Viisbyxa; 06-22-2013, 06:44 AM.
                Two-handed alt (now main) account of Bobogoobo

                Best AAAs: Gacha Gacha Cute Figu atto Mate [56], Song of the second moon [52], Musicmaker RX [52], Wish (Reprise) [51], Nyanyanyanyanyanyanya! [51], Exogenesis [51]
                Quest for Scarhand: 3+ blackflags on Pure In Asia, blackflag on Iced Innocence
                2020 update: all of these got bumped up 4 (rip Scarhand unlock), rusty, new AAA Power Rocket [56?]
                2021 semiannual return: Connect (HOUSE SOUL REMIX) [57] (was blackflag from 2013), second blackflag on Call Upon the Seaponies; 2023: Polar 240 [56]
                BFs: 127 and counting (as of 2013-11-10)

                Comment

                • emerald000
                  the Mathemagician~
                  • Nov 2005
                  • 1320

                  #9
                  Re: Sort songs list by length

                  The sorting by length should be working now.

                  Comment

                  • Viisbyxa
                    FFR Veteran
                    • Jul 2012
                    • 358

                    #10
                    Re: Sort songs list by length

                    And so it is, thanks.
                    Two-handed alt (now main) account of Bobogoobo

                    Best AAAs: Gacha Gacha Cute Figu atto Mate [56], Song of the second moon [52], Musicmaker RX [52], Wish (Reprise) [51], Nyanyanyanyanyanyanya! [51], Exogenesis [51]
                    Quest for Scarhand: 3+ blackflags on Pure In Asia, blackflag on Iced Innocence
                    2020 update: all of these got bumped up 4 (rip Scarhand unlock), rusty, new AAA Power Rocket [56?]
                    2021 semiannual return: Connect (HOUSE SOUL REMIX) [57] (was blackflag from 2013), second blackflag on Call Upon the Seaponies; 2023: Polar 240 [56]
                    BFs: 127 and counting (as of 2013-11-10)

                    Comment

                    Working...