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

Add support for the tv API #13

Merged
merged 13 commits into from
Oct 1, 2019
1 change: 1 addition & 0 deletions aiofreepybox/aiofreepybox.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import aiofreepybox
from aiofreepybox.exceptions import *
from aiofreepybox.access import Access
from aiofreepybox.api.tv import Tv
foreign-sub marked this conversation as resolved.
Show resolved Hide resolved
from aiofreepybox.api.system import System
from aiofreepybox.api.dhcp import Dhcp
from aiofreepybox.api.switch import Switch
Expand Down
100 changes: 100 additions & 0 deletions aiofreepybox/api/tv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
class Tv:

def __init__(self, access):
self._access = access

async def get_finished_tv_records(self):
'''
Get finished tv records
'''
return await self._access.get('pvr/finished/')

async def get_tv_bouquet_channels(self, bouquetid):
'''
Get tv bouquet channels
'''
return await self._access.get('tv/bouquets/{0}/channels/'.format(bouquetid))

async def get_tv_bouquet(self):
'''
Get tv bouquet
'''
return await self._access.get('tv/bouquets/')

async def get_tv_channels(self):
'''
Get tv channels
'''
return await self._access.get('tv/channels/')

async def get_tv_default_bouquet_channels(self):
'''
Get tv default bouquet channels
'''
return await self._access.get('tv/bouquets/freeboxtv/channels/')
foreign-sub marked this conversation as resolved.
Show resolved Hide resolved

async def get_tv_program(self, programid):
'''
Get tv program
'''
return await self._access.get('tv/epg/programs/', programid)

async def get_tv_program_highlights(self, channelid, date):
'''
Get tv program highlights
'''
return await self._access.get('tv/epg/highlights/{0}/'.format(channelid), date)

async def get_tv_programs_by_channel(self, channelid, date):
'''
Get tv programs by channel
'''
return await self._access.get('tv/epg/by_channel/{0}/'.format(channelid), date)

async def get_tv_programs_by_date(self, date):
'''
Get tv programs by date
'''
return await self._access.get('tv/epg/by_time/', date)

async def create_tv_record(self, tvrecord):
'''
Create tv record
'''
return await self._access.post('pvr/', 'programmed/', tvrecord)

async def create_tv_record_generator(self, tvrecordgenerator):
'''
Create tv record generator
'''
return await self._access.post('pvr/', 'generator/', tvrecordgenerator)

async def edit_tv_record_generator(self, generatorid, tvrecordgenerator):
'''
Edit tv record generator
'''
return await self._access.put('pvr/generator/', generatorid, tvrecordgenerator)

async def get_tv_record_generator(self, generatorid):
'''
Get tv record generator
'''
return await self._access.get('pvr/generator/', generatorid)

async def get_tv_records_configuration(self):
'''
Get tv records configuration
'''
return await self._access.get('pvr/config/')

async def get_tvrecords_media_list(self):
'''
Get tv records media list
'''
return await self._access.get('pvr/media/')

async def get_tv_status(self):
'''
Get tv status
'''
return await self._access.get('tv/status/')