# Path: trackma/utils.py
# VERSION = '0.8.4'
# DATADIR = os.path.dirname(__file__) + '/data'
#     PASSWD = auto()
#     OAUTH = auto()
#     OAUTH_PKCE = auto()
#     UNKNOWN = 'Unknown'
#     ONGOING = 'Ongoing'
#     FINISHED = 'Finished'
#     NOTYET = 'Not yet started'
#     CANCELLED = 'Cancelled'
#     OTHER = 'Other'
#     AIRING = ONGOING
#     RELEASING = ONGOING
#     PUBLISHING = ONGOING
#     CURRENTLY_AIRING = ONGOING
#     FINISHED_AIRING = FINISHED
#     NOT_YET_AIRED = NOTYET
#     NOT_YET_RELEASED = NOTYET
#     NOT_YET_PUBLISHED = NOTYET
#     UNKNOWN = "Unknown"
#     OTHER = "Other"
#     TV = "TV"
#     MOVIE = "Movie"
#     OVA = "OVA"
#     SPECIAL = "Special"
#     MANGA = "Manga"
#     NOVEL = "Novel"
#     ONE_SHOT = "One Shot"
#     SP = SPECIAL
#     MUSIC = OTHER
#     ONA = OVA
#     NOVIDEO = auto()
#     PLAYING = auto()
#     UNRECOGNIZED = auto()
#     NOT_FOUND = auto()
#     IGNORED = auto()
#     WINTER = 'Winter'
#     SPRING = 'Spring'
#     SUMMER = 'Summer'
#     FALL = 'Fall'
#     KEYWORD = auto()
#     SEASON = auto()
#     KW = KEYWORD
# HOME = os.path.expanduser("~")
# EXTENSIONS = ('.mkv', '.mp4', '.avi', '.ts')
# class Login(Enum):
# class BaseEnum(Enum):
# class Status(BaseEnum):
# class Type(BaseEnum):
# class Tracker(Enum):
# class Season(Enum):
# class SearchMethod(Enum):
# class TrackmaError(Exception):
# class EngineError(TrackmaError):
# class DataError(TrackmaError):
# class APIError(TrackmaError):
# class AccountError(TrackmaError):
# class TrackmaFatal(Exception):
# class EngineFatal(TrackmaFatal):
# class DataFatal(TrackmaFatal):
# class APIFatal(TrackmaFatal):
#     def find(cls, name):
#     def from_int(cls, index):
#     def __int__(self):
#     def __lt__(self, other):
#     def __le__(self, other):
#     def __gt__(self, other):
#     def __ge__(self, other):
#     def __add__(self, other):
#     def __str__(self):
# def oauth_generate_pkce() -> str:
# def parse_config(filename, default):
# def save_config(config_dict, filename):
# def load_data(filename):
# def save_data(data, filename):
# def log_error(msg):
# def expand_path(path):
# def expand_paths(paths):
# def is_media(filename):
# def regex_find_videos(subdirectory=''):
# def regex_rename_files(pattern, source_dir, dest_dir):
# def list_library(path):
# def make_dir(path):
# def dir_exists(dirname):
# def file_exists(filename):
# def file_older_than(filename, mtime):
# def try_files(filenames):
# def sync_file(fname, sync_url):
# def copy_file(src, dest):
# def to_config_path(*paths):
# def to_data_path(*paths):
# def to_cache_path(*paths):
# def change_permissions(filename, mode):
# def estimate_aired_episodes(show):
# def guess_show(show_title, tracker_list):
# def redirect_show(show_tuple, redirections, tracker_list):
# def spawn_process(arg_list):
# def get_terminal_size(fd=1):
# def show():


import socket
import json
import datetime
import ssl
from trackma.lib.lib import lib
from trackma import utils
        'statuses':  [0, 1, 2, 3],
        'statuses_dict': {0: 'High', 1: 'Medium', 2: 'Low', 3: 'Blacklist'},
        'score_max': 10,
        'score_step': 0.1,
        'statuses_start': [],
        'statuses_finish': [],
    }

    def __init__(self, messenger, account, userconfig):
        """Initializes the useragent through credentials."""
        super(libvndb, self).__init__(messenger, account, userconfig)

        self.hostname = "api.vndb.org"
        self.tls = 19535
        self.tcp = 19534
        self.username = account['username']
        self.password = account['password']
        self.logged_in = False

    def _connect(self):
        """Create TCP socket and connect"""

        self.context = ssl.create_default_context()
        try:
            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.s = self.context.wrap_socket(s, server_hostname=self.hostname)
            self.s.connect((self.hostname, self.tls))
        except socket.error:
            raise utils.APIError("Connection error.")
        except ssl.CertificateError:

