Beispiel #1
0
    def setUp(self):
        settings.init()

        settings.manga_format = 'png'
        settings.destination_path = os.path.join('.', 'tests', 'test_download')

        if not os.path.exists(settings.destination_path):
            os.makedirs(settings.destination_path)
Beispiel #2
0
def main():
    settings.init()
    Thread(target=run_web_server).start()
    Thread(target=run_registration_server).start()

    #start threads for each of the clients that are in the settings file
    #for id, port in settings.ports_map.items():
    #print(id, port)
    Thread(target=run_cam_socket, kwargs=dict(p=8002)).start()
Beispiel #3
0
def main(arguments):
    settings.init(arguments)

    browser = settings.browser

    for anime in settings.animes:
        download_anime(browser, anime)


    browser.dispose()
def main ():
  computed_feature_vectors = {} # used to avoid recomputation of SIFT features

  try:
    settings.init()
    settings.check_settings()
    settings.print_settings()
  except NameError as ne:
    print('NameError: {0}'.format(ne))

  attributes = read_file(settings.filepaths['attributes'])
  images = read_file(settings.filepaths['images'])
  votes_tmp = read_file(settings.filepaths['votes'])
  votes = split_entries(votes_tmp, ' ')

  # check if min-max-scaler was already instantiated
  # if so, open and use it
  # otherwise, geneate min-max-scaler pickle file and use it
  try:
    used_scaler = scaler.open_if_exists()
    print('[IRS] Using existing scaler pickle file')
  except IOError as ioe:
    print('[IRS] Scaler pickle file does not exist')
    print('[IRS] Hence it will now be created (may take some time)')
    used_scaler = scaler.create(images, computed_feature_vectors)

  # check if k-means clustering was already done
  # if so, open and use it
  # otherwise, generate k-means clustering pickle file and use it
  try:
    used_kmeanspp = kmeanspp.open_if_exists()
    print('[IRS] Using existing k-means++ pickle file')
  except IOError as ioe:
    print('[IRS] k-means++ pickle file does not exist')
    print('[IRS] Hence this will now be created (may take some time)')
    used_kmeanspp = kmeanspp.create(images, computed_feature_vectors, used_scaler)

  #
  ai_dict, aic_dict = map_images_to_attributes(attributes, images, votes)

  # generate splits and train classifiers
  classifiers = bow.learn_and_evaluate(attributes, ai_dict, aic_dict,
    'symmetric', './', computed_feature_vectors, used_scaler, used_kmeanspp
  )
  print('Trained classifiers for {} attributes (10 each; total: {})'.format(
    len(classifiers), get_total_classifier_count(classifiers)
  ))

  # recognize scenes
  scene_rec.learn_and_evaluate(used_scaler, used_kmeanspp, classifiers)
Beispiel #5
0
def main():
    settings.init()

    settings.config_file = DEFAULT_CONFIG_FILE

    arguments = get_arguments(sys.argv[1:])

    if arguments.verbose:
        settings.logger.setLevel(logging.DEBUG)
        formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: %(module)s :: %(lineno)s :: %(funcName)s :: %(message)s')
        stream_handler = logging.StreamHandler()
        stream_handler.setFormatter(formatter)

        if arguments.verbose == 0:
            settings.logger.setLevel(logging.NOTSET)
        elif arguments.verbose == 1:
            settings.logger.setLevel(logging.DEBUG)
        elif arguments.verbose == 2:
            settings.logger.setLevel(logging.INFO)
        elif arguments.verbose == 3:
            settings.logger.setLevel(logging.WARNING)
        elif arguments.verbose == 4:
            settings.logger.setLevel(logging.ERROR)
        elif arguments.verbose == 5:
            settings.logger.setLevel(logging.CRITICAL)

        settings.logger.addHandler(stream_handler)

    if arguments.config_file:
        settings.config_file = arguments.config_file

    if arguments.destination_path:
        settings.destination_path = arguments.destination_path

    if arguments.format:
        settings.manga_format = arguments.format

    if arguments.remove:
        remove = arguments.remove

    config = get_config(settings.config_file)

    mangas = []

    if config['mangas'] is not None:
        mangas = config['mangas']

    if settings.destination_path is None:
        if config['destinationPath'] is not None:
            settings.destination_path = config['destinationPath']
        else:
            settings.destination_path = DEFAULT_DESTINATION_PATH

    if settings.manga_format is None:
        if config['mangaFormat'] is not None:
            settings.manga_format = config['mangaFormat']
        else:
            settings.manga_format = DEFAULT_MANGA_FORMAT

    settings.logger.debug('mangas : %s', mangas)
    settings.logger.debug('settings : %s', settings)
    settings.logger.debug('settings.manga_format : %s', settings.manga_format)
    settings.logger.debug('remove : %s', remove)

    scraper = cfscrape.create_scraper()

    for manga in mangas:
        download_manga(scraper, manga)
 def onSettingsChanged( self ):
     settings.init()
     settings.readSettings()
Beispiel #7
0
from __future__ import unicode_literals

import discord
from discord.ext import commands

import sys

import settings.settings as settings

from cogs.music_cog import Music
from cogs.random_cog import Random
from cogs.my_cog import MyCog

settings.init(sys.argv[1:])
intents = discord.Intents.default()
intents.members = True

bot = commands.Bot(
    command_prefix=commands.when_mentioned_or("!"),
    description="MyDiscordBot",
    intents=intents,
)


@bot.command()
async def rekt(context):

    if str(context.author) == "Harkame#2009":
        await context.send("Tchao")
        await bot.logout()
    else:
Beispiel #8
0
def mamba():
    # Setup all shared global utilities in settings module
    settings.init()
 def onSettingsChanged(self):
     settings.init()
     settings.readSettings()