Skip to content

Commit 7190d9c

Browse files
committed
Merge remote-tracking branch 'origin/poster_change' into poster_change
2 parents 53a6156 + 06ca74d commit 7190d9c

File tree

1 file changed

+41
-35
lines changed

1 file changed

+41
-35
lines changed

plexapi/media.py

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# -*- coding: utf-8 -*-
2-
from plexapi import log, utils, compat
2+
3+
import xml
4+
5+
from plexapi import compat, log, utils
36
from plexapi.base import PlexObject
47
from plexapi.exceptions import BadRequest
58
from plexapi.utils import cast
@@ -143,7 +146,7 @@ def setDefaultAudioStream(self, stream):
143146

144147
def setDefaultSubtitleStream(self, stream):
145148
""" Set the default :class:`~plexapi.media.SubtitleStream` for this MediaPart.
146-
149+
147150
Parameters:
148151
stream (:class:`~plexapi.media.SubtitleStream`): SubtitleStream to set as default.
149152
"""
@@ -370,38 +373,38 @@ class Conversion(PlexObject):
370373
TAG = 'Video'
371374

372375
def _loadData(self, data):
373-
self._data = data
374-
self.addedAt = data.attrib.get('addedAt')
375-
self.art = data.attrib.get('art')
376-
self.chapterSource = data.attrib.get('chapterSource')
377-
self.contentRating = data.attrib.get('contentRating')
378-
self.duration = data.attrib.get('duration')
379-
self.generatorID = data.attrib.get('generatorID')
380-
self.generatorType = data.attrib.get('generatorType')
381-
self.guid = data.attrib.get('guid')
382-
self.key = data.attrib.get('key')
383-
self.lastViewedAt = data.attrib.get('lastViewedAt')
384-
self.librarySectionID = data.attrib.get('librarySectionID')
385-
self.librarySectionKey = data.attrib.get('librarySectionKey')
386-
self.librarySectionTitle = data.attrib.get('librarySectionTitle')
387-
self.originallyAvailableAt = data.attrib.get('originallyAvailableAt')
388-
self.playQueueItemID = data.attrib.get('playQueueItemID')
389-
self.playlistID = data.attrib.get('playlistID')
390-
self.primaryExtraKey = data.attrib.get('primaryExtraKey')
391-
self.rating = data.attrib.get('rating')
392-
self.ratingKey = data.attrib.get('ratingKey')
393-
self.studio = data.attrib.get('studio')
394-
self.summary = data.attrib.get('summary')
395-
self.tagline = data.attrib.get('tagline')
396-
self.target = data.attrib.get('target')
397-
self.thumb = data.attrib.get('thumb')
398-
self.title = data.attrib.get('title')
399-
self.type = data.attrib.get('type')
400-
self.updatedAt = data.attrib.get('updatedAt')
401-
self.userID = data.attrib.get('userID')
402-
self.username = data.attrib.get('username')
403-
self.viewOffset = data.attrib.get('viewOffset')
404-
self.year = data.attrib.get('year')
376+
self._data = data
377+
self.addedAt = data.attrib.get('addedAt')
378+
self.art = data.attrib.get('art')
379+
self.chapterSource = data.attrib.get('chapterSource')
380+
self.contentRating = data.attrib.get('contentRating')
381+
self.duration = data.attrib.get('duration')
382+
self.generatorID = data.attrib.get('generatorID')
383+
self.generatorType = data.attrib.get('generatorType')
384+
self.guid = data.attrib.get('guid')
385+
self.key = data.attrib.get('key')
386+
self.lastViewedAt = data.attrib.get('lastViewedAt')
387+
self.librarySectionID = data.attrib.get('librarySectionID')
388+
self.librarySectionKey = data.attrib.get('librarySectionKey')
389+
self.librarySectionTitle = data.attrib.get('librarySectionTitle')
390+
self.originallyAvailableAt = data.attrib.get('originallyAvailableAt')
391+
self.playQueueItemID = data.attrib.get('playQueueItemID')
392+
self.playlistID = data.attrib.get('playlistID')
393+
self.primaryExtraKey = data.attrib.get('primaryExtraKey')
394+
self.rating = data.attrib.get('rating')
395+
self.ratingKey = data.attrib.get('ratingKey')
396+
self.studio = data.attrib.get('studio')
397+
self.summary = data.attrib.get('summary')
398+
self.tagline = data.attrib.get('tagline')
399+
self.target = data.attrib.get('target')
400+
self.thumb = data.attrib.get('thumb')
401+
self.title = data.attrib.get('title')
402+
self.type = data.attrib.get('type')
403+
self.updatedAt = data.attrib.get('updatedAt')
404+
self.userID = data.attrib.get('userID')
405+
self.username = data.attrib.get('username')
406+
self.viewOffset = data.attrib.get('viewOffset')
407+
self.year = data.attrib.get('year')
405408

406409

407410
class MediaTag(PlexObject):
@@ -560,7 +563,10 @@ def _loadData(self, data):
560563
def select(self):
561564
key = self._initpath[:-1]
562565
data = '%s?url=%s' % (key, compat.quote_plus(self.ratingKey))
563-
self._server.query(data, method=self._server._session.put)
566+
try:
567+
self._server.query(data, method=self._server._session.put)
568+
except xml.etree.ElementTree.ParseError:
569+
pass
564570

565571

566572
@utils.registerPlexObject

0 commit comments

Comments
 (0)