[gnome-music] changed 'order by' for query.artists() and query.albums(): sorting now disregards 'the' at beginning



commit 7f0dc8d95e18970af8f6cc6f3a106901f4060659
Author: Maia <maia mcc gmail com>
Date:   Wed Oct 22 11:46:22 2014 -0400

    changed 'order by' for query.artists() and query.albums(): sorting now disregards 'the' at beginning of 
artist/album name
    
    https://bugzilla.gnome.org/show_bug.cgi?id=729378

 gnomemusic/query.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index e1bf794..e1845e4 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -217,7 +217,11 @@ class Query():
                 }
             )
         }
-    ORDER BY fn:lower-case(?title) ?author ?albumyear
+    ORDER BY IF(fn:starts-with(fn:lower-case(?title), "the "),
+        fn:substring(fn:lower-case(?title), 5), fn:lower-case(?title))
+        IF(fn:starts-with(fn:lower-case(?author), "the "),
+            fn:substring(fn:lower-case(?author), 5), fn:lower-case(?author))
+        ?albumyear
     '''.replace('\n', ' ').strip() % {
             'where_clause': where_clause.replace('\n', ' ').strip(),
             'music_dir': Query.MUSIC_URI,
@@ -366,7 +370,11 @@ class Query():
                 }
             )
         }
-    ORDER BY fn:lower-case(?author) ?albumyear nie:title(?album)
+    ORDER BY IF(fn:starts-with(fn:lower-case(?author), "the "),
+        fn:substring(fn:lower-case(?author), 5), fn:lower-case(?author))
+        ?albumyear
+        IF(fn:starts-with(fn:lower-case(nie:title(?album)), "the "),
+            fn:substring(fn:lower-case(nie:title(?album)), 5), fn:lower-case(nie:title(?album)))
     '''.replace('\n', ' ').strip() % {
             'where_clause': where_clause.replace('\n', ' ').strip(),
             'music_dir': Query.MUSIC_URI,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]