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

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

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

View File

@@ -766,6 +766,40 @@ class rivwebpyapi(object):
ret=ret+block
return ret
def GetPodcast(self,cast_id,filename):
"""
Get posted podcast audio from the Rivendell audio store.
Takes the following arguments:
cast_id - ID of the owning podcast item (integer).
filename - Destination filename (string).
"""
if(cast_id<0):
raise ValueError('invalid podcast ID')
#
# Build the WebAPI arguments
#
postdata={
'COMMAND': '37',
'LOGIN_NAME': self.__connection_username,
'PASSWORD': self.__connection_password,
'ID': str(cast_id)
}
#
# Fetch the audio data
#
r=requests.post(self.__connection_url,data=postdata,stream=True)
if(r.status_code!=requests.codes.ok):
self.__throwError(response=r)
with open(filename,'wb') as handle:
for block in r.iter_content(1024):
handle.write(block)
def Import(self,filename,use_metadata,cart_number=0,cut_number=0,
channels=2,normalization_level=0,autotrim_level=0,
group_name='',title=''):