Playlists and Item IDs
Posted: 30 Jul 2013 17:44
Can anyone explain to me how the IDs in playlist work? What I'm trying to do is to check if the current song/video is the first song in the playlist. I can't seem to find a smart way to solve this.
I've got a playlist/table with 15 entries. It looks like this.
When I use playlist.current() to get current input item id, the numbers don't match.
When I play the first song this is the output. As you can see the first-item-id matches the one in the table, but not what current() is returning.
When I play the second song this is the output.
When according to the table current-item-id for the 2nd song should be 5. Also when I'm in the playlist GUI and choose to see the ID field (Title, Duration, Album, etc). It shows ID 1 to 15.
Can anyone explain this mismatch to me and/or how to check if the item playing is the first item in the playlist.
I've got a playlist/table with 15 entries. It looks like this.
Code: Select all
children = { {
duration = 82.860437,
flags = {},
id = 4,
item = <userdata 1>,
name = "This Lullaby",
nb_played = 1,
path = "file:///C:/Music/Lullabies%20To%20Paralyze/01%20-%20This%20Lullaby.mp3"
}, {
duration = 114.4425,
flags = {},
id = 5,
item = <userdata 2>,
name = "Medication",
nb_played = 1,
path = "file:///C:/Music/Lullabies%20To%20Paralyze/02%20-%20Medication.mp3"
},
.....
When I play the first song this is the output. As you can see the first-item-id matches the one in the table, but not what current() is returning.
Code: Select all
lua debug: [mytest] first-item-id = 4
lua debug: [mytest] current-item-id = 5
Code: Select all
lua debug: [mytest] first-item-id id = 4
lua debug: [mytest] current-item-id = 6
Can anyone explain this mismatch to me and/or how to check if the item playing is the first item in the playlist.