1
00:00:01,890 --> 00:00:06,690
OK, so now we want to sort of write out the functions that will delete an actual song.

2
00:00:06,700 --> 00:00:11,310
So remember, our playlist is called Playlist Underscore Box.

3
00:00:11,320 --> 00:00:13,710
So let's go playlist underscore box.

4
00:00:14,040 --> 00:00:15,360
And what do we want to delete?

5
00:00:15,390 --> 00:00:16,140
What do we want to do?

6
00:00:16,150 --> 00:00:19,710
We want to delete a song or delete something from the box.

7
00:00:19,830 --> 00:00:21,150
And now what do we want to delete?

8
00:00:21,750 --> 00:00:28,140
Well, we want anchor and the anchor is the thing you've clicked on in the box, the thing that's highlighted

9
00:00:28,140 --> 00:00:29,190
with that green bar.

10
00:00:29,400 --> 00:00:31,310
So we could just say delete that.

11
00:00:31,320 --> 00:00:35,070
So let's go ahead and save this and run it just to see if that worked.

12
00:00:36,190 --> 00:00:38,740
So let's come over here, let's add a bunch of songs.

13
00:00:40,580 --> 00:00:47,630
Now, let's click on this n quiet morning one now, that's the anchor song, it's the anchor item in

14
00:00:47,630 --> 00:00:48,650
the playlist, right.

15
00:00:48,660 --> 00:00:55,370
So now when we click here and delete a song, boom, it disappears so we can click on Not Me when it

16
00:00:55,370 --> 00:00:56,120
disappears.

17
00:00:57,320 --> 00:00:59,930
OK, so that works, so that was pretty easy.

18
00:00:59,960 --> 00:01:05,290
Now we want to work on the function that deletes all the songs and let's give this a little comment.

19
00:01:05,300 --> 00:01:11,510
So delete highlighted song from a playlist.

20
00:01:12,860 --> 00:01:17,840
So down here, let's go delete all songs.

21
00:01:18,440 --> 00:01:26,300
And to do that, we again just call our Playbox or playlist Underscore Box and then again it's delete.

22
00:01:26,630 --> 00:01:28,880
But this time we can give this a range.

23
00:01:28,880 --> 00:01:34,190
We want to say which ones do we want to do in a range where we want to we want to do them all.

24
00:01:34,190 --> 00:01:39,800
So the things in our playlist are numbered, like a Python list.

25
00:01:40,010 --> 00:01:44,110
And if you're familiar with Python lists, list items start at number zero.

26
00:01:44,270 --> 00:01:46,010
So the first item is always zero.

27
00:01:46,160 --> 00:01:47,150
The next one is one.

28
00:01:47,150 --> 00:01:49,220
The next one is two, three, four, whatever.

29
00:01:49,220 --> 00:01:51,350
So we could say start with zero.

30
00:01:51,350 --> 00:01:55,000
And that's the number zero, not the letter O, right.

31
00:01:55,250 --> 00:01:55,880
Zero.

32
00:01:56,240 --> 00:02:00,260
And we want to go from zero to end all of the things in the list.

33
00:02:00,950 --> 00:02:02,480
So, OK, that should do it.

34
00:02:02,490 --> 00:02:05,180
So let's go save this and run it.

35
00:02:08,450 --> 00:02:10,970
So let's add a bunch of songs you.

36
00:02:11,970 --> 00:02:18,660
They're all listed here, so let's delete all songs and boom, they disappear, we can add the McKagan.

37
00:02:20,170 --> 00:02:26,680
And get rid of one, we can get rid of them all and we're good to go, so, OK, we are moving right

38
00:02:26,680 --> 00:02:26,980
along.

39
00:02:26,980 --> 00:02:30,160
We can add songs to our playlist, we can remove songs from our playlist.

40
00:02:30,160 --> 00:02:31,270
We can add a bunch of songs.

41
00:02:31,270 --> 00:02:32,620
We can remove a bunch of songs.

42
00:02:32,860 --> 00:02:34,870
Now we just need to play the song.

43
00:02:34,880 --> 00:02:36,880
So we'll start to look at that in the next video.
