ID 341714 - findNewVersions() returns all of the versions of the clip, including the one that already in the item, when using video files

Follow

Problem summary
findNewVersions() returns all of the versions of the clip, including the one that already in the item.
This seems to only happen with video files (.mov, .mp4, etc.)



Customer reported version
Hiero 11.1v2

Steps to reproduce

1) Open Hiero or Nuke Studio.

2) Import a video file, for example .mov, that has multiple versions. Example clips are attached.

3) Open the Script Editor (Window > Script Editor)

for item in hiero.ui.getTimelineEditor(hiero.ui.activeSequence()).selection():
vs = hiero.core.VersionScanner.VersionScanner()
new_versions = vs.findNewVersions(item.currentVersion())
new_versions = vs.sortVersions(new_versions)
binitem = item.currentVersion().parent()
clips = []
for f in new_versions:
newMediaSource = hiero.core.MediaSource(f)
newClip = hiero.core.Clip(newMediaSource)
clips.append(newClip)
vs.insertClips(binitem, clips)

4) Select the clip in the Timeline and run the Script (Ctrl + Enter).

5) With the clip selected in the Timeline, press the V key to display its versions. Notice that version v001 is displayed in the list twice.



Workaround

The following line of code can be added to the code:
if item.source().mediaSource().firstpath() in new_versions:
  new_versions.remove(item.source().mediaSource().firstpath())    
These line say that if the original version is found in the new scanned versions, to remove it from the list.

Here is example of the code block, with the new lines added: 
for item in hiero.ui.getTimelineEditor(hiero.ui.activeSequence()).selection():
vs = hiero.core.VersionScanner.VersionScanner()
new_versions = vs.findNewVersions(item.currentVersion())
print new_versions
if item.source().mediaSource().firstpath() in new_versions:
new_versions.remove(item.source().mediaSource().firstpath())
print new_versions
new_versions = vs.sortVersions(new_versions)
binitem = item.currentVersion().parent()
clips = []
for f in new_versions:
newMediaSource = hiero.core.MediaSource(f)
newClip = hiero.core.Clip(newMediaSource)
clips.append(newClip)

vs.insertClips(binitem, clips)

Reproduced by support
This bug has been reproduced in:
Hiero 11.1v2 - Windows 10 - OSX El Capitan 
Nuke Studio 11.1v2 - Windows 10 - OSX El Capitan 
Hiero 11.1v1 - Windows 10 - OSX El Capitan - Regression
NukeStudio 11.1v1 - Windows 10 - OSX El Capitan - Regression

Unable to reproduce bug in:
Hiero 11.1v2 - Linux CentOS 7
Nuke Studio 11.1v2 - Nuke Studio

Hiero 11.0v4 - Windows 10 - OSX El Capitan
NukeStudio 11.0v4 - Windows 10 - OSX El Capitan

Earliest version tested
Hiero 11.0v4 - Windows 10
NukeStudio 11.0v4 - Windows 10
- This issue no longer appears in this version and has regressed

Expected behaviour
findNewVersions() should only return the versions of the clip that are not already in the item.

Actual behaviour
findNewVersions() returns all of the versions of the clip, including the ones that are already in the item.
This seems to only happens with video files (.mov, .mp4, etc.)

    We're sorry to hear that

    Please tell us why