Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
5027acfd
Commit
5027acfd
authored
9 years ago
by
miniconfig
Browse files
Options
Downloads
Patches
Plain Diff
Fixed additional pylint and flake issues
parent
48306ddb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
homeassistant/components/media_player/plex.py
+13
-6
13 additions, 6 deletions
homeassistant/components/media_player/plex.py
with
13 additions
and
6 deletions
homeassistant/components/media_player/plex.py
+
13
−
6
View file @
5027acfd
...
...
@@ -52,6 +52,8 @@ SUPPORT_PLEX = SUPPORT_PAUSE | SUPPORT_PREVIOUS_TRACK | SUPPORT_NEXT_TRACK
# pylint: disable=abstract-method
# pylint: disable=unused-argument
def
setup_platform
(
hass
,
config
,
add_devices
,
discovery_info
=
None
):
"""
Sets up the plex platform.
"""
name
=
config
.
get
(
'
name
'
,
''
)
...
...
@@ -61,15 +63,15 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
plexserver
=
plexuser
.
getResource
(
name
).
connect
()
dev
=
plexserver
.
clients
()
for
device
in
dev
:
if
not
"
PlayStation
"
in
device
.
name
:
if
"
PlayStation
"
not
in
device
.
name
:
add_devices
([
PlexClient
(
device
.
name
,
plexserver
)])
class
PlexClient
(
MediaPlayerDevice
):
"""
Represents a Plex device.
"""
# pylint: disable=too-many-public-methods
def
__init__
(
self
,
name
,
plexserver
):
self
.
client
=
plexserver
.
client
(
name
)
self
.
_name
=
name
...
...
@@ -114,7 +116,8 @@ class PlexClient(MediaPlayerDevice):
if
self
.
_media
is
None
:
return
None
else
:
media_type
=
self
.
server
.
library
.
getByKey
(
self
.
media_content_id
).
type
media_type
=
self
.
server
.
library
.
getByKey
(
self
.
media_content_id
).
type
if
media_type
==
'
episode
'
:
return
MEDIA_TYPE_TVSHOW
elif
media_type
==
'
movie
'
:
...
...
@@ -143,11 +146,13 @@ class PlexClient(MediaPlayerDevice):
# find a string we can use as a title
if
self
.
_media
is
not
None
:
return
self
.
server
.
library
.
getByKey
(
self
.
media_content_id
).
title
@property
def
media_season
(
self
):
"""
Season of curent playing media. (TV Show only)
"""
if
self
.
_media
is
not
None
:
show_season
=
self
.
server
.
library
.
getByKey
(
self
.
media_content_id
).
season
().
index
show_season
=
self
.
server
.
library
.
getByKey
(
self
.
media_content_id
).
season
().
index
return
show_season
else
:
return
None
...
...
@@ -156,7 +161,8 @@ class PlexClient(MediaPlayerDevice):
def
media_series_title
(
self
):
"""
Series title of current playing media. (TV Show only)
"""
if
self
.
_media
is
not
None
:
series_title
=
self
.
server
.
library
.
getByKey
(
self
.
media_content_id
).
show
().
title
series_title
=
self
.
server
.
library
.
getByKey
(
self
.
media_content_id
).
show
().
title
return
series_title
else
:
return
None
...
...
@@ -165,7 +171,8 @@ class PlexClient(MediaPlayerDevice):
def
media_episode
(
self
):
"""
Episode of current playing media. (TV Show only)
"""
if
self
.
_media
is
not
None
:
show_episode
=
self
.
server
.
library
.
getByKey
(
self
.
media_content_id
).
index
show_episode
=
self
.
server
.
library
.
getByKey
(
self
.
media_content_id
).
index
return
show_episode
else
:
return
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment