Private GIT

Skip to content
Snippets Groups Projects
Commit 80726b30 authored by Dustyn Gibson's avatar Dustyn Gibson
Browse files

Add country tag to KODI 12+ tvshow.nfo

parent f643acaf
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@
import re
import datetime
from babelfish import Country
import sickbeard
from sickbeard.metadata import generic
......@@ -94,7 +95,7 @@ class KODI_12PlusMetadata(generic.GenericMetadata):
@staticmethod
def _split_info(info_string):
return {x.strip() for x in re.sub(r'[,/]*', '|', info_string).split('|') if x.strip()}
return {x.strip().title() for x in re.sub(r'[,/]+', '|', info_string).split('|') if x.strip()}
def _show_data(self, show_obj):
"""
......@@ -178,6 +179,16 @@ class KODI_12PlusMetadata(generic.GenericMetadata):
cur_genre = etree.SubElement(tv_node, "genre")
cur_genre.text = genre
if 'country_codes' in show_obj.imdb_info:
for country in self._split_info(show_obj.imdb_info['country_codes']):
try:
cur_country_name = Country(country.upper()).name.title()
except Exception:
continue
cur_country = etree.SubElement(tv_node, "country")
cur_country.text = cur_country_name
if getattr(myShow, 'firstaired', None):
premiered = etree.SubElement(tv_node, "premiered")
premiered.text = myShow["firstaired"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment