1 | Index: configure |
---|
2 | =================================================================== |
---|
3 | --- configure (revision 14675) |
---|
4 | +++ configure (working copy) |
---|
5 | @@ -21,7 +21,7 @@ |
---|
6 | controls="yes" |
---|
7 | flix="yes" |
---|
8 | archive="yes" |
---|
9 | -zoneminder="yes" |
---|
10 | +zoneminder="no" |
---|
11 | movies="yes" |
---|
12 | |
---|
13 | cc="gcc" |
---|
14 | Index: mythmusic/mythmusic/playbackbox.cpp |
---|
15 | =================================================================== |
---|
16 | --- mythmusic/mythmusic/playbackbox.cpp (revision 14675) |
---|
17 | +++ mythmusic/mythmusic/playbackbox.cpp (working copy) |
---|
18 | @@ -121,6 +121,8 @@ |
---|
19 | setShuffleMode(SHUFFLE_INTELLIGENT); |
---|
20 | else if (playmode.lower() == "album") |
---|
21 | setShuffleMode(SHUFFLE_ALBUM); |
---|
22 | + else if (playmode.lower() == "artist") |
---|
23 | + setShuffleMode(SHUFFLE_ARTIST); |
---|
24 | else |
---|
25 | setShuffleMode(SHUFFLE_OFF); |
---|
26 | |
---|
27 | @@ -269,6 +271,8 @@ |
---|
28 | gContext->SaveSetting("PlayMode", "random"); |
---|
29 | else if (shufflemode == SHUFFLE_ALBUM) |
---|
30 | gContext->SaveSetting("PlayMode", "album"); |
---|
31 | + else if (shufflemode == SHUFFLE_ARTIST) |
---|
32 | + gContext->SaveSetting("PlayMode", "artist"); |
---|
33 | else |
---|
34 | gContext->SaveSetting("PlayMode", "none"); |
---|
35 | |
---|
36 | @@ -1639,6 +1643,21 @@ |
---|
37 | |
---|
38 | bannerEnable(tr("Shuffle: Album"), 4000); |
---|
39 | break; |
---|
40 | + case SHUFFLE_ARTIST: |
---|
41 | + if(shuffle_button) |
---|
42 | + { |
---|
43 | + if (keyboard_accelerators) |
---|
44 | + shuffle_button->setText(tr("1 Shuffle: Artist")); |
---|
45 | + else |
---|
46 | + shuffle_button->setText(tr("Shuffle: Artist")); |
---|
47 | + } |
---|
48 | + music_tree_list->scrambleParents(true); |
---|
49 | + |
---|
50 | + if (class LCD *lcd = LCD::Get()) |
---|
51 | + lcd->setMusicShuffle(LCD::MUSIC_SHUFFLE_ARTIST); |
---|
52 | + |
---|
53 | + bannerEnable(tr("Shuffle: Artist"), 4000); |
---|
54 | + break; |
---|
55 | default: |
---|
56 | if(shuffle_button) |
---|
57 | { |
---|
58 | @@ -1817,6 +1836,7 @@ |
---|
59 | playlist_tree->setAttribute(1, 0); |
---|
60 | playlist_tree->setAttribute(2, 0); |
---|
61 | playlist_tree->setAttribute(3, 0); |
---|
62 | + playlist_tree->setAttribute(4, 0); |
---|
63 | |
---|
64 | // We ask the playlist object to write out the whole tree (all playlists |
---|
65 | // and all music). It will set attributes for nodes in the tree, such as |
---|
66 | Index: mythmusic/mythmusic/playlist.cpp |
---|
67 | =================================================================== |
---|
68 | --- mythmusic/mythmusic/playlist.cpp (revision 14675) |
---|
69 | +++ mythmusic/mythmusic/playlist.cpp (working copy) |
---|
70 | @@ -931,8 +931,12 @@ |
---|
71 | AlbumMap album_map; |
---|
72 | AlbumMap::iterator Ialbum; |
---|
73 | QString album; |
---|
74 | - |
---|
75 | - |
---|
76 | + |
---|
77 | + typedef map<QString, uint32_t> ArtistMap; |
---|
78 | + ArtistMap artist_map; |
---|
79 | + ArtistMap::iterator Iartist; |
---|
80 | + QString artist; |
---|
81 | + |
---|
82 | for(it = songs.first(); it; it = songs.next()) |
---|
83 | { |
---|
84 | if(!it->getCDFlag()) |
---|
85 | @@ -959,10 +963,26 @@ |
---|
86 | else if (tmpdata->LastPlay() > lastplayMax) { lastplayMax = tmpdata->LastPlay(); } |
---|
87 | } |
---|
88 | } |
---|
89 | + |
---|
90 | + // pre-fill the artist map with the artist name and song title |
---|
91 | + artist = tmpdata->Artist() + "~" + tmpdata->Title(); |
---|
92 | + if ((Iartist = artist_map.find(artist)) == artist_map.end()) |
---|
93 | + { |
---|
94 | + artist_map.insert(ArtistMap::value_type(artist, |
---|
95 | + 0)); |
---|
96 | + } |
---|
97 | } |
---|
98 | } |
---|
99 | } |
---|
100 | |
---|
101 | + // populate the sort id into the artist map |
---|
102 | + uint32_t count = 1; |
---|
103 | + for( Iartist = artist_map.begin(); Iartist != artist_map.end(); Iartist++ ) |
---|
104 | + { |
---|
105 | + Iartist->second = count; |
---|
106 | + count++; |
---|
107 | + } |
---|
108 | + |
---|
109 | int RatingWeight = 2; |
---|
110 | int PlayCountWeight = 2; |
---|
111 | int LastPlayWeight = 2; |
---|
112 | @@ -1030,6 +1050,23 @@ |
---|
113 | integer_rating += tmpdata->Track(); |
---|
114 | added_node->setAttribute(4, integer_rating); |
---|
115 | } |
---|
116 | + |
---|
117 | + // "artist" order, sorts by artist name then track title |
---|
118 | + // uses the pre-prepared artist map to do this |
---|
119 | + uint32_t integer_order; |
---|
120 | + artist = tmpdata->Artist() + "~" + tmpdata->Title(); |
---|
121 | + if ((Iartist = artist_map.find(artist)) == artist_map.end()) |
---|
122 | + { |
---|
123 | + // we didn't find this track in the map, yet we pre-loaded them all |
---|
124 | + // we are broken, but we just set the track order to 1, since there |
---|
125 | + // is no real point in reporting an error |
---|
126 | + integer_order = 1; |
---|
127 | + } |
---|
128 | + else |
---|
129 | + { |
---|
130 | + integer_order = Iartist->second; |
---|
131 | + } |
---|
132 | + added_node->setAttribute(5, integer_order); |
---|
133 | } |
---|
134 | } |
---|
135 | if(it->getValue() < 0) |
---|
136 | Index: mythmusic/mythmusic/playbackbox.h |
---|
137 | =================================================================== |
---|
138 | --- mythmusic/mythmusic/playbackbox.h (revision 14675) |
---|
139 | +++ mythmusic/mythmusic/playbackbox.h (working copy) |
---|
140 | @@ -140,6 +140,7 @@ |
---|
141 | SHUFFLE_RANDOM, |
---|
142 | SHUFFLE_INTELLIGENT, |
---|
143 | SHUFFLE_ALBUM, |
---|
144 | + SHUFFLE_ARTIST, |
---|
145 | MAX_SHUFFLE_MODES |
---|
146 | }; |
---|
147 | enum ResumeMode |
---|