{"action":"opened","issue":{"url":"https://api.github.com/repos/sbarakat/beets-copyartifacts/issues/26","labels_url":"https://api.github.com/repos/sbarakat/beets-copyartifacts/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/sbarakat/beets-copyartifacts/issues/26/comments","events_url":"https://api.github.com/repos/sbarakat/beets-copyartifacts/issues/26/events","html_url":"https://github.com/sbarakat/beets-copyartifacts/issues/26","id":119823550,"number":26,"title":"Duplicates can get created on move","user":{"login":"sbarakat","id":261513,"avatar_url":"https://avatars.githubusercontent.com/u/261513?v=3","gravatar_id":"","url":"https://api.github.com/users/sbarakat","html_url":"https://github.com/sbarakat","followers_url":"https://api.github.com/users/sbarakat/followers","following_url":"https://api.github.com/users/sbarakat/following{/other_user}","gists_url":"https://api.github.com/users/sbarakat/gists{/gist_id}","starred_url":"https://api.github.com/users/sbarakat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbarakat/subscriptions","organizations_url":"https://api.github.com/users/sbarakat/orgs","repos_url":"https://api.github.com/users/sbarakat/repos","events_url":"https://api.github.com/users/sbarakat/events{/privacy}","received_events_url":"https://api.github.com/users/sbarakat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-01T22:32:41Z","updated_at":"2015-12-01T22:32:41Z","closed_at":null,"body":"When running `beet move` on an already imported directory with multiple artifacts the plugin can cause duplicates to be created if `beet move` is run multiple times.\r\n\r\nconfig.yml\r\n```\r\npaths:\r\n    default: $albumartist/$disc_and_track - $title\r\n    ext:txt: $albumpath/$album\r\n```\r\nOriginal state\r\n```\r\nalbum/track1.mp3\r\nalbum/file1.txt\r\nalbum/file2.txt\r\n```\r\nAfter `beet import`\r\n```\r\nalbum/01 - track1.mp3\r\nalbum/album.txt\r\nalbum/album.1.txt\r\n```\r\nAfter `beet move`\r\n```\r\nalbum/01 - track1.mp3\r\nalbum/album.txt\r\nalbum/album.1.txt\r\nalbum/album.2.txt    # duplicate of album.1.txt\r\n```\r\nThis is caused by a combination of the mappings and the unique file naming algorithm. After `import` `album.1.txt` gets its name due to `album.txt` already being taken and is a different file. After `move`, a similar thing happens, however only file name existence is checked and a comparison of file content is done done after the first iteration."}}