clone song bug + add one method #1001
Open
+7
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Two changes
1- small one is adding a method as a provision for 8.5 when a track has started, we call the PH in case it wants to do something for each player. Not important but might be useful one day and as 8.5 will probably be widely used, better do that now.
2- The other one, which lead me to try 1- as a workaround drove me nuts... In the Deezer plugin, I could not get metadata changes to happen at the time (was way in advance, as in current plugin). After a lot of swearing and sweating, I realized that the $song->pluginData of the next track was in fact pointing to current track's pluginData. So when changing some of it in the next, it was of course being modified in the current one. It happens because when cloning song, it's a simple copy of attributes, including hashrefs.
There is a user-level workaround to initialize the new $song's pluginData object with an empty hash before setting anything in it. Still, I don't think that was the intent when cloning a song so I think we should do a proper clone of all its attribute, unless you think it was purposely done a shallow copy.