Skip to content

Волна по треку #40

Closed Answered by BloodyBaRGaIn
BloodyBaRGaIn asked this question in Q&A
Discussion options

You must be logged in to vote
public ITrackInfo? GetRadio(string id)
{
    YTrack originTrack = Client.GetTrack(id);
    if (originTrack == null) return null;

    YAlbum? album = originTrack.Albums.FirstOrDefault();
    if (album == null) return null;

    List<YStation> stations = Client.GetRadioStations();
    
    YStation? radio = stations
        .FirstOrDefault(s => string.Equals(
            s.AdParams.GenreName,
            album.Genre,
            StringComparison.OrdinalIgnoreCase));

    if (radio == null) return null;

    List<YSequenceItem> sequence = radio.GetTracks(id);
    if (sequence == null || sequence.Count == 0) return null;

    YSequenceItem? item = sequence.Shuffle().FirstOrDefault();
    if …

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@BloodyBaRGaIn
Comment options

@BloodyBaRGaIn
Comment options

Comment options

You must be logged in to vote
1 reply
@BloodyBaRGaIn
Comment options

Answer selected by K1llMan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants