Interact with a dizqueTV instance's API
Project description
dizqueTV-python
A Python library to interact with a dizqueTV instance
Installation
From GitHub
- 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
From PyPi
Run pip install dizqueTV
Setup
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
Usage
Methods
Channels
- Get all channels:
channels = dtv.channels
-> list ofChannel
objects - Get all channel numbers:
channel_numbers = dtv.channel_numbers
-> list of ints - Get a specific channel:
channel = dtv.get_channel(channel_number: int)
->Channel
object - 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)
->Channel
object - 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 (reloadsChannel
object in-place)
Programs
- Get a channel's programs:
programs = Channel.programs
-> list ofMediaItem
objects - 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 - Delete a program:
deleted = Channel.delete_program(program: Program)
-> True/False - Delete all programs:
deleted = Channel.delete_all_programs()
-> 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 - Remove duplicate programs:
sorted = Channel.remove_duplicate_programs()
-> True/False - Remove specials:
sorted = Channel.remove_specials()
-> True/False
Filler (Flex)
- Get a channel's filler (Flex) items:
filler = Channel.filler
-> list ofMediaItem
objects - Add filler (or PlexAPI Video) to a channel:
added = Channel.add_filler(plex_item: PlexAPI Video, plex_server: PlexAPI Server, filler: Filler, **kwargs)
-> True/False - Add multiple fillers (or PlexAPI Video) to a channel:
added = Channel.add_fillers(fillers: [Filler, PlexAPI Video, ...], plex_server: PlexAPI Server)
-> True/False - Add multiple fillers to multiple channels:
added = dtv.add_fillers_to_channels(fillers: [Filler], channels: [Channel], channel_numbers: [int])
-> True/False - Delete a filler:
deleted = Channel.delete_filler(filler: Filler)
-> True/False - Delete all filler:
deleted = Channel.delete_all_filler()
-> True/False - Sort filler by duration:
sorted = Channel.sort_filler_by_duration()
-> True/False - Sort filler randomly:
sorted = Channel.sort_filler_randomly()
-> True/False - Remove duplicate filler:
sorted = Channel.remove_duplicate_fillers()
-> True/False
Plex
- Get all Plex Media Servers:
servers = dtv.plex_servers
-> list ofPlexServer
objects - Get a specific Plex Media Server:
server = dtv.get_plex_server(server_name: str)
->PlexServer
object - 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)
->PlexServer
object - 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 (reloadsPlexServer
object in-place)
Settings
- Get FFMPEG settings:
settings = dtv.ffmpeg_settings
->FFMPEGSettings
object - Update FFMPEG settings:
updated = dtv.update_ffmpeg_settings(**kwargs)
orFFMPEGSettings.update(**kwargs)
-> True/False - Refresh FFMPEG settings:
FFMPEGSettings.refresh()
-> None (reloadsFFMPEGSettings
object in-place) - Reset FFMPEG settings:
reset = dtv.reset_ffmpeg_settings()
-> True/False - Get Plex settings:
settings = dtv.plex_settings
->PlexSettings
object - Update Plex settings:
updated = dtv.update_plex_settings(**kwargs)
orPlexSettings.update(**kwargs)
-> True/False - Refresh Plex settings:
PlexSettings.refresh()
-> None (reloadsPlexSettings
object in-place) - Reset Plex settings:
reset = dtv.reset_plex_settings()
-> True/False - Get XMLTV settings:
settings = dtv.xmltv_settings
->XMLTVSettings
object - Update XMLTV settings:
updated = dtv.update_xmltv_settings(**kwargs)
orXMLTVSettings.update(**kwargs)
-> True/False - Refresh XMLTV settings:
XMLTVSettings.reload()
-> None (reloadsXMLTVSettings
object in-place) - Reset XMLTV settings:
reset = dtv.reset_xmltv_settings()
-> True/False - Get HDHomeRun settings:
settings = dtv.hdhr_settings
->HDHomeRunSettings
object - Update HDHomeRun settings:
updated = dtv.update_hdhr_settings(**kwargs)
orHDHomeRunSettings.update(**kwargs)
-> True/False - Refresh HDHomeRun settings:
HDHomeRunSettings.refresh()
-> None (reloadsHDHomeRunSettings
object in-place) - Reset HDHomeRun settings:
reset = dtv.reset_hdhr_settings()
-> True/False
Information
- 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.Element
object - Get M3U playlist:
m3u = dtv.m3u
->m3u8
object - Get last time XMLTV was refreshed:
last_time = dtv.last_xmltv_refresh
-> str
Helper
- 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
Classes
API
url
: dizqueTV API base urlverbose
: use verbose logging (default: False)dizquetv_version
: strffmpeg_version
: strplex_servers
: list ofPlexServer
objectschannels
: list ofChannel
objectschannel_numbers
: list of intsffmpeg_settings
:FFMPEGSettings
objectplex_settings
:PlexSettings
objectxmltv_settings
:XMLTVSettings
objecthdhr_settings
:HDHomeRunSettings
objectlast_xmltv_refresh
: strxmltv_xml
:xml.etree.ElementTree.Element
objectm3u
:m3u8
object
Channel
programs
: list ofProgram
objectsfiller
: list ofFiller
objectsfillerRepeatCooldown
: intfallback
: List ofFiller
objectsicon
: str(url)disableFillerOverlay
: booliconWidth
: inticonDuration
: inticonPosition
: str(int)overlayIcon
: boolstartTime
: str(datetime)offlinePicture
: str(url)offlineSoundtrack
: str(url)offlineMode
: strnumber
: intname
: strduration
: int
Program
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
Filler
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
Redirect
type
: "redirect"duration
: intchannel
: intisOffline
: true
PlexServer
name
: struri
: str(url)accessToken
: strindex
: intarChannels
: boolarGuide
: bool
XMLTVSettings
cache
: intrefresh
: intfile
: str
PlexSettings
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
FFMPEGSettings
configVersion
: intffmpegPath
: strthreads
: intconcatMuxDelay
: str(int)logFfmpeg
: boolenableFFMPEGTranscoding
: boolaudioVolumePercent
: intvideoEncoder
: straudioEncoder
: strtargetResolution
: strvideoBitrate
: intvideoBufSize
: intaudioBitrate
: intaudioBufSize
: intaudioSampleRate
: intaudioChannels
: interrorScreen
: strerrorAudio
: strnormalizeVideoCodec
: boolnormalizeAudioCodec
: boolnormalizeResolution
: boolnormalizeAudio
: bool
HDHomeRunSettings
tunerCount
: intautoDiscovery
: bool
Exceptions
MissingSettingsError
: The kwargs you have provided to create a new object (ex.Channel
orPlexServer
) 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
Contact
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dizqueTV-0.0.64.tar.gz
(21.0 kB
view hashes)
Built Distribution
dizqueTV-0.0.64-py3-none-any.whl
(19.7 kB
view hashes)
Close
Hashes for dizqueTV-0.0.64-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b694d56eaa21f780e57f4901463ff4c5e149a7fe2eb4b735cc1901faff168ac1 |
|
MD5 | 140b9c796cb5aab23862c48358bcdb78 |
|
BLAKE2b-256 | 984c022fba36c73cfd557249c807ea3105ba66d81796c90164b2f1063a1dc4c1 |