mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-26 21:50:20 +00:00
delete should be part of the media not the media part
This commit is contained in:
parent
e2f90ea81d
commit
828b41e0ec
1 changed files with 9 additions and 10 deletions
|
@ -52,6 +52,15 @@ class Media(PlexObject):
|
|||
self.width = cast(int, data.attrib.get('width'))
|
||||
self.parts = self.findItems(data, MediaPart)
|
||||
|
||||
def delete(self):
|
||||
part = self._initpath + '/media/%s' % self.id
|
||||
try:
|
||||
return self._server.query(part, method=self._server._session.delete)
|
||||
except BadRequest:
|
||||
log.error("Failed to delete %s. This could be because you havn't allowed "
|
||||
"items to be deleted" % part)
|
||||
raise
|
||||
|
||||
|
||||
@utils.registerPlexObject
|
||||
class MediaPart(PlexObject):
|
||||
|
@ -85,16 +94,6 @@ class MediaPart(PlexObject):
|
|||
self.size = cast(int, data.attrib.get('size'))
|
||||
self.streams = self._buildStreams(data)
|
||||
|
||||
def delete(self):
|
||||
log.debug('Deleting %s', self.file)
|
||||
part = self._initpath + '/media/%s' % self.id
|
||||
try:
|
||||
return self._server.query(part, method=self._server._session.delete)
|
||||
except BadRequest:
|
||||
log.error("Failed to delete %s. This could be because you havn't allowed "
|
||||
"items to be deleted" % part)
|
||||
raise
|
||||
|
||||
def _buildStreams(self, data):
|
||||
streams = []
|
||||
for elem in data:
|
||||
|
|
Loading…
Reference in a new issue