mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-23 01:20:11 +00:00
remove version, device, device_id options, set them automatically
not sure why i exposed these to the user in the first place. they are set to <jfa-go version>, <jfa-go>, <jfa-go-<version>-<commit>> respectively.
This commit is contained in:
parent
04a4a4ca95
commit
2a2435ae11
@ -10,7 +10,7 @@ before:
|
|||||||
hooks:
|
hooks:
|
||||||
- go mod download
|
- go mod download
|
||||||
- python3 config/fixconfig.py -i config/config-base.json -o data/config-base.json
|
- python3 config/fixconfig.py -i config/config-base.json -o data/config-base.json
|
||||||
- python3 config/generate_ini.py -i config/config-base.json -o data/config-default.ini --version {{.Version}}
|
- python3 config/generate_ini.py -i config/config-base.json -o data/config-default.ini
|
||||||
- python3 -m pip install libsass
|
- python3 -m pip install libsass
|
||||||
- python3 scss/get_node_deps.py
|
- python3 scss/get_node_deps.py
|
||||||
- python3 scss/compile.py -y
|
- python3 scss/compile.py -y
|
||||||
|
2
Makefile
2
Makefile
@ -2,7 +2,7 @@ configuration:
|
|||||||
$(info Fixing config-base)
|
$(info Fixing config-base)
|
||||||
python3 config/fixconfig.py -i config/config-base.json -o data/config-base.json
|
python3 config/fixconfig.py -i config/config-base.json -o data/config-base.json
|
||||||
$(info Generating config-default.ini)
|
$(info Generating config-default.ini)
|
||||||
python3 config/generate_ini.py -i config/config-base.json -o data/config-default.ini --version git
|
python3 config/generate_ini.py -i config/config-base.json -o data/config-default.ini
|
||||||
|
|
||||||
sass:
|
sass:
|
||||||
$(info Getting libsass)
|
$(info Getting libsass)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@ -72,6 +73,10 @@ func (app *appContext) loadConfig() error {
|
|||||||
app.config.Section("deletion").Key("email_html").SetValue(app.config.Section("deletion").Key("email_html").MustString(filepath.Join(app.local_path, "deleted.html")))
|
app.config.Section("deletion").Key("email_html").SetValue(app.config.Section("deletion").Key("email_html").MustString(filepath.Join(app.local_path, "deleted.html")))
|
||||||
app.config.Section("deletion").Key("email_text").SetValue(app.config.Section("deletion").Key("email_text").MustString(filepath.Join(app.local_path, "deleted.txt")))
|
app.config.Section("deletion").Key("email_text").SetValue(app.config.Section("deletion").Key("email_text").MustString(filepath.Join(app.local_path, "deleted.txt")))
|
||||||
|
|
||||||
|
app.config.Section("jellyfin").Key("version").SetValue(VERSION)
|
||||||
|
app.config.Section("jellyfin").Key("device").SetValue("jfa-go")
|
||||||
|
app.config.Section("jellyfin").Key("device_id").SetValue(fmt.Sprintf("jfa-go-%s-%s", VERSION, COMMIT))
|
||||||
|
|
||||||
app.email = NewEmailer(app)
|
app.email = NewEmailer(app)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -41,28 +41,7 @@
|
|||||||
"requires_restart": true,
|
"requires_restart": true,
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"value": "jfa-go",
|
"value": "jfa-go",
|
||||||
"description": "This and below settings will show on the Jellyfin dashboard when the program connects. You may as well leave them alone."
|
"description": "The name of the client that will show up in the Jellyfin dashboard."
|
||||||
},
|
|
||||||
"version": {
|
|
||||||
"name": "Version Number",
|
|
||||||
"required": true,
|
|
||||||
"requires_restart": true,
|
|
||||||
"type": "text",
|
|
||||||
"value": "{version}"
|
|
||||||
},
|
|
||||||
"device": {
|
|
||||||
"name": "Device Name",
|
|
||||||
"required": true,
|
|
||||||
"requires_restart": true,
|
|
||||||
"type": "text",
|
|
||||||
"value": "jfa-go"
|
|
||||||
},
|
|
||||||
"device_id": {
|
|
||||||
"name": "Device ID",
|
|
||||||
"required": true,
|
|
||||||
"requires_restart": true,
|
|
||||||
"type": "text",
|
|
||||||
"value": "jfa-go-{version}"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ui": {
|
"ui": {
|
||||||
|
@ -7,10 +7,9 @@ from pathlib import Path
|
|||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-i", "--input", help="input config base from jf-accounts")
|
parser.add_argument("-i", "--input", help="input config base from jf-accounts")
|
||||||
parser.add_argument("-o", "--output", help="output ini")
|
parser.add_argument("-o", "--output", help="output ini")
|
||||||
parser.add_argument("--version", help="version to include in file")
|
|
||||||
|
|
||||||
|
|
||||||
def generate_ini(base_file, ini_file, version):
|
def generate_ini(base_file, ini_file):
|
||||||
"""
|
"""
|
||||||
Generates .ini file from config-base file.
|
Generates .ini file from config-base file.
|
||||||
"""
|
"""
|
||||||
@ -32,11 +31,6 @@ def generate_ini(base_file, ini_file, version):
|
|||||||
value = str(value)
|
value = str(value)
|
||||||
ini.set(section, entry, value)
|
ini.set(section, entry, value)
|
||||||
|
|
||||||
ini["jellyfin"]["version"] = version
|
|
||||||
ini["jellyfin"]["device_id"] = ini["jellyfin"]["device_id"].replace(
|
|
||||||
"{version}", version
|
|
||||||
)
|
|
||||||
|
|
||||||
with open(Path(ini_file), "w") as config_file:
|
with open(Path(ini_file), "w") as config_file:
|
||||||
ini.write(config_file)
|
ini.write(config_file)
|
||||||
return True
|
return True
|
||||||
@ -44,8 +38,4 @@ def generate_ini(base_file, ini_file, version):
|
|||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
version = "git"
|
print(generate_ini(base_file=args.input, ini_file=args.output))
|
||||||
if args.version is not None:
|
|
||||||
version = args.version
|
|
||||||
|
|
||||||
print(generate_ini(base_file=args.input, ini_file=args.output, version=version))
|
|
||||||
|
@ -19,10 +19,7 @@
|
|||||||
"password",
|
"password",
|
||||||
"server",
|
"server",
|
||||||
"public_server",
|
"public_server",
|
||||||
"client",
|
"client"
|
||||||
"version",
|
|
||||||
"device",
|
|
||||||
"device_id"
|
|
||||||
],
|
],
|
||||||
"meta": {
|
"meta": {
|
||||||
"name": "Jellyfin",
|
"name": "Jellyfin",
|
||||||
@ -65,28 +62,7 @@
|
|||||||
"requires_restart": true,
|
"requires_restart": true,
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"value": "jfa-go",
|
"value": "jfa-go",
|
||||||
"description": "This and below settings will show on the Jellyfin dashboard when the program connects. You may as well leave them alone."
|
"description": "The name of the client that will show up in the Jellyfin dashboard."
|
||||||
},
|
|
||||||
"version": {
|
|
||||||
"name": "Version Number",
|
|
||||||
"required": true,
|
|
||||||
"requires_restart": true,
|
|
||||||
"type": "text",
|
|
||||||
"value": "{version}"
|
|
||||||
},
|
|
||||||
"device": {
|
|
||||||
"name": "Device Name",
|
|
||||||
"required": true,
|
|
||||||
"requires_restart": true,
|
|
||||||
"type": "text",
|
|
||||||
"value": "jfa-go"
|
|
||||||
},
|
|
||||||
"device_id": {
|
|
||||||
"name": "Device ID",
|
|
||||||
"required": true,
|
|
||||||
"requires_restart": true,
|
|
||||||
"type": "text",
|
|
||||||
"value": "jfa-go-{version}"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ui": {
|
"ui": {
|
||||||
|
8
main.go
8
main.go
@ -407,7 +407,13 @@ func start(asDaemon, firstCall bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
server := app.config.Section("jellyfin").Key("server").String()
|
server := app.config.Section("jellyfin").Key("server").String()
|
||||||
app.jf, _ = newJellyfin(server, "jfa-go", app.version, "hrfee-arch", "hrfee-arch")
|
app.jf, _ = newJellyfin(
|
||||||
|
server,
|
||||||
|
app.config.Section("jellyfin").Key("client").String(),
|
||||||
|
app.config.Section("jellyfin").Key("version").String(),
|
||||||
|
app.config.Section("jellyfin").Key("device").String(),
|
||||||
|
app.config.Section("jellyfin").Key("device_id").String(),
|
||||||
|
)
|
||||||
var status int
|
var status int
|
||||||
_, status, err = app.jf.authenticate(app.config.Section("jellyfin").Key("username").String(), app.config.Section("jellyfin").Key("password").String())
|
_, status, err = app.jf.authenticate(app.config.Section("jellyfin").Key("username").String(), app.config.Section("jellyfin").Key("password").String())
|
||||||
if status != 200 || err != nil {
|
if status != 200 || err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user