Kodi Community Forum
How to change show ID in NFO files to be thetvdb instead of themoviedb - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: How to change show ID in NFO files to be thetvdb instead of themoviedb (/showthread.php?tid=361347)



How to change show ID in NFO files to be thetvdb instead of themoviedb - colinjones - 2021-03-13

Whilst juggling several client Kodis and a new RPI as my central/SQL Kodi, I told my most up to date library Kodi client to export all metadata to nfo files again. Set the appropriate options in advancedsettings so that watched/resume points all restore, then did a scan on the central RPI into the SQL library. All good so far.

I'm also setting up Sickrage/sab for the first time (finally getting off Sickbeard!) but when I tried to add 'existing' shows to it by scanning the HDD, it fails every time. When I inspected, I found that it was erroring out on the show ID. Sickrage uses thetvdb which I'm used to. But when I looked in the source tvshow.nfo files I can see that the show ID is themoviedb ID. I overlooked that Kodi now defaults to themoviedb. So I'm assuming that when I did the full export, it rewrote the .nfo files with the primary ID as themoviedb instead of the original which would have been thetvdb IDs. When I manually edit the .nfo file to change the ID back, Sickrage scans the show in just fine.

thought that I could just flip the library content settings over to thetvtb in Kodi and do another full export, telling it to overwrite existing files. But that doesn't seem to have reversed the problem. Should it? Is there an easy way to get thetvdb IDs back in as the show primary without loosing all my watched and resume point metadata?

<id>65494</id>
    <uniqueid type="imdb">tt4786824</uniqueid>
    <uniqueid type="tmdb" default="true">65494</uniqueid>
    <uniqueid type="tvdb">305574</uniqueid>


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - Karellen - 2021-03-13

(2021-03-13, 05:39)colinjones Wrote: thought that I could just flip the library content settings over to thetvtb in Kodi and do another full export, telling it to overwrite existing files. But that doesn't seem to have reversed the problem.
Nope that won't work. Simply changing a scrapers won't change anything already in the library.
Easiest option is to ensure you have TVDB scraper set, then Refresh the tv show. No need to refresh episodes when asked. This will download the TVDB data.

(2021-03-13, 05:39)colinjones Wrote:     <uniqueid type="imdb">tt4786824</uniqueid>
    <uniqueid type="tmdb" default="true">65494</uniqueid>
    <uniqueid type="tvdb">305574</uniqueid>
Well you have all three major ID's which is very helpful. If you don't want to Refresh, then change the ID's as follows...

xml:
<uniqueid type="imdb">tt4786824</uniqueid>
<uniqueid type="tmdb">65494</uniqueid>
<uniqueid type="tvdb" default="true">305574</uniqueid>
and, just as importantly, delete <id>65494</id>

I have no idea how Sickrage works, so I trust the above is enough.


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - colinjones - 2021-03-13

(2021-03-13, 06:10)Karellen Wrote:
(2021-03-13, 05:39)colinjones Wrote: thought that I could just flip the library content settings over to thetvtb in Kodi and do another full export, telling it to overwrite existing files. But that doesn't seem to have reversed the problem.
Nope that won't work. Simply changing a scrapers won't change anything already in the library.
Easiest option is to ensure you have TVDB scraper set, then Refresh the tv show. No need to refresh episodes when asked. This will download the TVDB data.
(2021-03-13, 05:39)colinjones Wrote:     <uniqueid type="imdb">tt4786824</uniqueid>
    <uniqueid type="tmdb" default="true">65494</uniqueid>
    <uniqueid type="tvdb">305574</uniqueid>
Well you have all three major ID's which is very helpful. If you don't want to Refresh, then change the ID's as follows...

xml:
<uniqueid type="imdb">tt4786824</uniqueid>
<uniqueid type="tmdb">65494</uniqueid>
<uniqueid type="tvdb" default="true">305574</uniqueid>
and, just as importantly, delete <id>65494</id>

I have no idea how Sickrage works, so I trust the above is enough.
Many many thanks for the advice!!

Modifying the .nfo file works (in fact I forgot to change the default tag and it still scanned it into Sickrage ok). Problem is there's hundreds of tvshow.nfos!! I'm researching whether I could use AWK to bulk change, or just bite the bullet and do it manually!

In any case, your first suggestion sounds interesting - just so I understand, I change the scraper (I already did this prior to re-trying the full export) and then refresh the TV show - I get that this will update the internal Kodi library db (I haven't pointed it at the central SQL server yet), but its the .nfo file on the source drive I'm trying to force the update to, so that I can then scan the whole library into the central SQL server. Will doing a show refresh also update the .nfo file? And if so, is there a way to do a bulk show refresh?! Or just do them one at a time?

Thanks again!


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - Karellen - 2021-03-13

(2021-03-13, 06:18)colinjones Wrote: . Will doing a show refresh also update the .nfo file?
No. You will need to run a Export Library. This will export to nfo files for your entire library. So decide which method you will use as if you do half manually and half with Refresh, then those nfo files you changed manually, will be overwritten by the Export.

Are you knowledgeable with SQL?


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - colinjones - 2021-03-13

(2021-03-13, 06:42)Karellen Wrote:
(2021-03-13, 06:18)colinjones Wrote: . Will doing a show refresh also update the .nfo file?
No. You will need to run a Export Library. This will export to nfo files for your entire library. So decide which method you will use as if you do half manually and half with Refresh, then those nfo files you changed manually, will be overwritten by the Export.

Are you knowledgeable with SQL?
So doing a show refresh, re-scrapes the data into the local db with thetbdb metadata and that changes the "id" attribute to be thetvdb's ID. Then I do an export, and that pushes the new metadata, including the new "id" attribute and the 'default' tag back out all the .nfo files?

(not enough SQL to attempt manipulating the db directly!)


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - Karellen - 2021-03-13

(2021-03-13, 07:42)colinjones Wrote: So doing a show refresh, re-scrapes the data into the local db with thetbdb metadata and that changes the "id" attribute to be thetvdb's ID. Then I do an export, and that pushes the new metadata, including the new "id" attribute and the 'default' tag back out all the .nfo files?
Correct.
Test a couple of shows first with that process, and make sure it works for you.

Also, the <id> attribute is deprecated. It remains for backwards compatibility.
It is this tag that works in later versions of Kodi (v16 and later)... <uniqueid type="tvdb" default="true">305574</uniqueid> And the true attribute is probably what Sickrage is looking for.


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - colinjones - 2021-03-13

(2021-03-13, 09:17)Karellen Wrote:
(2021-03-13, 07:42)colinjones Wrote: So doing a show refresh, re-scrapes the data into the local db with thetbdb metadata and that changes the "id" attribute to be thetvdb's ID. Then I do an export, and that pushes the new metadata, including the new "id" attribute and the 'default' tag back out all the .nfo files?
Correct.
Test a couple of shows first with that process, and make sure it works for you.

Also, the <id> attribute is deprecated. It remains for backwards compatibility.
It is this tag that works in later versions of Kodi (v16 and later)... <uniqueid type="tvdb" default="true">305574</uniqueid> And the true attribute is probably what Sickrage is looking for.

Many thanks for your advice! I will check it later tonight when I've got the media centre to myself!


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - colinjones - 2021-03-14

(2021-03-13, 09:25)colinjones Wrote:
(2021-03-13, 09:17)Karellen Wrote:
(2021-03-13, 07:42)colinjones Wrote: So doing a show refresh, re-scrapes the data into the local db with thetbdb metadata and that changes the "id" attribute to be thetvdb's ID. Then I do an export, and that pushes the new metadata, including the new "id" attribute and the 'default' tag back out all the .nfo files?
Correct.
Test a couple of shows first with that process, and make sure it works for you.

Also, the <id> attribute is deprecated. It remains for backwards compatibility.
It is this tag that works in later versions of Kodi (v16 and later)... <uniqueid type="tvdb" default="true">305574</uniqueid> And the true attribute is probably what Sickrage is looking for.

Many thanks for your advice! I will check it later tonight when I've got the media centre to myself!
hmmmm - I've obviously misunderstood something or I'm doing something wrong as it didn't work.
1) Confirmed that the scraper for the TV folder is definitely set to thetvdb
2) Picked 3 representative TV shows, opened their tvshow.nfo files and confirmed the <id> tag and 'default' option are as per previously noted, ie defaulting to tmdb and using tmdb's ID
3) In the Kodi UI, went each of the 3 TV shows in turn, long press context menu, chose Information, navigated to Refresh. Chose to not refresh all episodes, but said Yes to exporting thumbs, actors etc, and said Yes to overwriting any local data. The last option I assume tells it to ignore meta data in the local db, scrape it from thetvdb and replace it (this does not affect my resume points or watched status, thank goodness!) I believe you said this is the point it should get the replacement ID from thetvdb
4) Nav to Settings, Media, Video, export to separate files

I left that to run for a while, then checked the .nfo files in the morning - they haven't changed at all. Their modified dates haven't changed either.

Your instructions make complete sense, but it doesn't seem to have made any changes - have I missed something or done something stupid? Thanks for your help!


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - Karellen - 2021-03-14

(2021-03-14, 04:38)colinjones Wrote: 2) Picked 3 representative TV shows, opened their tvshow.nfo files and confirmed the <id> tag and 'default' option are as per previously noted, ie defaulting to tmdb and using tmdb's ID
Previously noted being...... Delete <id> tag as it is not needed.

(2021-03-14, 04:38)colinjones Wrote: 3) In the Kodi UI, went each of the 3 TV shows in turn, long press context menu, chose Information, navigated to Refresh. Chose to not refresh all episodes, but said Yes to exporting thumbs, actors etc, and said Yes to overwriting any local data. The last option I assume tells it to ignore meta data in the local db, scrape it from thetvdb and replace it (this does not affect my resume points or watched status, thank goodness!) I believe you said this is the point it should get the replacement ID from thetvdb
Yep, I think you have misunderstood something, somewhere.
You edited your nfo files, then you rescraped the shows and exported new nfo files. So Step 2 was lost and never used.

(2021-03-14, 04:38)colinjones Wrote: 4) Nav to Settings, Media, Video, export to separate files
And you have run an Export again? Why? You did that in step 3

(2021-03-14, 04:38)colinjones Wrote: have I missed something or done something stupid? Thanks for your help!
Not sure. If an export does not work it usually means there is nothing in the library, or your did not allow "Overwrite files" which means the original nfo files remain untouched.

As I said previously, I have no idea with sickbeard, I have no idea how it works, or what it wants, or what it is you are actually trying to get it to do. I am only trying to set you straight on which ID's to change. Whether this is the change that Sickbeard wants.... (you guessed it) I have no idea.


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - colinjones - 2021-03-14

(2021-03-14, 05:12)Karellen Wrote:
(2021-03-14, 04:38)colinjones Wrote: 2) Picked 3 representative TV shows, opened their tvshow.nfo files and confirmed the <id> tag and 'default' option are as per previously noted, ie defaulting to tmdb and using tmdb's ID
Previously noted being...... Delete <id> tag as it is not needed.
(2021-03-14, 04:38)colinjones Wrote: 3) In the Kodi UI, went each of the 3 TV shows in turn, long press context menu, chose Information, navigated to Refresh. Chose to not refresh all episodes, but said Yes to exporting thumbs, actors etc, and said Yes to overwriting any local data. The last option I assume tells it to ignore meta data in the local db, scrape it from thetvdb and replace it (this does not affect my resume points or watched status, thank goodness!) I believe you said this is the point it should get the replacement ID from thetvdb
Yep, I think you have misunderstood something, somewhere.
You edited your nfo files, then you rescraped the shows and exported new nfo files. So Step 2 was lost and never used.
(2021-03-14, 04:38)colinjones Wrote: 4) Nav to Settings, Media, Video, export to separate files
And you have run an Export again? Why? You did that in step 3
(2021-03-14, 04:38)colinjones Wrote: have I missed something or done something stupid? Thanks for your help!
Not sure. If an export does not work it usually means there is nothing in the library, or your did not allow "Overwrite files" which means the original nfo files remain untouched.

