mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 13:23:18 -07:00
fix minor bugs
This commit is contained in:
parent
2dae3116ee
commit
a4d8ac7df5
1 changed files with 30 additions and 27 deletions
|
@ -5,15 +5,17 @@ import os
|
||||||
|
|
||||||
def migrate():
|
def migrate():
|
||||||
confignew = ConfigParser.ConfigParser()
|
confignew = ConfigParser.ConfigParser()
|
||||||
|
confignew.optionxform = str
|
||||||
configFilenamenew = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg.sample")
|
configFilenamenew = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg.sample")
|
||||||
confignew.read(configFilenamenew)
|
confignew.read(configFilenamenew)
|
||||||
|
|
||||||
section = CouchPotato
|
|
||||||
original = []
|
|
||||||
configold = ConfigParser.ConfigParser()
|
configold = ConfigParser.ConfigParser()
|
||||||
|
confignew.optionxform = str
|
||||||
|
|
||||||
|
section = "CouchPotato"
|
||||||
|
original = []
|
||||||
configFilenameold = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
|
configFilenameold = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
|
||||||
if not os.path.isfile(configFilenameold): # lets look back for an older version.
|
if not os.path.isfile(configFilenameold): # lets look back for an older version.
|
||||||
configold = ConfigParser.ConfigParser()
|
|
||||||
configFilenameold = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMovie.cfg")
|
configFilenameold = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMovie.cfg")
|
||||||
if not os.path.isfile(configFilenameold): # no config available
|
if not os.path.isfile(configFilenameold): # no config available
|
||||||
configFilenameold = ""
|
configFilenameold = ""
|
||||||
|
@ -25,18 +27,18 @@ def migrate():
|
||||||
pass
|
pass
|
||||||
for item in original:
|
for item in original:
|
||||||
option, value = item
|
option, value = item
|
||||||
if option == "category" # change this old format
|
if option == "category": # change this old format
|
||||||
option = "cpsCategory"
|
option = "cpsCategory"
|
||||||
if option = "outputdirectory" # skip this old format
|
if option == "outputDirectory": # move this to new location format
|
||||||
|
value = os.path.split(os.path.normpath(outputdirectory))[0]
|
||||||
|
confignew.set("Torrent", option, value)
|
||||||
continue
|
continue
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
|
|
||||||
section = SickBeard
|
section = "SickBeard"
|
||||||
original = []
|
original = []
|
||||||
configold = ConfigParser.ConfigParser()
|
|
||||||
configFilenameold = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
|
configFilenameold = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
|
||||||
if not os.path.isfile(configFilenameold): # lets look back for an older version.
|
if not os.path.isfile(configFilenameold): # lets look back for an older version.
|
||||||
configold = ConfigParser.ConfigParser()
|
|
||||||
configFilenameold = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessTV.cfg")
|
configFilenameold = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessTV.cfg")
|
||||||
if not os.path.isfile(configFilenameold): # no config available
|
if not os.path.isfile(configFilenameold): # no config available
|
||||||
configFilenameold = ""
|
configFilenameold = ""
|
||||||
|
@ -48,15 +50,16 @@ def migrate():
|
||||||
pass
|
pass
|
||||||
for item in original:
|
for item in original:
|
||||||
option, value = item
|
option, value = item
|
||||||
if option == "category" # change this old format
|
if option == "category": # change this old format
|
||||||
option = "sbCategory"
|
option = "sbCategory"
|
||||||
if option = "outputdirectory" # skip this old format
|
if option == "outputDirectory": # move this to new location format
|
||||||
|
value = os.path.split(os.path.normpath(outputdirectory))[0]
|
||||||
|
confignew.set("Torrent", option, value)
|
||||||
continue
|
continue
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
|
|
||||||
section = HeadPhones
|
section = "HeadPhones"
|
||||||
original = []
|
original = []
|
||||||
configold = ConfigParser.ConfigParser()
|
|
||||||
configFilenameold = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
|
configFilenameold = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
|
||||||
if not os.path.isfile(configFilenameold):
|
if not os.path.isfile(configFilenameold):
|
||||||
configFilenameold = ""
|
configFilenameold = ""
|
||||||
|
@ -70,7 +73,7 @@ def migrate():
|
||||||
option, value = item
|
option, value = item
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
|
|
||||||
section = Mylar
|
section = "Mylar"
|
||||||
original = []
|
original = []
|
||||||
try:
|
try:
|
||||||
original = configold.items(section)
|
original = configold.items(section)
|
||||||
|
@ -80,7 +83,7 @@ def migrate():
|
||||||
option, value = item
|
option, value = item
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
|
|
||||||
section = Gamez
|
section = "Gamez"
|
||||||
original = []
|
original = []
|
||||||
try:
|
try:
|
||||||
original = configold.items(section)
|
original = configold.items(section)
|
||||||
|
@ -90,7 +93,7 @@ def migrate():
|
||||||
option, value = item
|
option, value = item
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
|
|
||||||
section = Torrent
|
section = "Torrent"
|
||||||
original = []
|
original = []
|
||||||
try:
|
try:
|
||||||
original = configold.items(section)
|
original = configold.items(section)
|
||||||
|
@ -98,12 +101,12 @@ def migrate():
|
||||||
pass
|
pass
|
||||||
for item in original:
|
for item in original:
|
||||||
option, value = item
|
option, value = item
|
||||||
if option in ["compressedextensions", "mediaextensions", "metaExtensions"]:
|
if option in ["compressedExtensions", "mediaExtensions", "metaExtensions"]:
|
||||||
section = Extensions # these were moved
|
section = "Extensions" # these were moved
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
section = Torrent # reset in case extensions out of order.
|
section = "Torrent" # reset in case extensions out of order.
|
||||||
|
|
||||||
section = Transcoder
|
section = "Transcoder"
|
||||||
original = []
|
original = []
|
||||||
try:
|
try:
|
||||||
original = configold.items(section)
|
original = configold.items(section)
|
||||||
|
@ -113,7 +116,7 @@ def migrate():
|
||||||
option, value = item
|
option, value = item
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
|
|
||||||
section = loggers
|
section = "loggers"
|
||||||
original = []
|
original = []
|
||||||
try:
|
try:
|
||||||
original = configold.items(section)
|
original = configold.items(section)
|
||||||
|
@ -123,7 +126,7 @@ def migrate():
|
||||||
option, value = item
|
option, value = item
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
|
|
||||||
section = handlers
|
section = "handlers"
|
||||||
original = []
|
original = []
|
||||||
try:
|
try:
|
||||||
original = configold.items(section)
|
original = configold.items(section)
|
||||||
|
@ -133,7 +136,7 @@ def migrate():
|
||||||
option, value = item
|
option, value = item
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
|
|
||||||
section = formatters
|
section = "formatters"
|
||||||
original = []
|
original = []
|
||||||
try:
|
try:
|
||||||
original = configold.items(section)
|
original = configold.items(section)
|
||||||
|
@ -143,7 +146,7 @@ def migrate():
|
||||||
option, value = item
|
option, value = item
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
|
|
||||||
section = logger_root
|
section = "logger_root"
|
||||||
original = []
|
original = []
|
||||||
try:
|
try:
|
||||||
original = configold.items(section)
|
original = configold.items(section)
|
||||||
|
@ -153,7 +156,7 @@ def migrate():
|
||||||
option, value = item
|
option, value = item
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
|
|
||||||
section = handler_console
|
section = "handler_console"
|
||||||
original = []
|
original = []
|
||||||
try:
|
try:
|
||||||
original = configold.items(section)
|
original = configold.items(section)
|
||||||
|
@ -163,7 +166,7 @@ def migrate():
|
||||||
option, value = item
|
option, value = item
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
|
|
||||||
section = formatter_generic
|
section = "formatter_generic"
|
||||||
original = []
|
original = []
|
||||||
try:
|
try:
|
||||||
original = configold.items(section)
|
original = configold.items(section)
|
||||||
|
@ -174,8 +177,8 @@ def migrate():
|
||||||
confignew.set(section, option, value)
|
confignew.set(section, option, value)
|
||||||
|
|
||||||
# writing our configuration file to 'autoProcessMedia.cfg.sample'
|
# writing our configuration file to 'autoProcessMedia.cfg.sample'
|
||||||
with open(configFilenamenew, 'wb') as configFile
|
with open(configFilenamenew, 'wb') as configFile:
|
||||||
config.write(configfile)
|
confignew.write(configFile)
|
||||||
|
|
||||||
# create a backup of our old config
|
# create a backup of our old config
|
||||||
backupname = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg.old")
|
backupname = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg.old")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue