1
0
mirror of https://github.com/fHDHR/fHDHR_NextPVR.git synced 2025-12-06 17:56:57 -05:00

Merge pull request #94 from deathbybandaid/dev

Add Mass Scale Channel Edit API Method
This commit is contained in:
Deathbybandaid 2020-12-18 10:29:21 -05:00 committed by GitHub
commit b8be38db68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,6 +101,32 @@ class Channels():
updatedict[key] = int(request.form.get(key)) updatedict[key] = int(request.form.get(key))
self.fhdhr.device.channels.set_channel_status("id", channel_id, updatedict) self.fhdhr.device.channels.set_channel_status("id", channel_id, updatedict)
elif method == "modify":
channels_list = request.form.get('channels', [])
for channel in channels_list:
updatedict = {}
for key in list(channel.keys()):
if key != "id":
if key in ["name", "callsign", "thumbnail"]:
updatedict[key] = str(channel[key])
elif key in ["number"]:
number = str(channel[key])
if "." in number:
updatedict["subnumber"] = number.split(".")[1]
updatedict["number"] = number.split(".")[0]
else:
updatedict["number"] = number
elif key in ["enabled"]:
confvalue = channel[key]
if str(confvalue).lower() in ["false"]:
confvalue = False
elif str(confvalue).lower() in ["true"]:
confvalue = True
updatedict[key] = confvalue
elif key in ["favorite", "HD"]:
updatedict[key] = int(channel[key])
self.fhdhr.device.channels.set_channel_status("id", channel_id, updatedict)
elif method == "scan": elif method == "scan":
self.fhdhr.device.channels.get_channels(forceupdate=True) self.fhdhr.device.channels.get_channels(forceupdate=True)