As I said previously, I have no idea with sickbeard, I have no idea how it works, or what it wants, or what it is you are actually trying to get it to do. I am only trying to set you straight on which ID's to change. Whether this is the change that Sickbeard wants.... (you guessed it) I have no idea.

Sorry - ignore my comments in Step 3, that step was only doing the refresh of the 3 specific shows, not exporting. All that comment was supposed to be with Step 4, which is the only time I exported. I just got the comments mixed up between steps.

Just to clarify - I understand what you are saying, that the <id> tag isn't needed. As I mentioned in my earlier email, I only manually modified a couple of tvshow.nfo files to confirm it resolved the issue for Sickrage. I am trying to avoid having to do it manually for all the tvshow.nfo files as there are hundreds of them! I was hoping that correcting the scraper and then refreshing shows, and exporting would overwrite the current .nfo files with new files that didn't have the <id> tag and had the 'default' option against thetvdb ID instead. Is that not the case?

If I have to manually edit all the .nfo files to fix them up, then can I achieve the same thing by completely deleting all the tvshow.nfo files for all shows, and doing another export? Surely that would force Kodi to create all new ones with the right format?

Thanks!


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - Karellen - 2021-03-14

(2021-03-14, 05:25)colinjones Wrote: Sorry - ignore my comments in Step 3, that step was only doing the refresh of the 3 specific shows, not exporting. All that comment was supposed to be with Step 4, which is the only time I exported. I just got the comments mixed up between steps.
ok, no problems

(2021-03-14, 05:25)colinjones Wrote: If I have to manually edit all the .nfo files to fix them up, then can I achieve the same thing by completely deleting all the tvshow.nfo files for all shows,
Yep. Bulk method...
  1. Remove the TV show Source from Kodi.
  2. Then do a bulk search and delete for tvshow.nfo. Don't delete the episode nfo files.
  3. Now scrape your tv shows back into Kodi, and you will have TVDB tvshow info.
  4. Run an Export to Separate Files and the nfo files will be updated.
  5. So does sickbeard read the tvshow.nfo?

(2021-03-14, 05:25)colinjones Wrote: I was hoping that correcting the scraper and then refreshing shows, and exporting would overwrite the current .nfo files with new files that didn't have the <id> tag and had the 'default' option against thetvdb ID instead.
When done correctly, that is what will happen. (single tv show method)
  1. Change scraper to TVDB,
  2. Refresh your TV Show from the Information Page
  3. Export to Separate Files.
  4. You should now have update tvshow.nfo files.



RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - colinjones - 2021-03-14

(2021-03-14, 05:53)Karellen Wrote:
(2021-03-14, 05:25)colinjones Wrote: If I have to manually edit all the .nfo files to fix them up, then can I achieve the same thing by completely deleting all the tvshow.nfo files for all shows,
Yep. Bulk method...
  1. Remove the TV show Source from Kodi.
  2. Then do a bulk search and delete for tvshow.nfo. Don't delete the episode nfo files.
  3. Now scrape your tv shows back into Kodi, and you will have TVDB tvshow info.
  4. Run an Export to Separate Files and the nfo files will be updated.
  5. So does sickbeard read the tvshow.nfo?
 
(2021-03-14, 05:25)colinjones Wrote: I was hoping that correcting the scraper and then refreshing shows, and exporting would overwrite the current .nfo files with new files that didn't have the <id> tag and had the 'default' option against thetvdb ID instead.
When done correctly, that is what will happen. (single tv show method)
  1. Change scraper to TVDB,
  2. Refresh your TV Show from the Information Page
  3. Export to Separate Files.
  4. You should now have update tvshow.nfo files.
So does sickbeard read the tvshow.nfo? - Yes it seems so. It relies on <id> at least, from my testing, but its likely that it uses the other tags in preference, I haven't tested exhaustively. In any case, I've not got that far yet, only manually tested a couple of shows. Now I need to work out how to bulk update.

When done correctly, that is what will happen. (single tv show method)
  1. Change scraper to TVDB,
  2. Refresh your TV Show from the Information Page
  3. Export to Separate Files.
  4. You should now have update tvshow.nfo files.
