# 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 datetime
import time
import urllib.parse
import urllib.request
import json
import gzip
import socket
from trackma.lib.lib import lib
from trackma import utils
                    'tba',
                    'subtype',
                    'posterImage',
                    'startDate',
                    'endDate',
                    'abbreviatedTitles',
                    'averageRating',
                    'popularityRank',
                    'ratingRank',
                    'ageRating',
                    'ageRatingGuide',
                    'userCount',
                    'favoritesCount'
                ]),
                "page[limit]": "250",
            }

            if self.mediatype == 'anime':
                params['fields[anime]'] += ',nsfw'

            if self.mediatype == 'manga':
                params['fields[manga]'] += ',serialization'

            url = "{}/library-entries?{}".format(
                self.prefix, urllib.parse.urlencode(params))
            i = 1

            while url:
                self.msg.info(self.name, 'Getting page {}...'.format(i))


# 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/libkitsu.py
import datetime
import time
import urllib.parse
import urllib.request
import json
import gzip
import socket
from trackma.lib.lib import lib
from trackma import utils

                    'tba',
                    'subtype',
                    'posterImage',
                    'startDate',
                    'endDate',
                    'abbreviatedTitles',
                    'averageRating',
                    'popularityRank',
                    'ratingRank',
                    'ageRating',
                    'ageRatingGuide',
                    'userCount',
                    'favoritesCount'
                ]),
                "page[limit]": "250",
            }

            if self.mediatype == 'anime':
                params['fields[anime]'] += ',nsfw'

            if self.mediatype == 'manga':
                params['fields[manga]'] += ',serialization'

            url = "{}/library-entries?{}".format(
                self.prefix, urllib.parse.urlencode(params))
            i = 1

            while url:
                self.msg.info(self.name, 'Getting page {}...'.format(i))


                data = self._request('GET', url)