repo migration
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
__author__ = 'Wendell Jones'
|
||||
import configparser
|
||||
import os
|
||||
import time
|
||||
class Config(object):
|
||||
global ROOTDIR
|
||||
def __init__(self, ROOTDIR):
|
||||
self.config_options = {}
|
||||
self.configurer = configparser.ConfigParser()
|
||||
self.read_settings(ROOTDIR)
|
||||
|
||||
def read_settings(self, ROOTDIR):
|
||||
if os.name == 'nt':
|
||||
self.configurer.read(ROOTDIR + '\\settings\\tvsync_settings.cfg')
|
||||
else:
|
||||
self.configurer.read(ROOTDIR + '/settings/tvsync_settings.cfg')
|
||||
print(f"Reading configuration file from {ROOTDIR}/settings")
|
||||
self.set_data()
|
||||
self.get_data()
|
||||
|
||||
def set_data(self):
|
||||
self.config_options['loglevel'] = self.configurer.get('global', 'loglevel')
|
||||
self.config_options['hostname'] = self.configurer.get('dbsettings', 'hostname')
|
||||
self.config_options['mghostname'] = self.configurer.get('dbsettings', 'mghostname')
|
||||
self.config_options['dbname'] = self.configurer.get('dbsettings', 'dbname')
|
||||
self.config_options['mgdbname'] = self.configurer.get('dbsettings', 'mgdbname')
|
||||
self.config_options['mysqlusername'] = self.configurer.get('dbsettings', 'mysqlusername')
|
||||
self.config_options['pgsqlusername'] = self.configurer.get('dbsettings', 'pgsqlusername')
|
||||
self.config_options['mssqlusername'] = self.configurer.get('dbsettings', 'mssqlusername')
|
||||
self.config_options['mysqlpassword'] = self.configurer.get('dbsettings', 'mysqlpassword')
|
||||
self.config_options['pgsqlpassword'] = self.configurer.get('dbsettings', 'pgsqlpassword')
|
||||
self.config_options['mssqlpassword'] = self.configurer.get('dbsettings', 'mssqlpassword')
|
||||
self.config_options['pgsqlport'] = self.configurer.get('dbsettings', 'pgsqlport')
|
||||
self.config_options['mysqlport'] = self.configurer.get('dbsettings', 'mysqlport')
|
||||
self.config_options['mssqlport'] = self.configurer.get('dbsettings', 'mssqlport')
|
||||
self.config_options['mgport'] = self.configurer.get('dbsettings', 'mgport')
|
||||
self.config_options['updatetype'] = self.configurer.get('updatetype', 'type')
|
||||
self.config_options['apitype'] = self.configurer.get('api', 'type')
|
||||
self.config_options['updateschema'] = self.configurer.get('database', 'updateschema')
|
||||
self.config_options['dbtype'] = self.configurer.get('database', 'dbtype')
|
||||
self.config_options['initdb'] = self.configurer.get('database', 'initialize')
|
||||
self.config_options['initload'] = self.configurer.get('database', 'initload')
|
||||
self.config_options['skipcache'] = self.configurer.get('updatetype', 'cacheskip')
|
||||
self.config_options['refreshcache'] = self.configurer.get('updatetype', 'refreshcache')
|
||||
self.config_options['full'] = self.configurer.get('updatetype', 'full')
|
||||
self.config_options['monthly'] = self.configurer.get('updatetype', 'monthly')
|
||||
self.config_options['weekly'] = self.configurer.get('updatetype', 'weekly')
|
||||
self.config_options['daily'] = self.configurer.get('updatetype', 'daily')
|
||||
self.config_options['12h'] = self.configurer.get('updatetype', '12h')
|
||||
self.config_options['6h'] = self.configurer.get('updatetype', '6h')
|
||||
self.config_options['custom'] = self.configurer.get('updatetype', 'custom')
|
||||
self.config_options['serieslist'] = list()
|
||||
self.config_options['timedifference'] = self.configurer.get('updatetype', self.config_options['updatetype'])
|
||||
self.config_options['current_timestamp'] = time.time()
|
||||
if self.config_options['timedifference'].lower() == 'full':
|
||||
self.config_options['timedifference'] = int(self.config_options['current_timestamp'])
|
||||
|
||||
def get_data(self):
|
||||
return self.config_options
|
||||
|
||||
def __del__(self):
|
||||
|
||||
pass
|
||||
@@ -0,0 +1,86 @@
|
||||
[global]
|
||||
loglevel=debug
|
||||
|
||||
[dbsettings]
|
||||
sqlserver_driver=ODBC Driver 13 for SQL Server
|
||||
hostname=192.168.128.7
|
||||
mghostname=192.168.128.8
|
||||
dbname=media_dbsync
|
||||
mgdbname=test2
|
||||
mysqlusername=root
|
||||
pgsqlusername=postgres
|
||||
mssqlusername=sa
|
||||
mysqlpassword=Optimus0329
|
||||
pgsqlpassword=Optimus0329
|
||||
mssqlpassword=Optimus0329
|
||||
pgsqlport=5432
|
||||
mysqlport=3306
|
||||
mssqlport=1433
|
||||
mgport=27017
|
||||
|
||||
[api]
|
||||
type=tvmaze
|
||||
|
||||
[json]
|
||||
seriesapi=http://api.tvmaze.com/shows?page=<pagenum>
|
||||
showapi=http://api.tvmaze.com/shows/<tvmazeid>
|
||||
episodeapi=http://api.tvmaze.com/shows/<tvmazeid>/episodes
|
||||
aliasapi=http://api.tvmaze.com/shows/<tvmazeid>/akas
|
||||
castapi=http://api.tvmaze.com/shows/<tvmazeid>/cast
|
||||
crewapi=http://api.tvmaze.com/shows/<tvmazeid>/crew
|
||||
creditsapi=http://api.tvmaze.com/people/<actorid>/castcredits
|
||||
updatesapi=http://api.tvmaze.com/updates/shows
|
||||
|
||||
[database]
|
||||
dbtype=pgsql
|
||||
updateschema=updates
|
||||
initialize=0
|
||||
initload=0
|
||||
|
||||
[updatetype]
|
||||
#valid values are: daily, weekly, monthly, full, custom
|
||||
type=full
|
||||
full=full
|
||||
monthly=1219200
|
||||
weekly=604800
|
||||
daily=86400
|
||||
12h=23200
|
||||
6h = 16600
|
||||
# If settype = custom set below line to the number of seconds you want updates for.
|
||||
custom=4150
|
||||
cacheskip = 1
|
||||
refreshcache = 0
|
||||
|
||||
# Field names for series insert query
|
||||
# field01: nextepisode,
|
||||
# field02: previousepisode,
|
||||
# field03: mazeurl,
|
||||
# field04: tvdbid,
|
||||
# field05: tvrageid,
|
||||
# field06: genres,
|
||||
# field07: tvmazeid,
|
||||
# field08: mediumimage,
|
||||
# field09: originalimage,
|
||||
# field10: showlanguage,
|
||||
# field11: seriesname,
|
||||
# field12: webchannelcountrycode,
|
||||
# field13: webchannelcountryname,
|
||||
# field14: webchannelcountrytimezone,
|
||||
# field15: webchannelid,
|
||||
# field16: webchannelname,
|
||||
# field17: networkcountrycode,
|
||||
# field18: networkcountryname,
|
||||
# field19: networkcountrytimezone,
|
||||
# field20: networkid,
|
||||
# field21: networkname,
|
||||
# field22: premierdate,
|
||||
# field23: showrating,
|
||||
# field24: showruntime,
|
||||
# field25: airdays,
|
||||
# field26: scheduletime,
|
||||
# field27: showstatus,
|
||||
# field28: showoverview,
|
||||
# field29: showtype,
|
||||
# field30: showupdated,
|
||||
# field31: apilink,
|
||||
# field32: showweight
|
||||
Reference in New Issue
Block a user