# Path: trackma/utils.py
# VERSION = '0.8.4'
# DATADIR = os.path.dirname(__file__) + '/data'
#     PASSWD = auto()
#     OAUTH = auto()
#     OAUTH_PKCE = auto()
#     UNKNOWN = 'Unknown'
#     ONGOING = 'Ongoing'
#     FINISHED = 'Finished'
#     NOTYET = 'Not yet started'
#     CANCELLED = 'Cancelled'
#     OTHER = 'Other'
#     AIRING = ONGOING
#     RELEASING = ONGOING
#     PUBLISHING = ONGOING
#     CURRENTLY_AIRING = ONGOING
#     FINISHED_AIRING = FINISHED
#     NOT_YET_AIRED = NOTYET
#     NOT_YET_RELEASED = NOTYET
#     NOT_YET_PUBLISHED = NOTYET
#     UNKNOWN = "Unknown"
#     OTHER = "Other"
#     TV = "TV"
#     MOVIE = "Movie"
#     OVA = "OVA"
#     SPECIAL = "Special"
#     MANGA = "Manga"
#     NOVEL = "Novel"
#     ONE_SHOT = "One Shot"
#     SP = SPECIAL
#     MUSIC = OTHER
#     ONA = OVA
#     NOVIDEO = auto()
#     PLAYING = auto()
#     UNRECOGNIZED = auto()
#     NOT_FOUND = auto()
#     IGNORED = auto()
#     WINTER = 'Winter'
#     SPRING = 'Spring'
#     SUMMER = 'Summer'
#     FALL = 'Fall'
#     KEYWORD = auto()
#     SEASON = auto()
#     KW = KEYWORD
# HOME = os.path.expanduser("~")
# EXTENSIONS = ('.mkv', '.mp4', '.avi', '.ts')
# class Login(Enum):
# class BaseEnum(Enum):
# class Status(BaseEnum):
# class Type(BaseEnum):
# class Tracker(Enum):
# class Season(Enum):
# class SearchMethod(Enum):
# class TrackmaError(Exception):
# class EngineError(TrackmaError):
# class DataError(TrackmaError):
# class APIError(TrackmaError):
# class AccountError(TrackmaError):
# class TrackmaFatal(Exception):
# class EngineFatal(TrackmaFatal):
# class DataFatal(TrackmaFatal):
# class APIFatal(TrackmaFatal):
#     def find(cls, name):
#     def from_int(cls, index):
#     def __int__(self):
#     def __lt__(self, other):
#     def __le__(self, other):
#     def __gt__(self, other):
#     def __ge__(self, other):
#     def __add__(self, other):
#     def __str__(self):
# def oauth_generate_pkce() -> str:
# def parse_config(filename, default):
# def save_config(config_dict, filename):
# def load_data(filename):
# def save_data(data, filename):
# def log_error(msg):
# def expand_path(path):
# def expand_paths(paths):
# def is_media(filename):
# def regex_find_videos(subdirectory=''):
# def regex_rename_files(pattern, source_dir, dest_dir):
# def list_library(path):
# def make_dir(path):
# def dir_exists(dirname):
# def file_exists(filename):
# def file_older_than(filename, mtime):
# def try_files(filenames):
# def sync_file(fname, sync_url):
# def copy_file(src, dest):
# def to_config_path(*paths):
# def to_data_path(*paths):
# def to_cache_path(*paths):
# def change_permissions(filename, mode):
# def estimate_aired_episodes(show):
# def guess_show(show_title, tracker_list):
# def redirect_show(show_tuple, redirections, tracker_list):
# def spawn_process(arg_list):
# def get_terminal_size(fd=1):
# def show():


# Path: trackma/lib/libvndb.py
import socket
import json
import datetime
import ssl
from trackma.lib.lib import lib
from trackma import utils

        'statuses':  [0, 1, 2, 3],
        'statuses_dict': {0: 'High', 1: 'Medium', 2: 'Low', 3: 'Blacklist'},
        'score_max': 10,
        'score_step': 0.1,
        'statuses_start': [],
        'statuses_finish': [],
    }

    def __init__(self, messenger, account, userconfig):
        """Initializes the useragent through credentials."""
        super(libvndb, self).__init__(messenger, account, userconfig)

        self.hostname = "api.vndb.org"
        self.tls = 19535
        self.tcp = 19534
        self.username = account['username']
        self.password = account['password']
        self.logged_in = False

    def _connect(self):
        """Create TCP socket and connect"""

        self.context = ssl.create_default_context()
        try:
            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.s = self.context.wrap_socket(s, server_hostname=self.hostname)
            self.s.connect((self.hostname, self.tls))
        except socket.error:
            raise utils.APIError("Connection error.")
        except ssl.CertificateError:

            raise utils.APIError("Insecure connection.")