Skip to content

Commit

Permalink
Fixed: Predefined indexers were missing config variable on new instal…
Browse files Browse the repository at this point in the history
…ls. Closes #548
  • Loading branch information
[email protected] authored and [email protected] committed Feb 15, 2017
1 parent e0091a9 commit 8078221
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 28 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Fixed: Repeating a movie search from the search history would use the wrong sear

Fixed: Use randomly generated API key instead of predefined. Thought that was already in there, oops...

Fixed: Predefined indexers were missing config variable on new installs. See [#548](https://github.com/theotherp/nzbhydra/issues/548).

### 0.2.201
Fixed: Hopefully fix database error for good.

Expand Down
27 changes: 14 additions & 13 deletions nzbhydra/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
{
"accessType": "both",
"categories": ["anime"],
"downloadLimit": None,
"enabled": False,
"hitLimit": 0,
"hitLimitResetTime": None,
Expand All @@ -57,6 +58,7 @@
{
"accessType": "internal",
"categories": [],
"downloadLimit": None,
"enabled": True,
"hitLimit": 0,
"hitLimitResetTime": None,
Expand All @@ -75,6 +77,7 @@
{
"accessType": "internal",
"categories": [],
"downloadLimit": None,
"enabled": True,
"hitLimit": 0,
"hitLimitResetTime": None,
Expand All @@ -94,6 +97,7 @@
{
"accessType": "internal",
"categories": [],
"downloadLimit": None,
"enabled": True,
"generalMinSize": 1,
"hitLimit": 0,
Expand All @@ -115,7 +119,7 @@
"main": {
"apikey": ''.join(random.choice('0123456789ABCDEF') for i in range(32)),
"branch": "master",
"configVersion": 34,
"configVersion": 35,
"dereferer": "http://www.dereferer.org/?$s",
"debug": False,
"externalUrl": None,
Expand Down Expand Up @@ -424,7 +428,7 @@ def logLogMessages():
for x in logMessages:
logger.log(x["level"], x["message"])
oldLogMessages = copy.copy(logMessages)
logMessages = []
logMessages = []
return oldLogMessages


Expand Down Expand Up @@ -468,7 +472,6 @@ def migrateConfig(config):
if config["main"]["configVersion"] < initialConfig["main"]["configVersion"]:
addLogMessage(20, "Migrating config")


if config["main"]["configVersion"] == 15:
with version_update(config, 16):
addLogMessage(20, "Moving indexers")
Expand Down Expand Up @@ -571,7 +574,7 @@ def migrateConfig(config):
}
for category in categoriesToMigrate:
if category + "min" in config["searching"]["categorysizes"]:
if category == "audiobook": #was saved as "audioookmin"
if category == "audiobook": # was saved as "audioookmin"
config["categories"]["categories"][category]["min"] = config["searching"]["categorysizes"]["audioookmin"]
else:
config["categories"]["categories"][category]["min"] = config["searching"]["categorysizes"][category + "min"]
Expand All @@ -585,7 +588,7 @@ def migrateConfig(config):
config["searching"].pop("categorysizes")
config["searching"]["forbiddenWords"] = config["searching"]["ignoreWords"]
config["searching"]["requiredWords"] = config["searching"]["requireWords"]

if config["main"]["configVersion"] == 19:
with version_update(config, 20):
for downloader in config["downloaders"]:
Expand Down Expand Up @@ -619,7 +622,7 @@ def migrateConfig(config):
addLogMessage(20, "Setting duplicate size threshold to 1 percent")
config["searching"]["duplicateSizeThresholdInPercent"] = 1.0

#Make super sure they're set...
# Make super sure they're set...
for indexer in config["indexers"]:
if "categories" not in indexer.keys():
addLogMessage(20, "Enabling %s for all categories" % indexer["name"])
Expand All @@ -629,7 +632,7 @@ def migrateConfig(config):
with version_update(config, 26):
addLogMessage(20, "Migrating API hit limit reset times to hour of day")
for indexer in config["indexers"]:
#When the migration from version 22 didn't work and I didn't know I told some people to manually convert the hitLimitResetTime so I must check that it's not already a number
# When the migration from version 22 didn't work and I didn't know I told some people to manually convert the hitLimitResetTime so I must check that it's not already a number
if "hitLimitResetTime" in indexer.keys() and indexer["hitLimitResetTime"] and not isinstance(indexer["hitLimitResetTime"], (int, long)):
t = arrow.get(indexer["hitLimitResetTime"])
addLogMessage(20, "Setting API hit limit reset time for indexer %s to hour of day %d" % (indexer["name"], t.hour))
Expand Down Expand Up @@ -742,15 +745,13 @@ def migrateConfig(config):
if "drunkenslug" in indexer["host"]:
indexer["host"] = "https://api.drunkenslug.com"

if config["main"]["configVersion"] == 33:
with version_update(config, 34):
if config["main"]["configVersion"] in [33, 34]:
with version_update(config, 35):
addLogMessage(20, "Adding empty download limit to all indexers")
for indexer in config["indexers"]:
indexer["downloadLimit"] = None


if "downloadLimit" not in indexer.keys():
indexer["downloadLimit"] = None


return config


Expand Down
14 changes: 7 additions & 7 deletions static/js/nzbhydra.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/js/nzbhydra.js.map

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions ui-src/js/config-fields-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -1183,9 +1183,9 @@ function getIndexerPresets(configuredIndexers) {
{
accessType: "both",
categories: ["anime"],
downloadLimit: 0,
downloadLimit: null,
enabled: false,
hitLimit: 0,
hitLimit: null,
hitLimitResetTime: null,
host: "https://anizb.org",
name: "anizb",
Expand All @@ -1202,9 +1202,9 @@ function getIndexerPresets(configuredIndexers) {
{
accessType: "internal",
categories: [],
downloadLimit: 0,
downloadLimit: null,
enabled: true,
hitLimit: 0,
hitLimit: null,
hitLimitResetTime: null,
host: "https://binsearch.info",
name: "Binsearch",
Expand All @@ -1223,7 +1223,7 @@ function getIndexerPresets(configuredIndexers) {
categories: [],
downloadLimit: null,
enabled: true,
hitLimit: 0,
hitLimit: null,
hitLimitResetTime: null,
host: "https://www.nzbclub.com",
name: "NZBClub",
Expand All @@ -1241,10 +1241,10 @@ function getIndexerPresets(configuredIndexers) {
{
accessType: "internal",
categories: [],
downloadLimit: 0,
downloadLimit: null,
enabled: true,
generalMinSize: 1,
hitLimit: 0,
hitLimit: null,
hitLimitResetTime: null,
host: "https://nzbindex.com",
name: "NZBIndex",
Expand Down

0 comments on commit 8078221

Please sign in to comment.