That's exactly what I did (albeit I messed up the explanation to you in my comment above!)
I had previously changed the scraper to TVDB, so I merely confirmed it was still set to that, which it was.
I Refreshed 3 different TV shows from their respective Information pages
I exported to separate files
But all three TV shows still had their old tvshow.nfo files with the incorrect tagging. 

Is there anything else I could be doing wrong with this process?

With the bulk method you outlined, you say I need to remove the source from Kodi to begin with - but that will clean the library, and I will loose all my watchedstatus/count and resume points. Is that step absolutely necessary? I'm not bothered about the other metadata so much, that can always be re-scraped, but the status of where we are up to in different shows etc would be a major pain to loose!

Thx!


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - Karellen - 2021-03-14

(2021-03-14, 06:08)colinjones Wrote: It relies on <id> at least
Ah, that is why you keep bringing up that tag. Right, so Sickbeard is still a few years behind in Kodi tags.

(2021-03-14, 06:08)colinjones Wrote: I Refreshed 3 different TV shows from their respective Information pages
I exported to separate files
But all three TV shows still had their old tvshow.nfo files with the incorrect tagging. 
Ok, I think I just spotted the mistake
Nfo files always, always, always have first priority. If you are trying to use the scraper, then you need to delete the NFO file, otherwise all Kodi does is keep reading the nfo file.


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - colinjones - 2021-03-14

(2021-03-14, 06:15)Karellen Wrote:
(2021-03-14, 06:08)colinjones Wrote: It relies on <id> at least
Ah, that is why you keep bringing up that tag. Right, so Sickbeard is still a few years behind in Kodi tags.
(2021-03-14, 06:08)colinjones Wrote: I Refreshed 3 different TV shows from their respective Information pages
I exported to separate files
But all three TV shows still had their old tvshow.nfo files with the incorrect tagging. 
Ok, I think I just spotted the mistake
Nfo files always, always, always have first priority. If you are trying to use the scraper, then you need to delete the NFO file, otherwise all Kodi does is keep reading the nfo file.
Right! Now that makes sense! I thought the export "overwrite" files meant those too, but in retrospect I guess that means just the thumbnails and other metadata files.

So back to the bulk method (then I'll leave you alone!) Can I do that without deleting the scraper first? Just delete all the tvshow.nfo files, the refresh each show individually, then export to separate files? Although, from what you say, the NFO files come first, the individual episode .nfos will retain the playcount/resume statuses won't they? As long as I've done a recent export, those should be up to date. Then I can delete all the tvshow.nfos, remove the source entirely and tell it to update/clean the library, then re-add the source and set TVDB and allow it to rescrape - this will bring in the resume/count meta, scrape all the other meta from online. Finally I can do a full export again to recreate all the tvshow.nfo files ready to be consolidated into the central SQL server.


RE: How to change show ID in NFO files to be thetvdb instead of themoviedb - Karellen - 2021-03-14

(2021-03-14, 06:25)colinjones Wrote: Can I do that without deleting the scraper first?
Not sure what you mean by this as you can't actually delete a scraper.

(2021-03-14, 06:25)colinjones Wrote: Just delete all the tvshow.nfo files, the refresh each show individually, then export to separate files?
Yes, but this is not the bulk method. This is the method to do each show individually.

(2021-03-14, 06:25)colinjones Wrote: the individual episode .nfos will retain the playcount/resume statuses won't they?
Yes they will.

(2021-03-14, 06:25)colinjones Wrote: As long as I've done a recent export, those should be up to date.
Yes

(2021-03-14, 06:25)colinjones Wrote: Then I can delete all the tvshow.nfos, remove the source entirely and tell it to update/clean the library, then re-add the source and set TVDB and allow it to rescrape - this will bring in the resume/count meta, scrape all the other meta from online. Finally I can do a full export again to recreate all the tvshow.nfo files ready to be consolidated into the central SQL server.
Yes, this is the bulk method and steps are correct in that order.
With the resume/playcount data, make sure you have those tags in advancedsettings as shown in section 1 here... https://kodi.wiki/view/Import-export_library/Video