|
1 | 1 | # -*- coding: utf-8 -*- |
2 | | -from plexapi import log, utils, compat |
| 2 | + |
| 3 | +import xml |
| 4 | + |
| 5 | +from plexapi import compat, log, utils |
3 | 6 | from plexapi.base import PlexObject |
4 | 7 | from plexapi.exceptions import BadRequest |
5 | 8 | from plexapi.utils import cast |
@@ -143,7 +146,7 @@ def setDefaultAudioStream(self, stream): |
143 | 146 |
|
144 | 147 | def setDefaultSubtitleStream(self, stream): |
145 | 148 | """ Set the default :class:`~plexapi.media.SubtitleStream` for this MediaPart. |
146 | | - |
| 149 | +
|
147 | 150 | Parameters: |
148 | 151 | stream (:class:`~plexapi.media.SubtitleStream`): SubtitleStream to set as default. |
149 | 152 | """ |
@@ -370,38 +373,38 @@ class Conversion(PlexObject): |
370 | 373 | TAG = 'Video' |
371 | 374 |
|
372 | 375 | 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') |
405 | 408 |
|
406 | 409 |
|
407 | 410 | class MediaTag(PlexObject): |
@@ -560,7 +563,10 @@ def _loadData(self, data): |
560 | 563 | def select(self): |
561 | 564 | key = self._initpath[:-1] |
562 | 565 | 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 |
564 | 570 |
|
565 | 571 |
|
566 | 572 | @utils.registerPlexObject |
|
0 commit comments