Ticket #4105: albumfix2.patch
File albumfix2.patch, 3.4 KB (added by , 16 years ago) |
---|
-
mythmusic/mythmusic/playlist.cpp
963 963 else if (tmpdata->LastPlay() > lastplayMax) { lastplayMax = tmpdata->LastPlay(); } 964 964 } 965 965 } 966 // pre-fill the album-map with the album name. This allows us to do album mode in album order 967 album = tmpdata->Artist() + "~" + tmpdata->Album(); 968 if ((Ialbum = album_map.find(album)) == album_map.end()) 969 { 970 album_map.insert(AlbumMap::value_type(album,0)); 971 } 966 972 967 973 // pre-fill the artist map with the artist name and song title 968 974 artist = tmpdata->Artist() + "~" + tmpdata->Title(); 969 975 if ((Iartist = artist_map.find(artist)) == artist_map.end()) 970 976 { 971 artist_map.insert(ArtistMap::value_type(artist, 972 0)); 973 } 977 artist_map.insert(ArtistMap::value_type(artist,0)); 978 } 974 979 } 975 980 } 976 981 } 982 // populate the sort id into the album map 983 uint32_t album_count = 1; 984 for( Ialbum = album_map.begin(); Ialbum != album_map.end(); Ialbum++ ) 985 { 986 Ialbum->second = album_count; 987 album_count++; 988 } 977 989 978 990 // populate the sort id into the artist map 979 991 uint32_t count = 1; … … 1033 1045 added_node->setAttribute(3, integer_rating); // "intelligent" order 1034 1046 1035 1047 // "intellegent/album" order 1048 uint32_t album_order; 1036 1049 album = tmpdata->Artist() + "~" + tmpdata->Album(); 1037 if ((Ialbum = album_map.find(album)) == album_map.end()) { 1038 // Add room for 100 albums with 100 tracks. 1039 integer_rating *= 10000; 1040 integer_rating += (a_counter * 100); 1041 1042 album_map.insert(AlbumMap::value_type(album, 1043 integer_rating)); 1044 1045 integer_rating += tmpdata->Track(); 1046 added_node->setAttribute(4, integer_rating); 1050 if ((Ialbum = album_map.find(album)) == album_map.end()) 1051 { 1052 // we didn't find this album in the map, yet we pre-loaded them all 1053 // we are broken, but we just set the track order to 1, since there 1054 // is no real point in reporting an error 1055 album_order = 1; 1047 1056 } 1048 else { 1049 integer_rating = Ialbum->second; 1050 integer_rating += tmpdata->Track(); 1051 added_node->setAttribute(4, integer_rating); 1057 else 1058 { 1059 album_order = Ialbum->second * 100; 1052 1060 } 1061 album_order += tmpdata->Track(); 1062 added_node->setAttribute(4, album_order); 1053 1063 1054 1064 // "artist" order, sorts by artist name then track title 1055 1065 // uses the pre-prepared artist map to do this