Media duplication after import and scan
#1
I recently upgraded to xbmc 12.2. Previously, I was running xbmc 11

Prior to upgrading, I exported the entire library to a single file.

After upgrading (starting with a fresh home directory), I re-imported the above library export.

At this point, everything I had before is available again and accessible.

When I perform a scan, duplicates of various movies and shows start appearing.

It appears to only be limited to movies / shows which are contained in rars.

I examined the MyVideos75.db using sqlite3, and here is what I discovered:

Code:
sqlite> select idMovie, idFile, c00 from movie where c00 like '%jump%';
42|62|21 Jump Street
126|2172|21 Jump Street

The first column is just an id for the movie. The second column is the file id, and the third is the title.

Code:
sqlite> select * from files where idFile = 62;
62|14|rar:///media/disk/xbmc/movies/21.Jump.Street.2012.1080p.BluRay.x264-SECTOR7/s7-21.jump.street.1080.rar/s7-21.jump.street.1080.mkv|2|2013-03-17 00:00:00|2013-08-04 23:44:07
sqlite> select * from files where idFile = 2172;
2172|974|rar://%2fmedia%2fdisk%2fxbmc%2fmovies%2f21.Jump.Street.2012.1080p.BluRay.x264-SECTOR7%2fs7-21.jump.street.1080.rar/s7-21.jump.street.1080.mkv|||2012-08-26 01:01:02

The second path (2172) is urlquoted. I noticed in the export xml that rars appear quoted. I thought that maybe this was the issue, so I wrote a python script to iterate all of them and fix them. That did not resolve the problem.

I suppose what I could try next is to delete the database again, import and then check the db using sqlite3 to see what one is created initially, and update it to match the format of the other one.

Update

I imported the original export, and the result was the following:

Code:
sqlite> select idMovie, idFile, c00 from movie where c00 like '%jump%';
42|42|21 Jump Street
sqlite> select * from files where idFile = 42;
42|11|rar://%2fmedia%2fdisk%2fxbmc%2fmovies%2f21%2eJump%2eStreet%2e2012%2e1080p%2eBluRay%2ex264%2dSECTOR7%2fs7%2d21%2ejump%2estreet%2e1080%2erar/s7-21.jump.street.1080.mkv|2|2013-03-17 00:00:00|2012-08-26 01:01:02

Every non-alphanumeric character is urlquoted.

Then I did a scan, resulting in:

Code:
sqlite> select idMovie, idFile, c00 from movie where c00 like '%jump%';
42|42|21 Jump Street
126|2167|21 Jump Street
sqlite> select * from files where idFile = 42;
42|11|rar://%2fmedia%2fdisk%2fxbmc%2fmovies%2f21%2eJump%2eStreet%2e2012%2e1080p%2eBluRay%2ex264%2dSECTOR7%2fs7%2d21%2ejump%2estreet%2e1080%2erar/s7-21.jump.street.1080.mkv|2|2013-03-17 00:00:00|2012-08-26 01:01:02
sqlite> select * from files where idFile = 2167;
2167|11|rar://%2fmedia%2fdisk%2fxbmc%2fmovies%2f21.Jump.Street.2012.1080p.BluRay.x264-SECTOR7%2fs7-21.jump.street.1080.rar/s7-21.jump.street.1080.mkv|||2012-08-26 01:01:02

In this example, periods are not urlquoted, which explains why the paths do not match.

Update

Source: https://github.com/xbmc/xbmc/blob/abba6f...L.cpp#L758

According to the above, this url encode algorithm ignores -_.!() as per RFC1738.

It also appears that the quoted characters must be lowercase, otherwise not only do they not match, the file cannot even be found.
Reply
#2
Hi !
I have the exact same problem since at least xbmc 12.0 ! In fact, just a scan create duplicates on new content.

I googled a lot about it, and almost found nothing. I'm amazed that there is so few people complaining about it as this issue is around for a while.
I started to think that it should have a simple solution to it. But never found it !

I hope they will fix it for 13.0 but as it seems we are the only two complaining about it, my hopes are quite low ... Sad
Reply
#3
Hi popopow,

I ended up writing my own python script to fix the problem. I'm not sure how much help it will be for you, but I'll share it anyway.

https://gist.github.com/kylegibson/7753141

1. Start with a fresh XBMC database.
2. Import your backup
3. Run the script, it will correct the rar paths
4. Launch XBMC
5. Verify that stuff looks okay
6. Do a library scan & update
7. Verify that nothing was duplicated
Reply

Logout Mark Read Team Forum Stats Members Help
Media duplication after import and scan0