Changes to music-player
[webos-internals:justyns-modifications.git] / music-player / music-player-ignore-a-an-the.patch
1 --- .orig/usr/palm/applications/com.palm.app.musicplayer/app/views/artists/artist-entry.html
2 +++ /usr/palm/applications/com.palm.app.musicplayer/app/views/artists/artist-entry.html
3 @@ -9,7 +9,7 @@
4      </div>
5      <div class="single-album-art-shill"></div>
6      <div class="title">
7 -      <div class="truncating-text artist-name">#{artistNameFormatted}</div>
8 +      <div class="truncating-text artist-name">#{artistDisplayNameFormatted}</div>
9      </div>    
10    </div>
11  </div>
12  
13 --- .orig/usr/palm/applications/com.palm.app.musicplayer/app/views/allalbums/album-entry.html
14 +++ /usr/palm/applications/com.palm.app.musicplayer/app/views/allalbums/album-entry.html
15 @@ -8,7 +8,7 @@
16      </div>
17      <div class="single-album-art-shill"></div>              
18         <div class="all-albums title">
19 -      <div class="truncating-text all-albums-album-title">#{albumTitleFormatted}</div>
20 +      <div class="truncating-text all-albums-album-title">#{albumDisplayTitleFormatted}</div>
21        <div class="truncating-text all-albums-album-artist">#{albumArtistFormatted}</div>
22         </div>    
23    </div>
24    
25 --- .orig/usr/palm/applications/com.palm.app.musicplayer/app/views/albums/album-entry.html
26 +++ /usr/palm/applications/com.palm.app.musicplayer/app/views/albums/album-entry.html
27 @@ -7,7 +7,7 @@
28      </div>
29      <div class="single-album-art-shill"></div>
30      <div class="title">
31 -      <div class="truncating-text albums-album-title">#{albumTitleFormatted}</div>
32 +      <div class="truncating-text albums-album-title">#{albumDisplayTitleFormatted}</div>
33        <!-- <div class="truncating-text albums-album-song-count">#{albumCount}</div> -->
34      </div>
35    </div>
36    
37 --- .orig/usr/palm/applications/com.palm.app.musicplayer/app/controllers/artists-assistant.js
38 +++ /usr/palm/applications/com.palm.app.musicplayer/app/controllers/artists-assistant.js
39 @@ -25,7 +25,8 @@
40                         lookahead: 100,
41                         fixedHeightItems: true,
42                         formatters: {
43 -                               artistName: Util.artistFormatter
44 +                               artistName: Util.artistFormatter,
45 +                               artistDisplayName: Util.artistFormatter
46                         }
47                 };
48                 this.controller.setupWidget('artistslist', model);
49 @@ -145,6 +145,12 @@
50      
51         translateResults: function(filter, widget, offset, response){
52  
53 +               function sortByArtistDisplayName(a,b) {
54 +                       var x = a.artistDisplayName.toLowerCase();
55 +                       var y = b.artistDisplayName.toLowerCase();
56 +                       return ((x < y) ? -1 : ((x > y) ? 1 : 0));
57 +               }
58 +
59                 if(response.artistsTotal == 0){
60                         this.controller.get('no-items-message').innerHTML = AppAssistant.noItems;
61                         this.controller.get('no-items-message').show();
62 @@ -158,6 +158,26 @@
63                 ret.list = response.artists;
64                 ret.total = parseInt(response.artistsTotal);
65  
66 +               for (i = 0; i < ret.list.length; i++) {
67 +                       var artistName = ret.list[i].artistName;
68 +                       if (artistName.toUpperCase().indexOf('THE ') == 0) {
69 +                               ret.list[i].artistDisplayName = artistName.substring(4) + ', ' + artistName.substr(0,3);
70 +                       }
71 +                       else
72 +                       if (artistName.toUpperCase().indexOf('A ') == 0) {
73 +                               ret.list[i].artistDisplayName = artistName.substring(2) + ', ' + artistName.substr(0,1);
74 +                       }
75 +                       else
76 +                       if (artistName.toUpperCase().indexOf('AN ') == 0) {
77 +                               ret.list[i].artistDisplayName = artistName.substring(3) + ', ' + artistName.substr(0,2);
78 +                       }
79 +                       else {
80 +                               ret.list[i].artistDisplayName = artistName;
81 +                       }
82 +                       //Mojo.Log.info(ret.list[i].artistDisplayName);
83 +               }
84 +               ret.list.sort(sortByArtistDisplayName);
85 +
86                 widget.mojo.noticeUpdatedItems(offset, ret.list);
87                 widget.mojo.setCount(ret.total);
88                 widget.mojo.setLength(ret.total);
89 @@ -190,7 +190,7 @@
90      },
91      
92      getAlphaGroup: function(item){
93 -        return Util.getAlphaGroup(item.artistName);
94 +        return Util.getAlphaGroup(item.artistDisplayName);
95      },
96         
97         THUMB_WIDTH: 80,
98         
99 --- .orig/usr/palm/applications/com.palm.app.musicplayer/app/controllers/allalbums-assistant.js
100 +++ /usr/palm/applications/com.palm.app.musicplayer/app/controllers/allalbums-assistant.js
101 @@ -28,6 +28,7 @@
102                         fixedHeightItems : true,
103                         formatters: {
104                                 albumTitle: Util.albumFormatter,
105 +                               albumDisplayTitle: Util.albumFormatter,
106                                 albumArtist: Util.artistFormatter,
107                                 albumPictureUrl: Util.albumArtListUrlFormatter
108                         }
109 @@ -184,6 +184,12 @@
110         
111         translateResults : function(filter, widget, offset, response){
112                 
113 +               function sortByAlbumDisplayTitle(a,b) {
114 +                       var x = a.albumDisplayTitle.toLowerCase();
115 +                       var y = b.albumDisplayTitle.toLowerCase();
116 +                       return ((x < y) ? -1 : ((x > y) ? 1 : 0));
117 +               }
118 +
119                 if(response.albums.length == 0){
120                         this.controller.get('no-items-message').innerHTML = AppAssistant.noItems;
121                         this.controller.get('no-items-message').show();
122 @@ -196,6 +196,26 @@
123                 ret.list = response.albums;
124                 ret.total = parseInt(response.albumsTotal);
125                 
126 +               for (i = 0; i < ret.list.length; i++) {
127 +                       var albumTitle = ret.list[i].albumTitle;
128 +                       if (albumTitle.toUpperCase().indexOf('THE ') == 0) {
129 +                               ret.list[i].albumDisplayTitle = albumTitle.substring(4) + ', ' + albumTitle.substr(0,3);
130 +                       }
131 +                       else
132 +                       if (albumTitle.toUpperCase().indexOf('A ') == 0) {
133 +                               ret.list[i].albumDisplayTitle = albumTitle.substring(2) + ', ' + albumTitle.substr(0,1);
134 +                       }
135 +                       else
136 +                       if (albumTitle.toUpperCase().indexOf('AN ') == 0) {
137 +                               ret.list[i].albumDisplayTitle = albumTitle.substring(3) + ', ' + albumTitle.substr(0,2);
138 +                       }
139 +                       else {
140 +                               ret.list[i].albumDisplayTitle = albumTitle;
141 +                       }
142 +                       //Mojo.Log.info(ret.list[i].albumDisplayTitle);
143 +               }
144 +               ret.list.sort(sortByAlbumDisplayTitle);
145 +
146                 Util.setZOrder(ret.list, offset);
147  
148                 widget.mojo.noticeUpdatedItems(offset, ret.list);
149 @@ -213,7 +213,7 @@
150         },
151         
152         getAlphaGroup: function(item){
153 -        return Util.getAlphaGroup(item.albumTitle);
154 +        return Util.getAlphaGroup(item.albumDisplayTitle);
155      }
156  });
157  
158 --- .orig/usr/palm/applications/com.palm.app.musicplayer/app/controllers/albums-assistant.js
159 +++ /usr/palm/applications/com.palm.app.musicplayer/app/controllers/albums-assistant.js
160 @@ -26,6 +26,7 @@
161                         fixedHeightItems : true,
162                         formatters: {
163                                 albumTitle: Util.albumFormatter,
164 +                               albumDisplayTitle: Util.albumFormatter,
165                                 albumPictureUrl: Util.albumArtListUrlFormatter
166                         }
167                 };
168 @@ -120,7 +120,13 @@
169         
170         
171         translateResults : function(filter, widget, offset, response){
172 -               
173 +
174 +               function sortByAlbumDisplayTitle(a,b) {
175 +                       var x = a.albumDisplayTitle.toLowerCase();
176 +                       var y = b.albumDisplayTitle.toLowerCase();
177 +                       return ((x < y) ? -1 : ((x > y) ? 1 : 0));
178 +               }
179 +
180                 if(response.albums.length == 0){
181                         this.controller.get('playAllAlbums').hide();
182                         this.controller.get('no-items-message').innerHTML = AppAssistant.noItems;
183 @@ -134,7 +134,27 @@
184                 var ret = {};
185                 ret.list = response.albums;
186                 ret.total = parseInt(response.albumsTotal);
187 -               
188 +
189 +               for (i = 0; i < ret.list.length; i++) {
190 +                       var albumTitle = ret.list[i].albumTitle;
191 +                       if (albumTitle.toUpperCase().indexOf('THE ') == 0) {
192 +                               ret.list[i].albumDisplayTitle = albumTitle.substring(4) + ', ' + albumTitle.substr(0,3);
193 +                       }
194 +                       else
195 +                       if (albumTitle.toUpperCase().indexOf('A ') == 0) {
196 +                               ret.list[i].albumDisplayTitle = albumTitle.substring(2) + ', ' + albumTitle.substr(0,1);
197 +                       }
198 +                       else
199 +                       if (albumTitle.toUpperCase().indexOf('AN ') == 0) {
200 +                               ret.list[i].albumDisplayTitle = albumTitle.substring(3) + ', ' + albumTitle.substr(0,2);
201 +                       }
202 +                       else {
203 +                               ret.list[i].albumDisplayTitle = albumTitle;
204 +                       }
205 +                       //Mojo.Log.info(ret.list[i].albumDisplayTitle);
206 +               }
207 +               ret.list.sort(sortByAlbumDisplayTitle);
208 +
209                 Util.setZOrder(ret.list, offset);
210                 
211                 widget.mojo.noticeUpdatedItems(offset, ret.list);