# Path: resources/lib/modules/cache.py
# def get(function, timeout_hour, *args, **kargs):
# def clear_item(function, *args, **kargs):
# def __get_from_cache(dbcur, table, f, a, timeout_hour):
# def __execute_origin(dbcur, dbcon, function, table, f, a, response, *args, **kargs):
# def delete_file():
# def clear(table=None):
# 
# Path: resources/lib/modules/workers.py
# class Thread(threading.Thread):
# class Workers:
#     def __init__(self, target, *args):
#     def run(self):
#     def get_result(self):
#     def globaltrace(self, frame, event, arg):
#     def localtrace(self, frame, event, arg):
#     def kill(self):
#     def __init__(self, concurrent=30, queue_size=None, target=None, expect_result=True):
#         def _queue_worker():
#     def put(self, item):
#     def join(self):
#     def terminate(self):


from auth import PLATFORM
from auth import get_request_data
from resources.lib.modules import cache
from resources.lib.modules import workers
import requests
import resources.lib.modules.control as control
import scraper_live
import player
import os
import urllib
                } for content in contents if content.get('type', '') in ['tvshow', 'movie', 'episode']]

    [i['thread'].start() for i in threads]
    [i['thread'].join() for i in threads]

    return [_hydrate_content(next((next(iter(t['thread'].get_result().get('response', [])), {}) for t in threads if t['id'] == content.get('id', -1)), content)) for content in contents]


def _get_content(id):
    url = 'https://www.nowonline.com.br/avsclient/contents?id={id}&include=images&include=details&include=adult&channel={platform}'.format(platform=PLATFORM, id=id)
    return request_logged_in(url)


def _hydrate_content(content):
    playable = content.get('type', '') == 'movie' or content.get('type', '') == "episode"
    return {
                'handler': PLAYER_HANDLER if playable else __name__,
                'method': 'playlive' if playable else 'get_seasons',
                'IsPlayable': playable,
                'id': content.get('id'),
                'label': content.get('title', ''),
                'title': content.get('title', ''),
                'mediatype': 'movie' if content.get('type', '') == 'movie' else 'episode' if content.get('type', '') == "episode" else 'tvshow',
                'plot': content.get('description'),
                'plotoutline': content.get('description'),
                'genre': content.get('genres', []),
                'year': content.get('releaseYear'),
                'country': content.get('country'),
                'director': content.get('directors', []),
                'cast': content.get('actors', []),

# Path: resources/lib/modules/cache.py
# def get(function, timeout_hour, *args, **kargs):
# def clear_item(function, *args, **kargs):
# def __get_from_cache(dbcur, table, f, a, timeout_hour):
# def __execute_origin(dbcur, dbcon, function, table, f, a, response, *args, **kargs):
# def delete_file():
# def clear(table=None):
# 
# Path: resources/lib/modules/workers.py
# class Thread(threading.Thread):
# class Workers:
#     def __init__(self, target, *args):
#     def run(self):
#     def get_result(self):
#     def globaltrace(self, frame, event, arg):
#     def localtrace(self, frame, event, arg):
#     def kill(self):
#     def __init__(self, concurrent=30, queue_size=None, target=None, expect_result=True):
#         def _queue_worker():
#     def put(self, item):
#     def join(self):
#     def terminate(self):


# Path: resources/lib/modules/netnow/scraper_vod.py
from auth import PLATFORM
from auth import get_request_data
from resources.lib.modules import cache
from resources.lib.modules import workers
import requests
import resources.lib.modules.control as control
import scraper_live
import player
import os
import urllib

                } for content in contents if content.get('type', '') in ['tvshow', 'movie', 'episode']]

    [i['thread'].start() for i in threads]
    [i['thread'].join() for i in threads]

    return [_hydrate_content(next((next(iter(t['thread'].get_result().get('response', [])), {}) for t in threads if t['id'] == content.get('id', -1)), content)) for content in contents]


def _get_content(id):
    url = 'https://www.nowonline.com.br/avsclient/contents?id={id}&include=images&include=details&include=adult&channel={platform}'.format(platform=PLATFORM, id=id)
    return request_logged_in(url)


def _hydrate_content(content):
    playable = content.get('type', '') == 'movie' or content.get('type', '') == "episode"
    return {
                'handler': PLAYER_HANDLER if playable else __name__,
                'method': 'playlive' if playable else 'get_seasons',
                'IsPlayable': playable,
                'id': content.get('id'),
                'label': content.get('title', ''),
                'title': content.get('title', ''),
                'mediatype': 'movie' if content.get('type', '') == 'movie' else 'episode' if content.get('type', '') == "episode" else 'tvshow',
                'plot': content.get('description'),
                'plotoutline': content.get('description'),
                'genre': content.get('genres', []),
                'year': content.get('releaseYear'),
                'country': content.get('country'),
                'director': content.get('directors', []),
                'cast': content.get('actors', []),

                'episode': content.get('episodeNumber'),