def db_a(self):

            LOGGER.info('creating db_a')

            c = config.Config()

            create_database(c, 'db_a')
Exemple #2
0
 def __init__(self, conf=config.Config(), RT=None, aliases=None):
     self.Config = conf
     if not RT:
         self.RT = rtorrent.rtorrent(self.Config.get("rtorrent_socket"))
     else:
         self.RT = RT
     self.handler = torrentHandler.Handler()
     self.aliases = aliases
Exemple #3
0
 def setUp(self):
     """ setup test, load config create temp directory
     :return:
     """
     conf_path = '%s/config/config.xml' % '/'.join(__file__.split('/')[:-1])
     self.output_path = '%s/output/' % '/'.join(__file__.split('/')[:-1])
     self.conf = config.Config(conf_path)
     self.tmpl = template.Template(target_root_directory=self.output_path)
     self.tmpl.set_config(self.conf.get())
     if not os.path.exists(self.output_path):
         os.mkdir(self.output_path)
Exemple #4
0
 def __init__(self, conf=config.Config(), RT=None, Log=None, Sockets=None, Aliases=None, DLHandler=None):
     self.config = conf
     if not RT:
         self.RT = rtorrent.rtorrent(self.config.get("rtorrent_socket"))
     else:
         self.RT = RT
     self.handler = torrentHandler.Handler()
     self.login = login.Login(conf=self.config)
     self.log = Log
     self.sockets = Sockets
     self.aliases = Aliases
     self.downloadHandler = DLHandler
     self.public_commands = {
         "get_torrent_info" : Handle(self.get_torrent_info, ["torrent_id"], ["html"]),
         "get_info_multi" : Handle(self.get_info_multi, ["view"], ["sortby", "reverse", "drop_down_ids"]),
         "get_torrent_row" : Handle(self.get_torrent_row, ["torrent_id"]),
         "pause_torrent" : Handle(self.pause_torrent, ["torrent_id"]),
         "stop_torrent" : Handle(self.stop_torrent, ["torrent_id"]),
         "start_torrent" : Handle(self.start_torrent, ["torrent_id"]),
         "remove_torrent" : Handle(self.remove_torrent, ["torrent_id"]),
         "delete_torrent" : Handle(self.delete_torrent, ["torrent_id"]),
         "hash_torrent" : Handle(self.hash_torrent, ["torrent_id"]),
         "get_file" : Handle(self.get_file, ["torrent_id", "filepath"]),
         "upload_torrent_socket" : Handle(self.upload_torrent_socket, ["torrent"], ["start"]),
         "upload_torrent" : Handle(self.upload_torrent, [], ["torrent", "start"]),
         "get_feeds" : Handle(self.get_feeds),
         "start_batch" : Handle(self.start_batch, ["torrentIDs"]),
         "pause_batch" : Handle(self.pause_batch, ["torrentIDs"]),
         "stop_batch" : Handle(self.stop_batch, ["torrentIDs"]),
         "remove_batch" : Handle(self.remove_batch, ["torrentIDs"]),
         "delete_batch" : Handle(self.delete_batch, ["torrentIDs"]),
         "get_tracker_favicon" : Handle(self.get_tracker_favicon, ["torrent_id"]),
         "verify_conf_value" : Handle(self.verify_conf_value, ["key", "value"]),
         "set_config_multiple" : Handle(self.set_config_multiple, ["keys","values"]),
         "get_refresh_rate" : Handle(self.getRefreshRate),
         "move_tracker" : Handle(self.moveTracker, ["url", "target_alias"]),
         "download_file" : Handle(self.downloadGen, ["torrentID", "path"]),
     }
Exemple #5
0
 def setUp(self):
     """ setup test, load config
     :return:
     """
     conf_path = '%s/config/config.xml' % '/'.join(__file__.split('/')[:-1])
     self.conf = config.Config(conf_path)
Exemple #6
0
import modules.quickstart as quickstart
import modules.driver as driver
import csv

GET_DATA = True
# GET_DATA = False
MAKE_REPORT = True
# MAKE_REPORT = False
DATE_NOW = datetime.datetime.now().strftime("%Y-%m-%d")
# DATE_NOW = "2019-02-17"
# DATE_NOW = (datetime.datetime.now()+datetime.timedelta(days=1)).strftime("%Y-%m-%d")

print('Starting...')
if GET_DATA:
    print('Getting Data...')
    my_config = config.Config(DATE_NOW)
    my_config.main()
    my_quickstart = quickstart.Quickstart(DATE_NOW)
    my_quickstart.main()
    print('CSVs Created')
if MAKE_REPORT:
    print('Creating Reports...')
    with open('output/' + DATE_NOW + '_rfv-merged-rgx.csv') as csvfile:
        csv_reader = csv.reader(csvfile, delimiter=',', quotechar='|')
        rows = []
        for row in csv_reader:
            if len(row) == 7:  # need a better check
                rows.append(row)
            else:
                print('skipping row: ', row)
    my_drivers = []
Exemple #7
0
 def __init__(self, name):
     self.name = name
     configuration = config.Config()
     self.api_key = configuration.api_key()
Exemple #8
0
    check = 0
    try:
        try:
            os.system("clear")
            check = int(raw_input(
             "\n========Main========\n Enter - Configuration file\n" \
             " 1 - Run program\n" \
             " 2 - Exit program (Ctr-c)" \
             "\nSet Action: "
            ))

        except (ValueError):
            pass

        #Configuration file object
        config_object = config.Config()

        os.system("clear")
        if check == 0:
            try:
                check = int(raw_input(
                 "\n========Config File Menu========\n"\
                 " Enter - Read file\n" \
                 " 1 - Override file\n" \
                 " 2 - exit\n" \
                 "\nConfiguration file - Set Action: "
                 #" 3 - ---\n:  \
                ))
            except (ValueError):
                pass
Exemple #9
0
#!/usr/bin/env python

from modules import config, login  #'real' modules
from modules import indexPage, detailPage, ajaxPage  # pages
from modules import optionsPage, rssPage  # pages

import cherrypy
import os

c = config.Config()
c.loadconfig()

global_config = {
    "server.socket_host": str(c.get("host")),
    "server.socket_port": c.get("port"),
    "server.ssl_certificate": c.get("ssl_certificate"),
    "server.ssl_private_key": c.get("ssl_private_key"),
    "tools.encode.on": True,
    "tools.encode.encoding": "utf-8",
}
app_config = {
    "/css": {
        "tools.staticdir.on": True,
        "tools.staticdir.root": os.getcwd(),
        "tools.staticdir.dir": "static/css/",
    },
    "/javascript": {
        "tools.staticdir.on": True,
        "tools.staticdir.root": os.getcwd(),
        "tools.staticdir.dir": "static/javascript",
    },
from discord.ext import commands
from modules import config
from os import getcwd, chdir, path, listdir
from pathlib import Path

bot = commands.Bot(command_prefix=config.Config().botPrefix)

if __name__ == '__main__':
    chdir(path.dirname(__file__))
    chdir('cogs')
    for dir in listdir(Path(getcwd())):
        if dir.endswith('.py'):
            bot.load_extension(f'cogs.{dir[:-3]}')

bot.run(config.Config().botToken)
from modules import config
import sqlite3
from os import getcwd, chdir, path
from pathlib import Path

config = config.Config()


def connect():
    chdir(path.dirname(__file__))
    conn = sqlite3.connect(f"{Path(getcwd()).parent}/{config.db_file}")
    return conn, conn.cursor()


def close(conn):
    conn.commit()
    conn.close()