# Path: subdownloader/provider/imdb.py
# class ImdbMovieMatch:
#     def __init__(self, imdb_id: str, title: str, year: Optional[int]):
#         self.imdb_id = imdb_id
#         self.title = title
#         self.year = year
# 
#     @property
#     def url(self) -> str:
#         return 'https://www.imdb.com/title/{}'.format(self.imdb_id)
# 
#     @property
#     def title_year(self) -> str:
#         return '{}{}'.format(self.title, ' ({})'.format(self.year) if self.year is not None else '')
# 
#     def serialize(self) -> str:
#         year_str = '' if self.year is None else str(self.year)
#         return '{},{},{}'.format(self.imdb_id, year_str, self.title)
# 
#     @classmethod
#     def deserialize(cls, data: str) -> Optional['ImdbMovieMatch']:
#         try:
#             [imdb_id, year_str, title] = data.split(',', 2)
#             year = int(year_str.strip()) if year_str else None
#             return cls(imdb_id.strip(), title.strip(), year)
#         except ValueError:
#             return None


from subdownloader.provider.imdb import ImdbMovieMatch
from typing import Optional, Sequence
from PyQt5.QtCore import QModelIndex, QObject, Qt, QAbstractTableModel
# -*- coding: utf-8 -*-
# Copyright (c) 2019 SubDownloader Developers - See COPYING - GPLv3



class ImdbSearchModel(QAbstractTableModel):
    NB_COLS = 2
    COL_IMDB_ID = 0
    COL_NAME = 1

    def __init__(self, parent: QObject=None):
        QAbstractTableModel.__init__(self, parent)
        self._imdb_data = []
        self._headers = None


# Path: subdownloader/provider/imdb.py
# class ImdbMovieMatch:
#     def __init__(self, imdb_id: str, title: str, year: Optional[int]):
#         self.imdb_id = imdb_id
#         self.title = title
#         self.year = year
# 
#     @property
#     def url(self) -> str:
#         return 'https://www.imdb.com/title/{}'.format(self.imdb_id)
# 
#     @property
#     def title_year(self) -> str:
#         return '{}{}'.format(self.title, ' ({})'.format(self.year) if self.year is not None else '')
# 
#     def serialize(self) -> str:
#         year_str = '' if self.year is None else str(self.year)
#         return '{},{},{}'.format(self.imdb_id, year_str, self.title)
# 
#     @classmethod
#     def deserialize(cls, data: str) -> Optional['ImdbMovieMatch']:
#         try:
#             [imdb_id, year_str, title] = data.split(',', 2)
#             year = int(year_str.strip()) if year_str else None
#             return cls(imdb_id.strip(), title.strip(), year)
#         except ValueError:
#             return None


# Path: subdownloader/client/gui/models/imdbSearchModel.py
from subdownloader.provider.imdb import ImdbMovieMatch
from typing import Optional, Sequence
from PyQt5.QtCore import QModelIndex, QObject, Qt, QAbstractTableModel

# -*- coding: utf-8 -*-
# Copyright (c) 2019 SubDownloader Developers - See COPYING - GPLv3



class ImdbSearchModel(QAbstractTableModel):
    NB_COLS = 2
    COL_IMDB_ID = 0
    COL_NAME = 1

    def __init__(self, parent: QObject=None):
        QAbstractTableModel.__init__(self, parent)
        self._imdb_data = []
        self._headers = None


    def set_imdb_data(self, imdb_data: Sequence[ImdbMovieMatch]) -> None: