A Python library to interact with a dizqueTV instance
- Clone repository with
git clone https://github.com/nwithan8/dizqueTV-python.git - Enter project folder with
cd dizqueTV-python - Install requirements with
pip install -r requirements.txt
Run pip install dizqueTV
Import the API class from the dizqueTV module
Ex.
from dizqueTV import API
dtv = API(url="http://localhost:8000")
Enable verbose logging by passing verbose=True into the API object declaration
- Get all channels:
channels = dtv.channels-> list ofChannelobjects - Get all channel numbers:
channel_numbers = dtv.channel_numbers-> list of ints - Get a specific channel:
channel = dtv.get_channel(channel_number: int, channel_name: str)->Channelobject - Get brief info on a specific channel:
channel_info = dtv.get_channel_info(channel_number: int)->{"name": str, "number": int, "icon": str} - Add a channel:
new_channel = dtv.add_channel(programs: [Program, PlexAPI Video, ...], plex_server: PlexAPI Server [Optional], handle_errors: bool, **kwargs)->Channelobject - Update a channel:
updated = dtv.update_channel(channel_number: int, **kwargs)orChannel.update(**kwargs)-> True/False - Delete a channel:
deleted = dtv.delete_channel(channel_number: int)orChannel.delete()-> True/False - Refresh a channel:
Channel.refresh()-> None (reloadsChannelobject in-place) - Edit channel's watermark:
edited = Watermark.update(**kwargs)-> True/False - Edit channel's FFMPEG settings:
edited = ChannelFFMPEGSettings.update(**kwargs)-> True/False
- Get a channel's programs:
programs = Channel.programs-> list ofMediaItemobjects - Add program (or PlexAPI Video) to a channel:
added = Channel.add_program(plex_item: PlexAPI Video, plex_server: PlexAPI Server, program: Program, **kwargs)-> True/False - Add multiple programs (or PlexAPI Video) to a channel:
added = Channel.add_fillers(programs: [Program, PlexAPI Video, ...], plex_server: PlexAPI Server)-> True/False - Add multiple programs to multiple channels:
added = dtv.add_programs_to_channels(programs: [Program], channels: [Channel], channel_numbers: [int])-> True/False - Add X number of show episodes:
added = Channel.add_x_number_of_show_episodes(number_of_episodes: int, list_of_episodes: [Program, Episode, ...], plex_server: PServer (Optional))-> True/False - Add X duration of show episodes:
added = Channel.add_x_duration_of_show_episodes(duration_in_milliseconds: int, list_of_episodes: [Program, Episode, ...], plex_server: PServer (Optional), allow_overtime: bool)-> True/False - Delete a program:
deleted = Channel.delete_program(program: Program)-> True/False - Delete all programs:
deleted = Channel.delete_all_programs()-> True/False - Delete all episodes of a show (or of a season):
deleted = Channel.delete_show(show_name: str, season_number: int (Optional))-> True/False - Sort programs by release date:
sorted = Channel.sort_programs_by_release_date()-> True/False - Sort programs by season order:
sorted = Channel.sort_programs_by_season_order()-> True/False - Sort programs alphabetically:
sorted = Channel.sort_programs_alphabetically()-> True/False - Sort programs by duration:
sorted = Channel.sort_programs_by_duration()-> True/False - Sort programs randomly:
sorted = Channel.sort_programs_randomly()-> True/False - Sort programs cylically:
sorted = Channel.cyclical_shuffle()-> True/False - Sort programs by block shuffle:
sorted = Channel.block_shuffle(block_length: int, randomize: bool)-> True/False - Repeat programs:
repeated = Channel.replicate(how_many_times: int)-> True/False - Repeat and shuffle programs
repeated = Channel.replicate_and_shuffle(how_many_times: int)-> True/False - Remove duplicate programs:
sorted = Channel.remove_duplicate_programs()-> True/False - Remove specials:
sorted = Channel.remove_specials()-> True/False - Remove redirects:
sorted = Channel.remove_redirects()-> True/False - Balance shows:
balanced = Channel.balance_programs(margin_of_error: float)-> True/False - Add pad times:
added = Channel.pad_times(start_every_x_minutes: int)-> True/False - Add reruns:
added = Channel.add_reruns(start_time: datetime.datetime, length_hours: int, times_to_repeat: int)-> True/False - Add "Channel at Night":
added = Channel.add_channel_at_night(night_channel_number: int, start_hour: int (24-hour time), end_hour: int (24-hour time))-> True/False - Fast forward:
success = Channel.fast_forward(seconds: int, minutes: int, hours: int, days: int, months: int, years: int)-> True/False - Rewind:
success = Channel.rewind(seconds: int, minutes: int, hours: int, days: int, months: int, years: int)-> True/False
- Get a filler list:
filler_list = dtv.get_filler_list(filler_list_id: str)->FillerListobject - Get all filler lists:
filler_lists = dtv.filler_lists-> List ofFillerListobjects - Get a filler list info:
filler_list_info = dtv.get_filler_list_info(filler_list_id: str)orFillerList.details-> JSON - Get a filler list's channels:
filler_list_channels = dtv.get_filler_list_channels(filler_list_id: str)orFillerList.channels-> List ofChannelobjects - Get a filler list's content:
filler_list_contents = FillerList.contents-> List ofFillerItemobjects - Add a filler list:
new_filler_list = dtv.add_filler_list(content: [Program, Video, Movie, Episode, ...], plex_server: PlexAPI Server, handle_errors: bool, **kwargs)->FillerListobject - Update a filler list:
updated = dtv.update_filler_list(filler_list_id: str, **kwargs)orFillerList.update(**kwargs)-> True/False - Delete a filler list:
deleted = dtv.delete_filler_list(filler_list_id: str)orFillerList.delete()-> True/False - Refresh a filler list:
FillerList.refresh()-> None (reloadsFillerListobject in-place) - Add a filler list to a channel:
added = Channel.add_filler_list(filler_list: FillerList, filler_list_id: str, weight: int, cooldown: int)-> True/False - Add multiple filler lists to multiple channels:
added = dtv.add_filler_lists_to_channels(filler_lists: [FillerList, ...], channels: [Channel, ...], channel_numbers: [int, ...])-> True/False - Delete a filler list from a channel:
deleted = Channel.delete_filler_list(filler_list: FillerList, filler_list_id: str)-> True/False - Delete all filler lists from a channel:
deleted = Channel.delete_all_filler_lists()-> True/False - Add a filler item (or PlexAPI Video) to a filler list:
added = FillerList.add_filler(plex_item: plexapi.media.Video/Movie/Episode, plex_server: PlexAPI Server, filler: FillerItem, **kwargs)-> True/False - Add multiple filler items (or PlexAPI Video) to a filler list:
added = FillerList.add_fillers(fillers: [FillerItem, plexapi.media.Video/Movie/Episode, ...], plex_server: PlexAPI Server)-> True/False - Delete a filler item:
deleted = FillerList.delete_filler(filler: FillerItem)-> True/False - Delete all filler items:
deleted = FillerList.delete_all_fillers()-> True/False - Sort filler items by duration:
sorted = FillerList.sort_filler_by_duration()-> True/False - Sort filler items randomly:
sorted = FillerList.sort_filler_randomly()-> True/False - Remove duplicate filler items:
sorted = FillerList.remove_duplicate_fillers()-> True/False
- Get a channel's schedule:
schedule = Channel.schedule->Scheduleobject - Add a schedule to a channel:
added = Channel.add_schedule(time_slots: [TimeSlot, ...], **kwargs)-> True/False - Update a channel's schedule:
updated = Channel.update_schedule(**kwargs)orSchedule.update(**kwargs)-> True/False - Delete a channel's schedule:
deleted = Channel.delete_schedule()orSchedule.delete()-> True/False - Add a time slot to a schedule:
added = Schedule.add_time_slot(time_slot: TimeSlot, time_string: str, **kwargs)-> True/False - Edit a time slot on a schedule:
edited = Schedule.edit_time_slot(time_slot: TimeSlot, time_string: str, **kwargs)orTimeSlot.edit(time_string: str, **kwargs)-> True/False - Delete a time slot on a schedule:
deleted = Schedule.delete_time_slot(time_slot: TimeSlot)orTimeSlot.delete()-> True/False
- Get all Plex Media Servers:
servers = dtv.plex_servers-> list ofPlexServerobjects - Get a specific Plex Media Server:
server = dtv.get_plex_server(server_name: str)->PlexServerobject - Get a specific Plex Media Server status:
status = dtv.plex_server_status(server_name: str)orPlexServer.status-> True/False - Get a specific Plex Media Server foreign status:
status = dtv.plex_server_foreign_status(server_name: str)orPlexServer.foreign_status-> True/False - Add a Plex Media Server:
new_server = dtv.add_plex_server(**kwargs)->PlexServerobject - Update a Plex Media Server:
updated = dtv.update_plex_server(server_name: str, **kwargs)orPlexServer.update(**kwargs)-> True/False - Delete a Plex Media Server:
deleted = dtv.delete_plex_server(server_name: str)orPlexServer.delete()-> True/False - Refresh a Plex Media Server:
PlexServer.refresh()-> None (reloadsPlexServerobject in-place)
- Get FFMPEG settings:
settings = dtv.ffmpeg_settings->FFMPEGSettingsobject - Update FFMPEG settings:
updated = dtv.update_ffmpeg_settings(**kwargs)orFFMPEGSettings.update(**kwargs)-> True/False - Refresh FFMPEG settings:
FFMPEGSettings.refresh()-> None (reloadsFFMPEGSettingsobject in-place) - Reset FFMPEG settings:
reset = dtv.reset_ffmpeg_settings()-> True/False - Get Plex settings:
settings = dtv.plex_settings->PlexSettingsobject - Update Plex settings:
updated = dtv.update_plex_settings(**kwargs)orPlexSettings.update(**kwargs)-> True/False - Refresh Plex settings:
PlexSettings.refresh()-> None (reloadsPlexSettingsobject in-place) - Reset Plex settings:
reset = dtv.reset_plex_settings()-> True/False - Get XMLTV settings:
settings = dtv.xmltv_settings->XMLTVSettingsobject - Update XMLTV settings:
updated = dtv.update_xmltv_settings(**kwargs)orXMLTVSettings.update(**kwargs)-> True/False - Refresh XMLTV settings:
XMLTVSettings.reload()-> None (reloadsXMLTVSettingsobject in-place) - Reset XMLTV settings:
reset = dtv.reset_xmltv_settings()-> True/False - Get HDHomeRun settings:
settings = dtv.hdhr_settings->HDHomeRunSettingsobject - Update HDHomeRun settings:
updated = dtv.update_hdhr_settings(**kwargs)orHDHomeRunSettings.update(**kwargs)-> True/False - Refresh HDHomeRun settings:
HDHomeRunSettings.refresh()-> None (reloadsHDHomeRunSettingsobject in-place) - Reset HDHomeRun settings:
reset = dtv.reset_hdhr_settings()-> True/False
- Get dizqueTV version:
version = dtv.dizquetv_version-> str - Get FFMPEG version:
version = dtv.ffmpeg_version-> str - Get XMLTV XML file:
xml = dtv.xmltv_xml->xml.etree.ElementTree.Elementobject - Refresh XMLTV XML file server-side:
refreshed = dtv.refresh_xml()-> True/False - Get M3U playlist:
m3u = dtv.channels_m3u->m3u8object - Get HLS playlist:
hls = dtv.hls_m3u->m3u8object - Get last time XMLTV was refreshed:
last_time = dtv.last_xmltv_refresh-> str
- Get dizqueTV guide:
guide = dtv.guide->Guideobject - Get last guide update time:
update_time = dtv.last_guide_updateorGuide.last_update->datetime.datetimeobject - Get guide channel numbers:
guide_numbers = dtv.guide_channel_numbers-> List of strings (not ints) - Get guide channels:
guide_channels = Guide.channels-> List ofGuideChannelobjects - Get guide lineup data (JSON):
guide_lineup = dtv.guide_lineup_json-> JSON - Get guide channel lineup (
GuideProgramobjects):guide_lineup = GuideChannel.get_lineup(from_date: datetime.datetime, to_date: datetime.datetime)-> List ofGuideProgramobjects
- Convert a Python PlexAPI Video to a Program:
program = dtv.convert_plex_item_to_program(plex_item: PlexAPI Video, plex_server: PlexAPI Server)orprogram = Channel.convert_plex_item_to_program(plex_item: PlexAPI Video, plex_server: PlexAPI Server)-> Program - Convert a Python PlexAPI Video to a Filler:
filler = dtv.convert_plex_item_to_filler(plex_item: PlexAPI Video, plex_server: PlexAPI Server)orfiller = Channel.convert_plex_item_to_filler(plex_item: PlexAPI Video, plex_server: PlexAPI Server)-> Program - Convert a Python PlexAPI Server to a PlexServer:
server = dtv.convert_plex_server_to_dizque_plex_server(plex_server: PlexAPI Server)-> PlexServer - Convert a DizqueTV Program or Redirect to a TimeSlot:
time_slot = dtv.make_time_slot_from_dizque_program(program: Union[Program, Redirect], time: str, order: str)->TimeSlotobject - Repeat a list:
repeated_list = dtv.repeat_list(items: List, how_many_times: int)-> List - Repeat and shuffle a list:
repeated_list = dtv.repeate_and_shuffle_list(items: List, how_many_times: int)-> List
url: dizqueTV API base urlverbose: use verbose logging (default: False)dizquetv_version: strffmpeg_version: strplex_servers: list ofPlexServerobjectschannels: list ofChannelobjectschannel_numbers: list of intschannel_count: intffmpeg_settings:FFMPEGSettingsobjectplex_settings:PlexSettingsobjectxmltv_settings:XMLTVSettingsobjecthdhr_settings:HDHomeRunSettingsobjectlast_xmltv_refresh: strxmltv_xml:xml.etree.ElementTree.Elementobjectm3u:m3u8object
programs: list ofProgramobjectsfiller_lists: List ofFillerListobjectsfillerRepeatCooldown: intfallback: List ofFillerItemobjectsicon: str(url)disableFillerOverlay: boolstartTime: str(datetime)offlinePicture: str(url)offlineSoundtrack: str(url)offlineMode: strnumber: intname: strduration: intwatermark:Watermarkobjecttranscoding:ChannelFFMPEGSettingsobjectschedule:ScheduleobjectschedulableItems: List ofTimeSlotItemobjectsstealth: booljson: JSON
enabled: boolwidth: floatverticalMargin: floathorizontalMargin: floatduration: intfixedSize: boolposition: strurl: stranimated: booljson: JSON
lateness: intmaxDays: intslots: List ofTimeSlotobjectsflexPreference: str ("end" or "distribute")pad: inttimeZoneOffset: int
time: intshowId: strorder: str
showId: str
title: strkey: strratingKey: str(int)icon: str(url)type: strduration: intsummary: strrating: strdate: stryear: intplexFile: strfile: strshowTitle: strepisode: intseason: intshowIcon: str(url)episodeIcon: str(url)seasonIcon: str(url)serverKey: strisOffline: false
id: strname: strcount: intdetails: JSONcontent: List ofFillerItemobjectschannels: List ofChannelobjects
title: strkey: strratingKey: str(int)icon: str(url)type: strduration: intsummary: strdate: stryear: intplexFile: strfile: strshowTitle: strepisode: intseason: intshowIcon: str(url)episodeIcon: str(url)seasonIcon: str(url)serverKey: strisOffline: false
type: "redirect"duration: intchannel: intisOffline: true
name: struri: str(url)accessToken: strindex: intarChannels: boolarGuide: bool
cache: intrefresh: intfile: str
streamPath: strdebugLogging: booldirectStreamBitrate: str(int)transcodeBitrate: str(int)mediaBufferSize: inttranscodeMediaBufferSize: intmaxPlayableResolution: strmaxTranscodeResolution: strvideoCodecs: straudioCodecs: strmaxAudioChannels: str(int)audioBoost: str(int)enableSubtitles: boolsubtitleSize: str(int)updatePlayStatus: boolstreamProtocol: strforceDirectPlay: boolpathReplace: strpathReplaceWith: str
configVersion: intffmpegPath: strthreads: intconcatMuxDelay: str(int)logFfmpeg: boolenableFFMPEGTranscoding: boolaudioVolumePercent: intvideoEncoder: straudioEncoder: strtargetResolution: strvideoBitrate: intvideoBufSize: intaudioBitrate: intaudioBufSize: intaudioSampleRate: intaudioChannels: interrorScreen: strerrorAudio: strnormalizeVideoCodec: boolnormalizeAudioCodec: boolnormalizeResolution: boolnormalizeAudio: boolmaxFPS: int
targetResolution: strvideoBitrate: intvideoBufSize: intjson: JSON
tunerCount: intautoDiscovery: bool
MissingSettingsError: The kwargs you have provided to create a new object (ex.ChannelorPlexServer) are incompleteMissingParametersError: You did not provide a required parameter in your function call (ex. provide a PlexAPI Server when adding PlexAPI Video to a channel)NotRemoteObjectError: The object you are calling this method on is a locally-created object that does not exist on the dizqueTV serverChannelCreationError: An error occurred when creating a Channel object
Please leave a pull request if you would like to contribute.
Join the dizqueTV Discord server (link on project page). My Discord username is nwithan8#8438
Follow me on Twitter: @nwithan8
Also feel free to check out my other projects here on GitHub or join the #developer channel in my Discord server below.
