Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule script error #5

Open
johnjay829 opened this issue Feb 19, 2021 · 3 comments
Open

Schedule script error #5

johnjay829 opened this issue Feb 19, 2021 · 3 comments

Comments

@johnjay829
Copy link

$ python schedule_creator.py
Could not get any episodes to select for 00:00.
Could not get a program to schedule for 00:00.
Traceback (most recent call last):
File "schedule_creator.py", line 134, in
if channel.add_schedule(time_slots=time_slots, slots=[]):
File "C:\Python38\lib\site-packages\dizqueTV\decorators.py", line 19, in inner
return func(obj, **kwargs)
File "C:\Python38\lib\site-packages\dizqueTV\channels.py", line 797, in add_schedule
return self._dizque_instance._make_schedule(channel=self, schedule=schedule)
File "C:\Python38\lib\site-packages\dizqueTV\dizquetv.py", line 575, in _make_schedule
res = self._post(endpoint='/channel-tools/time-slots', data=data)
File "C:\Python38\lib\site-packages\dizqueTV\dizquetv.py", line 173, in post
return requests.post(url=url,
File "C:\Python38\lib\site-packages\dizqueTV\dizquetv_requests.py", line 35, in post
res = requests.post(url=url, json=data, headers=headers, timeout=timeout)
File "C:\Python38\lib\site-packages\requests\api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "C:\Python38\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Python38\lib\site-packages\requests\sessions.py", line 516, in request
prep = self.prepare_request(req)
File "C:\Python38\lib\site-packages\requests\sessions.py", line 449, in prepare_request
p.prepare(
File "C:\Python38\lib\site-packages\requests\models.py", line 317, in prepare
self.prepare_body(data, files, json)
File "C:\Python38\lib\site-packages\requests\models.py", line 467, in prepare_body
body = complexjson.dumps(json)
File "C:\Python38\lib\json_init
.py", line 231, in dumps
return _default_encoder.encode(obj)
File "C:\Python38\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Python38\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "C:\Python38\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type type is not JSON serializable

@johndolljr
Copy link

I'm not sure if I've fixed it properly or not. but I hacked the dizque-python lib to get this working. I also tweaked the sample script. The main issue seems to be in the merging of dictionaries resulting in an incomplete request to create the time slot.

https://github.com/johndolljr/dizqueTV-python/tree/timeSlot
https://github.com/johndolljr/dizqueTV-scripts/tree/timeSlot

@RedRaptor10
Copy link

I'm not sure if I've fixed it properly or not. but I hacked the dizque-python lib to get this working. I also tweaked the sample script. The main issue seems to be in the merging of dictionaries resulting in an incomplete request to create the time slot.

https://github.com/johndolljr/dizqueTV-python/tree/timeSlot
https://github.com/johndolljr/dizqueTV-scripts/tree/timeSlot

It seems to be giving me an error when I add more timeslots and when I use type 'show'. I am using a schedule like:

    "00:00": { 'type': 'show', }, "00:30": { 'type': 'show', },
    "01:00": { 'type': 'show', }, "01:30": { 'type': 'show', },
    "02:00": { 'type': 'show', }, "02:30": { 'type': 'show', },
    "03:00": { 'type': 'show', }, "03:30": { 'type': 'show', },
    "04:00": { 'type': 'show', }, "04:30": { 'type': 'show', },
    "05:00": { 'type': 'show', }, "05:30": { 'type': 'show', },
    "06:00": { 'type': 'show', }, "06:30": { 'type': 'show', },
    "07:00": { 'type': 'show', }, "07:30": { 'type': 'show', },
    "08:00": { 'type': 'show', }, "08:30": { 'type': 'show', },
    "09:00": { 'type': 'show', }, "09:30": { 'type': 'show', },
    "10:00": { 'type': 'show', }, "10:30": { 'type': 'show', },
    "11:00": { 'type': 'show', }, "11:30": { 'type': 'show', },
    "12:00": { 'type': 'show', }, "12:30": { 'type': 'show', },
    "13:00": { 'type': 'show', }, "13:30": { 'type': 'show', },
    "14:00": { 'type': 'show', }, "14:30": { 'type': 'show', },
    "15:00": { 'type': 'show', }, "15:30": { 'type': 'show', },
    "16:00": { 'type': 'show', }, "16:30": { 'type': 'show', },
    "17:00": { 'type': 'show', }, "17:30": { 'type': 'show', },
    "18:00": { 'type': 'show', }, "18:30": { 'type': 'show', },
    "19:00": { 'type': 'show', }, "19:30": { 'type': 'show', },
    "20:00": { 'type': 'show', }, "20:30": { 'type': 'show', },
    "21:00": { 'type': 'show', }, "21:30": { 'type': 'show', },
    "22:00": { 'type': 'show', }, "22:30": { 'type': 'show', },
    "23:00": { 'type': 'show', }, "23:30": { 'type': 'show', }

@nwithan8
Copy link
Owner

I'm not sure if I've fixed it properly or not. but I hacked the dizque-python lib to get this working. I also tweaked the sample script. The main issue seems to be in the merging of dictionaries resulting in an incomplete request to create the time slot.

https://github.com/johndolljr/dizqueTV-python/tree/timeSlot
https://github.com/johndolljr/dizqueTV-scripts/tree/timeSlot

Please make a pull request so I can test and merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants