2021-12-09 Fred Gleason <fredg@paravelsystems.com>

* Added a 'SavePodcast()' method to the 'rivwebpyapi' API.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2021-12-09 11:59:48 -05:00
parent cf0f9d9de8
commit dc3915b601
5 changed files with 117 additions and 1 deletions

View File

@@ -1854,6 +1854,40 @@ class rivwebpyapi(object):
return handler.output()[0]
def SavePodcast(self,cast_id,filename):
"""
Save posted podcast audio to the Rivendell audio store.
Takes the following arguments:
filename - Name of the file containing audio to be stored (string).
cast_id - ID of the owning podcast item (integer).
"""
if(not filename):
raise ValueError('missing filename')
if(cast_id<0):
raise ValueError('invalid podcast id')
#
# Build the WebAPI arguments
#
postdata={
'COMMAND': '38',
'LOGIN_NAME': self.__connection_username,
'PASSWORD': self.__connection_password,
'ID': str(cast_id)
}
files={'FILENAME': open(filename,'rb')}
#
# Execute
#
r=requests.post(self.__connection_url,data=postdata,files=files)
if(r.status_code!=requests.codes.ok):
self.__throwError(response=r)
def UnassignSchedCode(self,cart_number,sched_code):
"""
Unassign a schedule code from a cart.