python-plexapi icon indicating copy to clipboard operation
python-plexapi copied to clipboard

LiveTV support (both DVR and free Plex streaming/IPTV) - Requesting code review

Open nwithan8 opened this issue 5 years ago • 19 comments

First time working with XML data. Seems rather straightforward once I understood how you handled parsing. Have not written test files yet, waiting for feedback if you could give any.

nwithan8 avatar Aug 07 '20 05:08 nwithan8

Nice work. Livetv etc support has been non existent because no contributer have used it. :)

Hellowlol avatar Aug 09 '20 11:08 Hellowlol

Thanks for the feedback. I will make the necessary changes.

nwithan8 avatar Aug 10 '20 02:08 nwithan8

@nwithan8 any updates? I have a tuner setup and am willing to test.

blacktwin avatar Nov 12 '20 19:11 blacktwin

@blacktwin been meaning to get back to this, got sidetracked with other projects. If you want to have a look over, be my guest.

nwithan8 avatar Nov 12 '20 19:11 nwithan8

Has there been any progress with this feature addition? It'll be a great addition to already awesome work! Cheers

rockstar2020 avatar Mar 06 '21 16:03 rockstar2020

Waiting on @pkkid or @Hellowlol

nwithan8 avatar Mar 06 '21 18:03 nwithan8

The PR has merge conflicts. Those will need to be addressed first.

jjlawren avatar Mar 06 '21 18:03 jjlawren

Is anybody working on fixing the conflicts? I have a HD HomeRun tuner on my plex and am ready to test the codes if it helps.

Many thanks in advance

rockstar2020 avatar Mar 06 '21 21:03 rockstar2020

The PR has merge conflicts. Those will need to be addressed first.

Addressed

nwithan8 avatar Mar 14 '21 02:03 nwithan8

Thanks @nwithan8, This is great but while waiting for these changes turn into a new release I'd like to make manual changes in my instance and give these new features a try. Can you give me a python command example on how I can retrive and then tune into a specific live TV channel?

Much appreciate it!

rockstar2020 avatar Mar 15 '21 22:03 rockstar2020

Thanks @nwithan8, This is great but while waiting for these changes turn into a new release I'd like to make manual changes in my instance and give these new features a try. Can you give me a python command example on how I can retrive and then tune into a specific live TV channel?

Much appreciate it!

Here's a code snippet that I was using to test:

from plexapi import myplex, server

mypx = myplex.MyPlexAccount(username="username", password="password")
pxserver = server.PlexServer(baseurl="http://localhost:32400", token="aplextoken")
print(mypx.iptv)
live = pxserver.livetv
print(live.dvrs[0].title)

nwithan8 avatar Mar 16 '21 05:03 nwithan8

Thanks again @nwithan8, I was able to get the title of my DVR but after that I'd like to list all available channels and play one of the channels on my plex device. Currently I have a script to search for shows, movies and playlists and play the selected content on my plex media player, but don't know how it should work for live tv. Can you give me a hint?

Much appreciate your help.

rockstar2020 avatar Mar 17 '21 00:03 rockstar2020

By the way, after making the changes manually, if I run a simple script to list all movies in my library I get the following message for each item found in the search: INFO:plexapi:Failed to parse 2015-05-06 to datetime, defaulting to None

Here is my code to do the search: for video in plex.library.section('Movies').all(): print(video.title)

Please note that if I use original files, the same simple search script runs flawlessly. Hoping it could help troubleshooting it.

Cheers

rockstar2020 avatar Mar 17 '21 00:03 rockstar2020

@nwithan8 Maybe it's me but is how you'd get to the guide?

plex = PlexServer(PLEX_URL, PLEX_TOKEN)
live = plex.livetv
dvr = live.dvrs[0]
print(live.guide())

I'm getting AttributeError: 'LiveTV' object has no attribute 'cloud_key'

I'm thinking that you LiveTV isn't pulling the cloud_key, In fact the LiveTV _loaddata isn't hit at all. How the cloud_key get loaded in order to interact with the guide?

blacktwin avatar Mar 17 '21 03:03 blacktwin

@nwithan8 Maybe it's me but is how you'd get to the guide?

plex = PlexServer(PLEX_URL, PLEX_TOKEN)
live = plex.livetv
dvr = live.dvrs[0]
print(live.guide())

I'm getting AttributeError: 'LiveTV' object has no attribute 'cloud_key'

I'm thinking that you LiveTV isn't pulling the cloud_key, In fact the LiveTV _loaddata isn't hit at all. How the cloud_key get loaded in order to interact with the guide?

I also got the same error when I tried to load the guide.

rockstar2020 avatar Mar 17 '21 03:03 rockstar2020

It seems some things have changed with Plex since I started this, so I'm working on updating it. Turns out the "cloud key" is different if you're using the ZIP Code guide versus the local XMLTV path guide, so I'm having to account for that.

The code for this PR is still in progress. Should I/How do I retract/remove this PR request in the meantime?

nwithan8 avatar Mar 18 '21 02:03 nwithan8

Change the PR to a draft. The link is beneath the reviewers at the top right.

JonnyWong16 avatar Mar 18 '21 03:03 JonnyWong16

Hi @nwithan8, Any progress?

Thanks

rockstar2020 avatar Mar 28 '21 15:03 rockstar2020

Hi @nwithan8, Any progress?

Thanks

Seconding @rockstar2020: Any news on this draft, @nwithan8?

iophobia avatar May 13 '22 07:05 iophobia