thereido / RatingSync

Keep ratings from movie websites in sync
GNU General Public License v3.0
0 stars 1 forks source link

DB has film_source TMDb rows with duplicate uniqueNames #38

Closed thereido closed 2 years ago

thereido commented 2 years ago

That means separate titles are using the same "unique" TMDb ID.

SELECT COUNT(film_id), film_source.* FROM film_source WHERE source_name='TMDb' GROUP BY uniqueName HAVING COUNT(film_id) > 1;

-- Step 1 all dups - Get the 2nd film_id SELECT FROM film_source WHERE source_name='TMDb' AND uniqueName='ep1136939' -- Step 2 Get TV Series uniqueName, Season and Episode number SELECT f.id, f.parent_id, f.title, f.season, f.episodeNumber, f.episodeTitle, parentfs.uniqueName parent_un FROM film f, film_source parentfs WHERE f.id=1902 AND f.parent_id=parentfs.film_id AND parentfs.source_name='TMDb'; -- Step 3 Get the correct episode uniqueName https://api.themoviedb.org/3/tv/62823/season/1/episode/1?api_key=b34fb5c8c7ad394135edc8236bbb7b05&language=en-US -- Step 4 Update the correct uniqueName UPDATE film_source SET uniqueName='ep1068354' WHERE film_id=1902 AND source_name='TMDb' AND uniqueName='ep1136939'; -- Step 5 Are there extra film rows for the tv series? SELECT FROM film WHERE title='Glitch' ORDER BY season, episodeNumber

thereido commented 2 years ago

The issue38.php script has been tested. It covers movies, tv shows, and tv episodes. Each type (movie/show/episode) is handled in a different way.

Movies:

TV Shows:

TV Episodes:

thereido commented 2 years ago

Fixed the db in BW prod today with version commit https://github.com/thereido/RatingSync/commit/fd261f83fdc92aa12a251af4fc9f6268cbe24cf0

This only fixes existing db problems. It does not stop it from happening again. A full code fix is needed... maybe. Reevaluate it after issue #37 is fixed.

thereido commented 2 years ago

Issue #38 is fixed. I don't think it affects this issue. However, the current code does not seem to be cause this issue anymore. I don't think it's worth debugging it unless it comes up again.