| 164 | } |
| 165 | |
| 166 | void |
| 167 | PrintQueue(Response &r, const Queue &queue, |
| 168 | const QueueSelection &selection) |
| 169 | { |
| 170 | if (selection.sort != TAG_NUM_OF_ITEM_TYPES) { |
| 171 | PrintSortedQueue(r, queue, selection); |
| 172 | return; |
| 173 | } |
| 174 | |
| 175 | auto window = selection.window; |
| 176 | |
| 177 | if (!window.CheckClip(queue.GetLength())) |
| 178 | throw PlaylistError::BadRange(); |
| 179 | |
| 180 | if (selection.window.IsEmpty()) |
| 181 | return; |
| 182 | |
| 183 | unsigned skip = window.start; |
| 184 | unsigned n = window.Count(); |
| 185 | |
| 186 | for (unsigned i = 0; i < queue.GetLength(); i++) { |
| 187 | if (!selection.MatchPosition(queue, i)) |
| 188 | continue; |
| 189 | |
| 190 | if (skip > 0) { |
| 191 | --skip; |
| 192 | continue; |
| 193 | } |
| 194 | |
| 195 | queue_print_song_info(r, queue, i); |
| 196 | |
| 197 | if (--n == 0) |
| 198 | break; |
| 199 | } |
| 200 | } |
no test coverage detected