Posts: 66
Joined: Apr 2012
Reputation:
2
Hi everyone,
I have a small problem with my library : all my movies are duplicated.
What happened is that at first I was using the hostname in my sources, but I recently changed it to 192.168.10.160 (my server's IP) so it's easier to setup across different operating systems (Android, MacOSX. Ubuntu, Windows). I'm using a MySQL server to store my data so the path must be identical across all my devices.
The problem is that I now have two entries for every movie. For example, I will have both smb://192.168.10.160/Movies/Inception.mkv AND smb://MEDIA_CENTER/Movies/Inception.mkv. It is the same file on the same server, but with a different path. Cleaning the library doesn't work because it searches to see if the file exists, but in both cases it does exist.
How would you do that?
Thanks!
Posts: 14
Joined: Jul 2015
Reputation:
0
Hi,
you can delete the "wrong" entries manually, but depending on the amount of movies, this might take a while..
Additionaly, you should remove the "wrong" sources (smb://MEDIA_CENTER/Movies/) from your library, by removing the according sources from your video-library.
Alternatively, you might try the following workaround:
-> Export your Video-Database.
-> Remove all entries in your Video-Database,
or remove the according video-sources and run a clean-up -> in the result, your database should be empty.
-> Run an according import. (If you also removed the video-sources, you just add them, movies should be imported automatically).
-> Your movies should be in.
Of course, there are other workarounds like doing according clean-ups in the SQL-Database directly.
Hope this information helps.
Posts: 66
Joined: Apr 2012
Reputation:
2
Thanks for your answer! Would it be OK to remove the entries in the movies database with a simple query like DELETE FROM movies WHERE path REGEXP 'MEDIA_CENTER' ? If it's OK it wouldn't take long to do I think!
Posts: 4,146
Joined: Jan 2008
Reputation:
41
Don't forget to clean the old path table entries.
Always read the
online manual (wiki),
FAQ (wiki) and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the
forum rules (wiki).
Please read the pages on
troubleshooting (wiki) and
bug reporting (wiki) before reporting issues.
Posts: 14
Joined: Feb 2011
Reputation:
1
sincze
Junior Member
Posts: 14
2017-04-22, 17:07
Whoehoe those commands saved my day. Tnx.
Posts: 5
Joined: Oct 2015
Reputation:
0
Hi sam_1421,
If I understand your question correctly, you are running Kodi with a remote (or centralised) MySQL database as your Movie/TV Episode datastore. You now have some duplicate entries in your wither your movies, TV Episodes, or both and you want to clean up your duplicate entries in your Mysql database.
Firstly you want to identify the name of your Kodi database
Posts: 5
Joined: Oct 2015
Reputation:
0
Hi sam_1421,
If I understand your question correctly, you are running Kodi with a remote (or centralised) MySQL database as your Movie/TV Episode datastore. You have some duplicate entries in your movies, TV Episodes, or both and you want to clean up your duplicate entries in your MySQL database.
Firstly you need to identify the name of your Kodi database:
$ mysqlshow -u root -p
+--------------------+
| Databases |
+--------------------+
| information_schema |
| MyMusic72 |
| MyMusic82 |
| MyVideos116 |
| MyVideos119 |
| mysql |
| performance_schema |
| test |
+--------------------+
$
In the above example I have two Kodi sets of data stores, MyVideos116 and MyVideos119 so I need to reference the table with higher number (MyVideos119).
Secondly, do a backup of the database (my kody database is MyVideos119):
$ mysqldump -u root -p MyVideos119 | gzip -9 -c > myvideos119-`date +%Y%m%d-%H:%M`.sql.gz
Now we need to process the cleanup of the database and in regard with the "Movies" and to do this you need to log into MySQL and then execute the following SQL statement (Remember my database is MyVideos119, replace that with your database name):
$ mysql -u root -p
mysql> DELETE t1 FROM movie t1 INNER JOIN movie t2 WHERE t1.idMovie < t2.idMovie AND t1.c00 = t2.c00;
Query OK, 1277 rows affected (53.67 sec)
and for the duplicate TV Episodes you need to execute the following (remembering to replace the database with your database name):
mysql> DELETE t1 FROM episode t1 INNER JOIN episode t2 WHERE t1.idEpisode < t2.idEpisode AND t1.c00 = t2.c00;
Query OK, 7466 rows affected (31 min 12.61 sec)
mysql> \q
$
And that should be it.
When you now startup your Kodi device your duplicate movies and episodes should all be removed and you should still have all of your wanted programming in the database.
Best of luck, let me know if you have problems.
Rick
Posts: 5
Joined: Oct 2015
Reputation:
0
Yes Sam, I am aware. The point of most forums is to act as an information repository. Now, I had no success in trying to resolve this issue for my koi network and once I worked out the solution I made it available for the whole community (should they need it).
Maybe I am a lot older than you, but this is how the "internet community" used to work, if it doesn't any longer then that explains why I could not find the answers when I needed them.