go-dash icon indicating copy to clipboard operation
go-dash copied to clipboard

Reversing the order of the playlist

Open kaihendry opened this issue 8 years ago • 0 comments

I noticed your data structure has changed (my code that uses your library won't build) from 74b837a15f801c07021ded58680e1c3bc75f0ba0 so that we have lists of AdaptionSets in lists of Periods IIUC.

I have legacy code like:

func reversempd(s []*mpd.Representation) []*mpd.Representation {
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
	return s
}
	if order == "desc" {
		for i, v := range m.Period.AdaptationSets {
			log.Println(i, v)
			v.Representations = reversempd(v.Representations)
			for j, r := range v.Representations {
				log.Println(j, r, "id", *r.ID)
			}
		}
	}

For reversing the order of the playlist which is needed for some reason or another. Can you suggest a way of realizing my reversal use case in light of the changes?

kaihendry avatar Aug 29 '17 02:08 kaihendry