Plex Status - Video, Audio, Photo, Play Progress

Python and python framework

Moderator: leecollings

racquemis
Posts: 73
Joined: Monday 02 November 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by racquemis »

Fixed.
On line 164 change

Code: Select all

urllib.quote(PlayString)
to

Code: Select all

urllib.quote(PlayString.encode('utf-8'))
denisb88
Posts: 18
Joined: Thursday 11 February 2016 8:37
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by denisb88 »

YES !!!
It works

Last thing : can I translate playing paused stopped at lines 174 176 178 and Movie at line 153 ?
In fact word begining with " and ending with " ?
racquemis
Posts: 73
Joined: Monday 02 November 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by racquemis »

Script has been updated:
- Added possibility to make translations (see line 40 & 41)
- Further encoding fixes
- Added 'clip' to possible video types.
- Added `buffering` to the user variable status values.
denisb88
Posts: 18
Joined: Thursday 11 February 2016 8:37
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by denisb88 »

With the new script I get this error
File "plex2.py", line 47
SyntaxError: Non-ASCII character '\xc3' in file plex2.py on line 47, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
with
#Translation Array - It's also possible to specify custom search strings. Place them at the beginning of the array.
transl_search = ['Playing','Stopped','Buffering','Paused','Video','Movie','Episode','Clip','Audio','Slideshow']
transl_replace = ['Lecture','Arrêté','Mise en cache','En pause','Vidéo','Film','','Morceau','Diaporama'] #place replacement string on the same index as the search string. empty strings are not processed.
racquemis
Posts: 73
Joined: Monday 02 November 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by racquemis »

Solution was already given in the url in the error message
Add

Code: Select all

# -*- coding: utf-8 -*-
under the first line in the script.
denisb88
Posts: 18
Joined: Thursday 11 February 2016 8:37
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by denisb88 »

Thanks for all
As I don't know how to use # -*- coding: utf-8 -*-, I have just replace Arrêté with Arret and now everything works perfectly.
racquemis
Posts: 73
Joined: Monday 02 November 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by racquemis »

Good to hear. Check the script in the first post. Updated to include that line.
denisb88
Posts: 18
Joined: Thursday 11 February 2016 8:37
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by denisb88 »

Now everything works fine.
Great thanks from France ;-)
denisb88
Posts: 18
Joined: Thursday 11 February 2016 8:37
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by denisb88 »

I don't know why but there is no log of files played.
Before, with the older script, logging works but with the new script, no log is available.
denisb88
Posts: 18
Joined: Thursday 11 February 2016 8:37
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by denisb88 »

And another error message now
'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
Traceback (most recent call last):
File "plex2.py", line 182, in <module>
PlayString = urllib.quote(translate(PlayString).encode("utf-8"))
File "plex2.py", line 109, in translate
returnstring = returnstring.replace(transl_search[idx],transl_replace[idx])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
None
racquemis
Posts: 73
Joined: Monday 02 November 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by racquemis »

denisb88 wrote:I don't know why but there is no log of files played.
Before, with the older script, logging works but with the new script, no log is available.
Which log do you mean? The one in the terminal? The domoticz text dummy? Or the domoticz log?
The domoticz text dummy log is automatically cleared when Play Progress is shown. Otherwise the log would contain thousands of lines in no time at all. This has always been this way.
denisb88
Posts: 18
Joined: Thursday 11 February 2016 8:37
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by denisb88 »

When you click on Text icon, it seemed to me that I could see the movies had been played with the last script
racquemis
Posts: 73
Joined: Monday 02 November 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by racquemis »

There is still a small bug that will cause the text log not to be cleared when the playback status is 'stopped'. Maybe that is what you're seeing.
You can have a log of what it played, just disable the PlayProgress and disable the autoclear. There are two parameters for it in the script.
denisb88
Posts: 18
Joined: Thursday 11 February 2016 8:37
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by denisb88 »

Thanks, I will try
denisb88
Posts: 18
Joined: Thursday 11 February 2016 8:37
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by denisb88 »

Yes, I understand, I have tried.
Do you thing if it's possible to keep only one ligne of each movie played in the log or it's to difficult to do ?
racquemis
Posts: 73
Joined: Monday 02 November 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by racquemis »

There isn't really a good way to do you want. The domoticz log is not suitable for this.
I can only think of the option of introducing a second set of text dummy's with the only purpose logging a single entry for each movie/episode played.

But i'm not going to do that. There are better tools to maintain a history of all the movies/episodes played.
You should look at a tool called PlexPy. You install it on the same system as your plex server. The tool reads the plex log file. And maintains a history for you. There are even statistics for each Plex User.
BoelShit
Posts: 10
Joined: Sunday 14 February 2016 11:18
Target OS: Windows
Domoticz version:
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by BoelShit »

This script gives me a 401 Unauthorizated probably because I have multiple Plex Home users in the household. I'm trying to modify it so it can use a token.
racquemis
Posts: 73
Joined: Monday 02 November 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by racquemis »

Have you tried the solution given in the first post? It works for me.
under Plex Options>Server>Network you can specify which networks can access the server without authentication. You can enter specific IP addresses or whole networks (e.g 192.168.0.1) don’t forget to add the subnet as shows in the settings description.
denisb88
Posts: 18
Joined: Thursday 11 February 2016 8:37
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by denisb88 »

Thanks, it's exactly what I want with PlexPy
BoelShit
Posts: 10
Joined: Sunday 14 February 2016 11:18
Target OS: Windows
Domoticz version:
Contact:

Re: Plex Status - Video, Audio, Photo, Play Progress

Post by BoelShit »

racquemis wrote:Have you tried the solution given in the first post? It works for me.
I have these settings in the Plex server under network: "127.0.0.1/255.255.255.255". I don't have to login to the Plex web page but when you enable Plex Home Plex tells you this:
If you've already set up a Plex Home, then you don't need to do anything else. When you become part of a Home, your Server automatically changes some security-related settings, one of which requires authentication for all access to the Server.
Do you have Plex Home enabled?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest