mirror of
https://github.com/ZuneDev/ZuneShell.dll.git
synced 2026-07-27 13:11:51 -07:00
Create standalone track method
Update Iris
This commit is contained in:
@@ -219,6 +219,8 @@ namespace Microsoft.Zune.Library
|
||||
}
|
||||
#endregion
|
||||
|
||||
var filterIds = (albumId, artistId, genreId);
|
||||
|
||||
string text = (string)GetProperty("QueryType");
|
||||
EQueryType queryType = EQueryType.eQueryTypeInvalid;
|
||||
|
||||
@@ -470,7 +472,11 @@ namespace Microsoft.Zune.Library
|
||||
}
|
||||
|
||||
var stTracks = m_dataRoot.Library.GetTracksAsync(int.MaxValue, 0);
|
||||
|
||||
await foreach (var stTrack in stTracks)
|
||||
{
|
||||
var track = await CreateTrack(stTrack, queryType, filterIds);
|
||||
queryList.Add(track.Item);
|
||||
}
|
||||
}
|
||||
else if (text == "AlbumByTOC")
|
||||
{
|
||||
@@ -607,9 +613,7 @@ namespace Microsoft.Zune.Library
|
||||
Status = DataProviderQueryStatus.Complete;
|
||||
}
|
||||
|
||||
private Schemas.Track CreateTrack(ZuneQueryList queryList, )
|
||||
{
|
||||
await foreach (var stTrack in stTracks)
|
||||
private async Task<Schemas.Track> CreateTrack(ITrack stTrack, EQueryType queryType, (int? album, int? albumArtist, int? genre) filterIds)
|
||||
{
|
||||
var stAlbum = stTrack.Album;
|
||||
var stAlbumArtist = stAlbum != null
|
||||
@@ -620,28 +624,28 @@ namespace Microsoft.Zune.Library
|
||||
if (queryType == EQueryType.eQueryTypeTracksForAlbumId)
|
||||
{
|
||||
var currentAlbumId = stAlbum?.Id.HashToInt32();
|
||||
if (currentAlbumId != albumId) continue;
|
||||
if (currentAlbumId != filterIds.album) return null;
|
||||
}
|
||||
else if (queryType == EQueryType.eQueryTypeTracksForAlbumArtistId)
|
||||
{
|
||||
var currentAlbumArtistId = stAlbumArtist?.Id.HashToInt32();
|
||||
if (currentAlbumArtistId != albumArtistId) continue;
|
||||
if (currentAlbumArtistId != filterIds.albumArtist) return null;
|
||||
}
|
||||
else if (queryType == EQueryType.eQueryTypeTracksByGenreId)
|
||||
{
|
||||
var containsCurrentGenre = await stTrack.GetGenresAsync(int.MaxValue, 0)
|
||||
.Select(g => g.Name.HashToInt32())
|
||||
.AnyAsync(g => g == genreId);
|
||||
.AnyAsync(g => g == filterIds.genre);
|
||||
|
||||
if (!containsCurrentGenre && stAlbum != null)
|
||||
{
|
||||
// If the track doesn't have the genre, the album might.
|
||||
containsCurrentGenre = await stAlbum.GetGenresAsync(int.MaxValue, 0)
|
||||
.Select(g => g.Name.HashToInt32())
|
||||
.AnyAsync(g => g == genreId);
|
||||
.AnyAsync(g => g == filterIds.genre);
|
||||
}
|
||||
|
||||
if (!containsCurrentGenre) continue;
|
||||
if (!containsCurrentGenre) return null;
|
||||
}
|
||||
|
||||
Schemas.Track track = new(m_dataType)
|
||||
@@ -720,8 +724,7 @@ namespace Microsoft.Zune.Library
|
||||
track.Genre = stGenre?.Name;
|
||||
|
||||
track.Item.Storage["StrixItem"] = stTrack;
|
||||
queryList.Add(track.Item);
|
||||
}
|
||||
return track;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
Submodule libs/MicrosoftIris updated: 7b25639c40...be78b55a30
Reference in New Issue
Block a user