A rudimentary Python script to simplify the adding of custom tonies. I’m not really a programmer, so feedback is welcome.
The script must be executed in the same directory as the tonies.custom.json is located. For standard Docker installation it is in: /var/lib/docker/volumes/docker_config/_data
import json
# read tonies.custom.json
with open("tonies.custom.json", "r") as f:
tonies = json.load(f)
# query values
# model id is a custom string
# audio_id unixtimestamp, see webinterface
# hash see webinterface
# pic path or weburl
model = input("model id: ")
audio_id = input("audio_id: ")
hash = input("hash: ")
title = input("title: ")
series = input("series: ")
episodes = input("episode: ")
pic = input("path or URL: ")
# create a new block
tonies.append({
"no": len(tonies),
"model": model,
"audio_id": audio_id,
"hash": hash,
"title": title,
"series": series,
"episodes": episodes,
"pic": pic
})
# write file
with open("tonies.custom.json", "w") as f:
json.dump(tonies, f)
# print file for debugging purpose
# print(tonies)
# remember adjusting model id
print("\033[1;31;4mYou must edit your content json file located in your conten directory and adjust the model\033[0m")
print("\033[1;31;4m(Example: Tag ID 0A0B0C0D, /var/lib/docker/volumes/tc_content/_data/0A0B0C0D/E0F0A0B0.json)\033[0m")