# Path: resources/lib/model/apiresponse.py
# class ApiResponse:
#     def __init__(self, name=None, year=None, genre=None, plot=None, posters=None, fanarts=None):
#         if genre is None:
#             genre = []
#         if posters is None:
#             posters = []
#         if fanarts is None:
#             fanarts = {}
# 
#         self.name = name
#         self.year = year
#         self.genre = genre
#         self.plot = plot
#         self.posters = posters
#         self.fanarts = fanarts
# 
#     @classmethod
#     def from_dict(cls, name=None, year=None, genre=None, plot=None, posters=None, fanarts=None, **kwargs):
#         return cls(name, year, genre, plot, posters, fanarts)
# 
# Path: resources/lib/model/fanart.py
# class Fanart:
#     def __init__(self, original=None, thumb=None):
#         self.original = original
#         self.thumb = thumb
# 
#     def get_original(self):
#         return self.original
# 
#     def set_original(self, original):
#         self.original = original
# 
#     def get_thumb(self):
#         return self.thumb
# 
#     def set_thumb(self, thumb):
#         self.thumb = thumb


import os
import subprocess
    import xbmcgui
from xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import Element
    from xbmcswift2 import xbmcgui
from abcscraper import AbstractScraper
from resources.lib.model.apiresponse import ApiResponse
from resources.lib.model.fanart import Fanart
        base_img_url = root.find('baseImgUrl').text

        for game in root.findall('Game'):
            if game.find('Platform').text == 'PC':
                if game.find('ReleaseDate') is not None:
                    data['year'] = os.path.basename(game.find('ReleaseDate').text)
                if game.find('Overview') is not None:
                    data['plot'] = game.find('Overview').text
                for img in game.find('Images'):
                    if img.get('side') == 'front':
                        data['posters'].append(os.path.join(base_img_url, img.text))
                    if img.tag == 'fanart':
                        image = Fanart()
                        image.set_original(os.path.join(base_img_url, img.find('original').text))
                        image.set_thumb(os.path.join(base_img_url, img.find('thumb').text))
                        data['fanarts'].append(image)
                        del image
                if game.find('Genres') is not None:
                    for genre in game.find('Genres'):
                        data['genre'].append(str(genre.text))
                if game.find('Similar') is not None:
                    for similar in game.find('Similar'):
                        if similar.tag == 'Game':
                            similar_id.append(similar.find('id').text)
                break

        for game in root.findall('Game'):
            if game.find('id').text in similar_id:
                for img in game.find('Images'):
                    if img.tag == 'fanart':

# Path: resources/lib/model/apiresponse.py
# class ApiResponse:
#     def __init__(self, name=None, year=None, genre=None, plot=None, posters=None, fanarts=None):
#         if genre is None:
#             genre = []
#         if posters is None:
#             posters = []
#         if fanarts is None:
#             fanarts = {}
# 
#         self.name = name
#         self.year = year
#         self.genre = genre
#         self.plot = plot
#         self.posters = posters
#         self.fanarts = fanarts
# 
#     @classmethod
#     def from_dict(cls, name=None, year=None, genre=None, plot=None, posters=None, fanarts=None, **kwargs):
#         return cls(name, year, genre, plot, posters, fanarts)
# 
# Path: resources/lib/model/fanart.py
# class Fanart:
#     def __init__(self, original=None, thumb=None):
#         self.original = original
#         self.thumb = thumb
# 
#     def get_original(self):
#         return self.original
# 
#     def set_original(self, original):
#         self.original = original
# 
#     def get_thumb(self):
#         return self.thumb
# 
#     def set_thumb(self, thumb):
#         self.thumb = thumb


# Path: resources/lib/scraper/tgdbscraper.py
import os
import subprocess
    import xbmcgui
from xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import Element
    from xbmcswift2 import xbmcgui
from abcscraper import AbstractScraper
from resources.lib.model.apiresponse import ApiResponse
from resources.lib.model.fanart import Fanart

        base_img_url = root.find('baseImgUrl').text

        for game in root.findall('Game'):
            if game.find('Platform').text == 'PC':
                if game.find('ReleaseDate') is not None:
                    data['year'] = os.path.basename(game.find('ReleaseDate').text)
                if game.find('Overview') is not None:
                    data['plot'] = game.find('Overview').text
                for img in game.find('Images'):
                    if img.get('side') == 'front':
                        data['posters'].append(os.path.join(base_img_url, img.text))
                    if img.tag == 'fanart':
                        image = Fanart()
                        image.set_original(os.path.join(base_img_url, img.find('original').text))
                        image.set_thumb(os.path.join(base_img_url, img.find('thumb').text))
                        data['fanarts'].append(image)
                        del image
                if game.find('Genres') is not None:
                    for genre in game.find('Genres'):
                        data['genre'].append(str(genre.text))
                if game.find('Similar') is not None:
                    for similar in game.find('Similar'):
                        if similar.tag == 'Game':
                            similar_id.append(similar.find('id').text)
                break

        for game in root.findall('Game'):
            if game.find('id').text in similar_id:
                for img in game.find('Images'):
                    if img.tag == 'fanart':

                        image = Fanart()