mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-20 15:02:27 +02:00
2021-12-11 Fred Gleason <fredg@paravelsystems.com>
* Added a 'Cut' class to the 'rivwebapi' API. * Modified the 'AddCut()', 'ListCut()' and 'ListCuts()' methods to use the 'Cut' class in the 'rivwebapi' API. * Added an 'EditCut()' method to the 'rivwebpyapi' API. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
4071b6a5ac
commit
dd3cee96d4
@ -22738,3 +22738,8 @@
|
|||||||
* Modified the 'AddCart()', 'ListCart()' and 'ListCarts()' methods
|
* Modified the 'AddCart()', 'ListCart()' and 'ListCarts()' methods
|
||||||
to use the 'Cart' class in the 'rivwebapi' API.
|
to use the 'Cart' class in the 'rivwebapi' API.
|
||||||
* Added an 'EditCart()' method to the 'rivwebpyapi' API.
|
* Added an 'EditCart()' method to the 'rivwebpyapi' API.
|
||||||
|
2021-12-11 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Added a 'Cut' class to the 'rivwebapi' API.
|
||||||
|
* Modified the 'AddCut()', 'ListCut()' and 'ListCuts()' methods
|
||||||
|
to use the 'Cut' class in the 'rivwebapi' API.
|
||||||
|
* Added an 'EditCut()' method to the 'rivwebpyapi' API.
|
||||||
|
@ -73,6 +73,54 @@ CART_FIELDS={
|
|||||||
'songId': 'string'
|
'songId': 'string'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CUT_FIELDS={
|
||||||
|
'cutName': 'string',
|
||||||
|
'cartNumber': 'integer',
|
||||||
|
'cutNumber': 'integer',
|
||||||
|
'evergreen': 'boolean',
|
||||||
|
'description': 'string',
|
||||||
|
'outcue': 'string',
|
||||||
|
'isrc': 'string',
|
||||||
|
'isci': 'string',
|
||||||
|
'recordingMbId': 'string',
|
||||||
|
'releaseMbId': 'string',
|
||||||
|
'length': 'integer',
|
||||||
|
'originDatetime': 'datetime',
|
||||||
|
'startDatetime': 'datetime',
|
||||||
|
'endDatetime': 'datetime',
|
||||||
|
'sun': 'boolean',
|
||||||
|
'mon': 'boolean',
|
||||||
|
'tue': 'boolean',
|
||||||
|
'wed': 'boolean',
|
||||||
|
'thu': 'boolean',
|
||||||
|
'fri': 'boolean',
|
||||||
|
'sat': 'boolean',
|
||||||
|
'startDaypart': 'time',
|
||||||
|
'endDaypart': 'time',
|
||||||
|
'originName': 'string',
|
||||||
|
'originLoginName': 'string',
|
||||||
|
'sourceHostname': 'string',
|
||||||
|
'weight': 'integer',
|
||||||
|
'lastPlayDatetime': 'datetime',
|
||||||
|
'playCounter': 'integer',
|
||||||
|
'codingFormat': 'integer',
|
||||||
|
'sampleRate': 'integer',
|
||||||
|
'bitRate': 'integer',
|
||||||
|
'channels': 'integer',
|
||||||
|
'playGain': 'integer',
|
||||||
|
'startPoint': 'integer',
|
||||||
|
'endPoint': 'integer',
|
||||||
|
'fadeupPoint': 'integer',
|
||||||
|
'fadedownPoint': 'integer',
|
||||||
|
'segueStartPoint': 'integer',
|
||||||
|
'segueEndPoint': 'integer',
|
||||||
|
'segueGain': 'integer',
|
||||||
|
'hookStartPoint': 'integer',
|
||||||
|
'hookEndPoint': 'integer',
|
||||||
|
'talkStartPoint': 'integer',
|
||||||
|
'talkEndPoint': 'integer'
|
||||||
|
}
|
||||||
|
|
||||||
class RivWebPyApi_ListHandler(ContentHandler):
|
class RivWebPyApi_ListHandler(ContentHandler):
|
||||||
def __init__(self,base_tag,fields):
|
def __init__(self,base_tag,fields):
|
||||||
self.__output=[]
|
self.__output=[]
|
||||||
@ -248,6 +296,23 @@ class Cart(object):
|
|||||||
if(key in self.__values.keys()):
|
if(key in self.__values.keys()):
|
||||||
self.__values[key]=values[key]
|
self.__values[key]=values[key]
|
||||||
|
|
||||||
|
class Cut(object):
|
||||||
|
def __init__(self,values={}):
|
||||||
|
if(len(values)==0):
|
||||||
|
self.__values={}
|
||||||
|
for key in CUT_FIELDS:
|
||||||
|
self.__values[key]=None
|
||||||
|
else:
|
||||||
|
self.__values=values
|
||||||
|
|
||||||
|
def values(self):
|
||||||
|
return self.__values
|
||||||
|
|
||||||
|
def setValues(self,values):
|
||||||
|
for key in values:
|
||||||
|
if(key in self.__values.keys()):
|
||||||
|
self.__values[key]=values[key]
|
||||||
|
|
||||||
class rivwebpyapi(object):
|
class rivwebpyapi(object):
|
||||||
"""
|
"""
|
||||||
Create a 'RivWebPyApi' object for accessing the Web API.
|
Create a 'RivWebPyApi' object for accessing the Web API.
|
||||||
@ -348,7 +413,7 @@ class rivwebpyapi(object):
|
|||||||
def AddCut(self,cart_number):
|
def AddCut(self,cart_number):
|
||||||
"""
|
"""
|
||||||
Add a new cut to an existing audio cart. Returns the metadata of
|
Add a new cut to an existing audio cart. Returns the metadata of
|
||||||
the newly created cut (dictionary).
|
the newly created cut (rivwebpyapi.Cut object).
|
||||||
|
|
||||||
Takes the following argument:
|
Takes the following argument:
|
||||||
|
|
||||||
@ -380,57 +445,10 @@ class rivwebpyapi(object):
|
|||||||
#
|
#
|
||||||
# Generate the output dictionary
|
# Generate the output dictionary
|
||||||
#
|
#
|
||||||
fields={
|
handler=RivWebPyApi_ListHandler(base_tag='cut',fields=CUT_FIELDS)
|
||||||
'cutName': 'string',
|
|
||||||
'cartNumber': 'integer',
|
|
||||||
'cutNumber': 'integer',
|
|
||||||
'evergreen': 'boolean',
|
|
||||||
'description': 'string',
|
|
||||||
'outcue': 'string',
|
|
||||||
'isrc': 'string',
|
|
||||||
'isci': 'string',
|
|
||||||
'recordingMbId': 'string',
|
|
||||||
'releaseMbId': 'string',
|
|
||||||
'length': 'integer',
|
|
||||||
'originDatetime': 'datetime',
|
|
||||||
'startDatetime': 'datetime',
|
|
||||||
'endDatetime': 'datetime',
|
|
||||||
'sun': 'boolean',
|
|
||||||
'mon': 'boolean',
|
|
||||||
'tue': 'boolean',
|
|
||||||
'wed': 'boolean',
|
|
||||||
'thu': 'boolean',
|
|
||||||
'fri': 'boolean',
|
|
||||||
'sat': 'boolean',
|
|
||||||
'startDaypart': 'time',
|
|
||||||
'endDaypart': 'time',
|
|
||||||
'originName': 'string',
|
|
||||||
'originLoginName': 'string',
|
|
||||||
'sourceHostname': 'string',
|
|
||||||
'weight': 'integer',
|
|
||||||
'lastPlayDatetime': 'datetime',
|
|
||||||
'playCounter': 'integer',
|
|
||||||
'codingFormat': 'integer',
|
|
||||||
'sampleRate': 'integer',
|
|
||||||
'bitRate': 'integer',
|
|
||||||
'channels': 'integer',
|
|
||||||
'playGain': 'integer',
|
|
||||||
'startPoint': 'integer',
|
|
||||||
'endPoint': 'integer',
|
|
||||||
'fadeupPoint': 'integer',
|
|
||||||
'fadedownPoint': 'integer',
|
|
||||||
'segueStartPoint': 'integer',
|
|
||||||
'segueEndPoint': 'integer',
|
|
||||||
'segueGain': 'integer',
|
|
||||||
'hookStartPoint': 'integer',
|
|
||||||
'hookEndPoint': 'integer',
|
|
||||||
'talkStartPoint': 'integer',
|
|
||||||
'talkEndPoint': 'integer'
|
|
||||||
}
|
|
||||||
handler=RivWebPyApi_ListHandler(base_tag='cut',fields=fields)
|
|
||||||
xml.sax.parseString(r.text,handler)
|
xml.sax.parseString(r.text,handler)
|
||||||
|
|
||||||
return handler.output()[0]
|
return Cut(handler.output()[0])
|
||||||
|
|
||||||
def AddLog(self,service_name,log_name):
|
def AddLog(self,service_name,log_name):
|
||||||
"""
|
"""
|
||||||
@ -678,7 +696,7 @@ class rivwebpyapi(object):
|
|||||||
cart_number - The number of the desired cart, in the range
|
cart_number - The number of the desired cart, in the range
|
||||||
1 - 999999.
|
1 - 999999.
|
||||||
|
|
||||||
values - A Cart object containing the desired edits.
|
values - A rivwebpyapi.Cart object containing the desired edits.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if((cart_number<0)or(cart_number>999999)):
|
if((cart_number<0)or(cart_number>999999)):
|
||||||
@ -694,7 +712,6 @@ class rivwebpyapi(object):
|
|||||||
'CART_NUMBER': str(cart_number)
|
'CART_NUMBER': str(cart_number)
|
||||||
}
|
}
|
||||||
postnames={
|
postnames={
|
||||||
'number': 'CART_NUMBER',
|
|
||||||
'groupName': 'GROUP_NAME',
|
'groupName': 'GROUP_NAME',
|
||||||
'title': 'TITLE',
|
'title': 'TITLE',
|
||||||
'artist': 'ARTIST',
|
'artist': 'ARTIST',
|
||||||
@ -732,6 +749,84 @@ class rivwebpyapi(object):
|
|||||||
|
|
||||||
return Cart(handler.output()[0])
|
return Cart(handler.output()[0])
|
||||||
|
|
||||||
|
def EditCut(self,cart_number,cut_number,values):
|
||||||
|
"""
|
||||||
|
Write metadata changes for an existing cut into the database.
|
||||||
|
|
||||||
|
Takes the following arguments:
|
||||||
|
|
||||||
|
cart_number - The number of the cart containing the cut to be
|
||||||
|
edited, in the range 1 - 999999.
|
||||||
|
|
||||||
|
cut_number - The number of the cut to be edited, in the range
|
||||||
|
1 - 999 (integer)
|
||||||
|
|
||||||
|
values - A rivwebpyapi.Cut object containing the desired edits.
|
||||||
|
"""
|
||||||
|
|
||||||
|
if((cart_number<0)or(cart_number>999999)):
|
||||||
|
raise ValueError('invalid cart number')
|
||||||
|
if((cut_number<1)or(cut_number>999)):
|
||||||
|
raise ValueError('invalid cut number')
|
||||||
|
|
||||||
|
#
|
||||||
|
# Build the WebAPI arguments
|
||||||
|
#
|
||||||
|
postdata={
|
||||||
|
'COMMAND': '15',
|
||||||
|
'LOGIN_NAME': self.__connection_username,
|
||||||
|
'PASSWORD': self.__connection_password,
|
||||||
|
'CART_NUMBER': str(cart_number),
|
||||||
|
'CUT_NUMBER': str(cut_number)
|
||||||
|
}
|
||||||
|
postnames={
|
||||||
|
'evergreen': 'EVERGREEN',
|
||||||
|
'description': 'DESCRIPTION',
|
||||||
|
'outcue': 'OUTCUE',
|
||||||
|
'isrc': 'ISRC',
|
||||||
|
'isci': 'ISCI',
|
||||||
|
'startDatetime': 'START_DATETIME',
|
||||||
|
'endDatetime': 'END_DATETIME',
|
||||||
|
'sun': 'SUN',
|
||||||
|
'mon': 'MON',
|
||||||
|
'tue': 'TUE',
|
||||||
|
'wed': 'WED',
|
||||||
|
'thu': 'THU',
|
||||||
|
'fri': 'FRI',
|
||||||
|
'sat': 'SAT',
|
||||||
|
'startDaypart': 'START_DAYPART',
|
||||||
|
'endDaypart': 'END_DAYPART',
|
||||||
|
'weight': 'WEIGHT',
|
||||||
|
'startPoint': 'START_POINT',
|
||||||
|
'endPoint': 'END_POINT',
|
||||||
|
'fadeupPoint': 'FADEUP_POINT',
|
||||||
|
'fadedownPoint': 'FADEDOWN_POINT',
|
||||||
|
'segueStartPoint': 'SEGUE_START_POINT',
|
||||||
|
'segueEndPoint': 'SEGUE_END_POINT',
|
||||||
|
'hookStartPoint': 'HOOK_START_POINT',
|
||||||
|
'hookEndPoint': 'HOOK_END_POINT',
|
||||||
|
'talkStartPoint': 'TALK_START_POINT',
|
||||||
|
'talkEndPoint': 'TALK_END_POINT'
|
||||||
|
}
|
||||||
|
for key in values:
|
||||||
|
if((values[key]!=None)and(key in postnames.keys())):
|
||||||
|
postdata[postnames[key]]=values[key]
|
||||||
|
|
||||||
|
#
|
||||||
|
# Execute
|
||||||
|
#
|
||||||
|
r=requests.post(self.__connection_url,data=postdata)
|
||||||
|
if(r.status_code!=requests.codes.ok):
|
||||||
|
self.__throwError(response=r)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Generate the output dictionary
|
||||||
|
#
|
||||||
|
handler=RivWebPyApi_ListHandler(base_tag='cut',fields=CUT_FIELDS)
|
||||||
|
xml.sax.parseString(r.text,handler)
|
||||||
|
|
||||||
|
return Cut(handler.output()[0])
|
||||||
|
|
||||||
def Export(self,filename,cart_number,cut_number,audio_format,channels,
|
def Export(self,filename,cart_number,cut_number,audio_format,channels,
|
||||||
sample_rate,bit_rate,quality,start_point,end_point,
|
sample_rate,bit_rate,quality,start_point,end_point,
|
||||||
normalization_level,enable_metadata):
|
normalization_level,enable_metadata):
|
||||||
@ -1127,7 +1222,7 @@ class rivwebpyapi(object):
|
|||||||
def ListCut(self,cart_number,cut_number):
|
def ListCut(self,cart_number,cut_number):
|
||||||
"""
|
"""
|
||||||
Returns the metadata associated with a Rivendell cut
|
Returns the metadata associated with a Rivendell cut
|
||||||
(dictionary).
|
(rivwebpyapi.Cut object).
|
||||||
|
|
||||||
Takes the following arguments:
|
Takes the following arguments:
|
||||||
|
|
||||||
@ -1164,63 +1259,15 @@ class rivwebpyapi(object):
|
|||||||
#
|
#
|
||||||
# Generate the output dictionary
|
# Generate the output dictionary
|
||||||
#
|
#
|
||||||
|
handler=RivWebPyApi_ListHandler(base_tag='cut',fields=CUT_FIELDS)
|
||||||
fields={
|
|
||||||
'cutName': 'string',
|
|
||||||
'cartNumber': 'integer',
|
|
||||||
'cutNumber': 'integer',
|
|
||||||
'evergreen': 'boolean',
|
|
||||||
'description': 'string',
|
|
||||||
'outcue': 'string',
|
|
||||||
'isrc': 'string',
|
|
||||||
'isci': 'string',
|
|
||||||
'recordingMbId': 'string',
|
|
||||||
'releaseMbId': 'string',
|
|
||||||
'length': 'integer',
|
|
||||||
'originDatetime': 'datetime',
|
|
||||||
'startDatetime': 'datetime',
|
|
||||||
'endDatetime': 'datetime',
|
|
||||||
'sun': 'boolean',
|
|
||||||
'mon': 'boolean',
|
|
||||||
'tue': 'boolean',
|
|
||||||
'wed': 'boolean',
|
|
||||||
'thu': 'boolean',
|
|
||||||
'fri': 'boolean',
|
|
||||||
'sat': 'boolean',
|
|
||||||
'startDaypart': 'time',
|
|
||||||
'endDaypart': 'time',
|
|
||||||
'originName': 'string',
|
|
||||||
'originLoginName': 'string',
|
|
||||||
'sourceHostname': 'string',
|
|
||||||
'weight': 'integer',
|
|
||||||
'lastPlayDatetime': 'datetime',
|
|
||||||
'playCounter': 'integer',
|
|
||||||
'codingFormat': 'integer',
|
|
||||||
'sampleRate': 'integer',
|
|
||||||
'bitRate': 'integer',
|
|
||||||
'channels': 'integer',
|
|
||||||
'playGain': 'integer',
|
|
||||||
'startPoint': 'integer',
|
|
||||||
'endPoint': 'integer',
|
|
||||||
'fadeupPoint': 'integer',
|
|
||||||
'fadedownPoint': 'integer',
|
|
||||||
'segueStartPoint': 'integer',
|
|
||||||
'segueEndPoint': 'integer',
|
|
||||||
'segueGain': 'integer',
|
|
||||||
'hookStartPoint': 'integer',
|
|
||||||
'hookEndPoint': 'integer',
|
|
||||||
'talkStartPoint': 'integer',
|
|
||||||
'talkEndPoint': 'integer'
|
|
||||||
}
|
|
||||||
handler=RivWebPyApi_ListHandler(base_tag='cut',fields=fields)
|
|
||||||
xml.sax.parseString(r.text,handler)
|
xml.sax.parseString(r.text,handler)
|
||||||
|
|
||||||
return handler.output()[0]
|
return Cut(handler.output()[0])
|
||||||
|
|
||||||
def ListCuts(self,cart_number):
|
def ListCuts(self,cart_number):
|
||||||
"""
|
"""
|
||||||
Returns the metadata associated with all of the cuts in
|
Returns the metadata associated with all of the cuts in
|
||||||
a Rivendell cart (list of dictionaries).
|
a Rivendell cart (list of rivwebpyapi.Cut objects).
|
||||||
|
|
||||||
Takes the following argument:
|
Takes the following argument:
|
||||||
|
|
||||||
@ -1252,57 +1299,13 @@ class rivwebpyapi(object):
|
|||||||
#
|
#
|
||||||
# Generate the output dictionary
|
# Generate the output dictionary
|
||||||
#
|
#
|
||||||
fields={
|
handler=RivWebPyApi_ListHandler(base_tag='cut',fields=CUT_FIELDS)
|
||||||
'cutName': 'string',
|
|
||||||
'cartNumber': 'integer',
|
|
||||||
'cutNumber': 'integer',
|
|
||||||
'evergreen': 'boolean',
|
|
||||||
'description': 'string',
|
|
||||||
'outcue': 'string',
|
|
||||||
'isrc': 'string',
|
|
||||||
'isci': 'string',
|
|
||||||
'recordingMbId': 'string',
|
|
||||||
'releaseMbId': 'string',
|
|
||||||
'length': 'integer',
|
|
||||||
'originDatetime': 'datetime',
|
|
||||||
'startDatetime': 'datetime',
|
|
||||||
'endDatetime': 'datetime',
|
|
||||||
'sun': 'boolean',
|
|
||||||
'mon': 'boolean',
|
|
||||||
'tue': 'boolean',
|
|
||||||
'wed': 'boolean',
|
|
||||||
'thu': 'boolean',
|
|
||||||
'fri': 'boolean',
|
|
||||||
'sat': 'boolean',
|
|
||||||
'startDaypart': 'time',
|
|
||||||
'endDaypart': 'time',
|
|
||||||
'originName': 'string',
|
|
||||||
'originLoginName': 'string',
|
|
||||||
'sourceHostname': 'string',
|
|
||||||
'weight': 'integer',
|
|
||||||
'lastPlayDatetime': 'datetime',
|
|
||||||
'playCounter': 'integer',
|
|
||||||
'codingFormat': 'integer',
|
|
||||||
'sampleRate': 'integer',
|
|
||||||
'bitRate': 'integer',
|
|
||||||
'channels': 'integer',
|
|
||||||
'playGain': 'integer',
|
|
||||||
'startPoint': 'integer',
|
|
||||||
'endPoint': 'integer',
|
|
||||||
'fadeupPoint': 'integer',
|
|
||||||
'fadedownPoint': 'integer',
|
|
||||||
'segueStartPoint': 'integer',
|
|
||||||
'segueEndPoint': 'integer',
|
|
||||||
'segueGain': 'integer',
|
|
||||||
'hookStartPoint': 'integer',
|
|
||||||
'hookEndPoint': 'integer',
|
|
||||||
'talkStartPoint': 'integer',
|
|
||||||
'talkEndPoint': 'integer'
|
|
||||||
}
|
|
||||||
handler=RivWebPyApi_ListHandler(base_tag='cut',fields=fields)
|
|
||||||
xml.sax.parseString(r.text,handler)
|
xml.sax.parseString(r.text,handler)
|
||||||
|
out=handler.output()
|
||||||
return handler.output()
|
ret=[]
|
||||||
|
for item in out:
|
||||||
|
ret.append(Cut(item))
|
||||||
|
return ret
|
||||||
|
|
||||||
def ListGroup(self,group_name):
|
def ListGroup(self,group_name):
|
||||||
"""
|
"""
|
||||||
|
@ -29,6 +29,7 @@ EXTRA_DIST = add_cart.py\
|
|||||||
delete_audio.py\
|
delete_audio.py\
|
||||||
delete_log.py\
|
delete_log.py\
|
||||||
edit_cart.py\
|
edit_cart.py\
|
||||||
|
edit_cut.py\
|
||||||
export.py\
|
export.py\
|
||||||
export_peaks.py\
|
export_peaks.py\
|
||||||
get_podcast.py\
|
get_podcast.py\
|
||||||
|
@ -77,48 +77,6 @@ except rivwebpyapi.RivWebPyError as err:
|
|||||||
# Display the cut
|
# Display the cut
|
||||||
#
|
#
|
||||||
print('ADDED:')
|
print('ADDED:')
|
||||||
print('cutName: '+str(cut['cutName']))
|
for key in cut.values():
|
||||||
print('cartNumber: '+str(cut['cartNumber']))
|
print(key+': '+str(cut.values()[key]))
|
||||||
print('cutNumber: '+str(cut['cutNumber']))
|
print('')
|
||||||
print('evergreen: '+str(cut['evergreen']))
|
|
||||||
print('description: '+str(cut['description']))
|
|
||||||
print('outcue: '+str(cut['outcue']))
|
|
||||||
print('isrc: '+str(cut['isrc']))
|
|
||||||
print('isci: '+str(cut['isci']))
|
|
||||||
print('recordingMbId: '+str(cut['recordingMbId']))
|
|
||||||
print('releaseMbId: '+str(cut['releaseMbId']))
|
|
||||||
print('length: '+str(cut['length']))
|
|
||||||
print('originDatetime: '+str(cut['originDatetime']))
|
|
||||||
print('startDatetime: '+str(cut['startDatetime']))
|
|
||||||
print('endDatetime: '+str(cut['endDatetime']))
|
|
||||||
print('sun: '+str(cut['sun']))
|
|
||||||
print('mon: '+str(cut['mon']))
|
|
||||||
print('tue: '+str(cut['tue']))
|
|
||||||
print('wed: '+str(cut['wed']))
|
|
||||||
print('thu: '+str(cut['thu']))
|
|
||||||
print('fri: '+str(cut['fri']))
|
|
||||||
print('sat: '+str(cut['sat']))
|
|
||||||
print('startDaypart: '+str(cut['startDaypart']))
|
|
||||||
print('endDaypart: '+str(cut['endDaypart']))
|
|
||||||
print('originName: '+str(cut['originName']))
|
|
||||||
print('originLoginName: '+str(cut['originLoginName']))
|
|
||||||
print('sourceHostname: '+str(cut['sourceHostname']))
|
|
||||||
print('weight: '+str(cut['weight']))
|
|
||||||
print('lastPlayDatetime: '+str(cut['lastPlayDatetime']))
|
|
||||||
print('playCounter: '+str(cut['playCounter']))
|
|
||||||
print('codingFormat: '+str(cut['codingFormat']))
|
|
||||||
print('sampleRate: '+str(cut['sampleRate']))
|
|
||||||
print('bitRate: '+str(cut['bitRate']))
|
|
||||||
print('channels: '+str(cut['channels']))
|
|
||||||
print('playGain: '+str(cut['playGain']))
|
|
||||||
print('startPoint: '+str(cut['startPoint']))
|
|
||||||
print('endPoint: '+str(cut['endPoint']))
|
|
||||||
print('fadeupPoint: '+str(cut['fadeupPoint']))
|
|
||||||
print('fadedownPoint: '+str(cut['fadedownPoint']))
|
|
||||||
print('segueStartPoint: '+str(cut['segueStartPoint']))
|
|
||||||
print('segueEndPoint: '+str(cut['segueEndPoint']))
|
|
||||||
print('segueGain: '+str(cut['segueGain']))
|
|
||||||
print('hookStartPoint: '+str(cut['hookStartPoint']))
|
|
||||||
print('hookEndPoint: '+str(cut['hookEndPoint']))
|
|
||||||
print('talkStartPoint: '+str(cut['talkStartPoint']))
|
|
||||||
print('talkEndPoint: '+str(cut['talkEndPoint']))
|
|
||||||
|
@ -37,7 +37,7 @@ values={}
|
|||||||
#
|
#
|
||||||
# Get login parameters
|
# Get login parameters
|
||||||
#
|
#
|
||||||
usage='list_cart --url=<rd-url> --username=<rd-username> --cart-number=<num> [--set-value=<field>=<str> ...] [--password=<passwd>]'
|
usage='edit_cart --url=<rd-url> --username=<rd-username> --cart-number=<num> [--set-value=<field>=<str> ...] [--password=<passwd>]'
|
||||||
for arg in sys.argv:
|
for arg in sys.argv:
|
||||||
f0=arg.split('=')
|
f0=arg.split('=')
|
||||||
key=f0[0]
|
key=f0[0]
|
||||||
|
100
apis/rivwebpyapi/tests/edit_cut.py
Executable file
100
apis/rivwebpyapi/tests/edit_cut.py
Executable file
@ -0,0 +1,100 @@
|
|||||||
|
#!%PYTHON_BANGPATH%
|
||||||
|
|
||||||
|
# edit_cut.py
|
||||||
|
#
|
||||||
|
# RivWebPyApi test script for Rivendell
|
||||||
|
#
|
||||||
|
# Test the EditCut Web API call
|
||||||
|
#
|
||||||
|
# (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
|
# published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public
|
||||||
|
# License along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
#
|
||||||
|
|
||||||
|
import getpass
|
||||||
|
import rivwebpyapi
|
||||||
|
import sys
|
||||||
|
def eprint(*args,**kwargs):
|
||||||
|
print(*args,file=sys.stderr,**kwargs)
|
||||||
|
|
||||||
|
url='';
|
||||||
|
username=''
|
||||||
|
password=''
|
||||||
|
cart_number=0
|
||||||
|
cut_number=0
|
||||||
|
values={}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Get login parameters
|
||||||
|
#
|
||||||
|
usage='edit_cut --url=<rd-url> --username=<rd-username> --cart-number=<num> --cut-number=<num> [--set-value=<field>=<str> ...] [--password=<passwd>]'
|
||||||
|
for arg in sys.argv:
|
||||||
|
f0=arg.split('=')
|
||||||
|
key=f0[0]
|
||||||
|
del f0[0]
|
||||||
|
value='='.join(f0)
|
||||||
|
if(value):
|
||||||
|
if(key=='--url'):
|
||||||
|
url=value
|
||||||
|
if(key=='--username'):
|
||||||
|
username=value
|
||||||
|
if(key=='--password'):
|
||||||
|
password=value
|
||||||
|
if(key=='--cart-number'):
|
||||||
|
cart_number=int(value)
|
||||||
|
if(key=='--cut-number'):
|
||||||
|
cut_number=int(value)
|
||||||
|
if(key=='--set-value'):
|
||||||
|
f1=value.split('=')
|
||||||
|
key1=f1[0]
|
||||||
|
del f1[0]
|
||||||
|
values[key1]='='.join(f1)
|
||||||
|
|
||||||
|
if(not password):
|
||||||
|
password=getpass.getpass()
|
||||||
|
if((not url)or(not username)):
|
||||||
|
print(usage)
|
||||||
|
sys.exit(1)
|
||||||
|
if(cart_number==0):
|
||||||
|
eprint('you must supply "--cart-number"')
|
||||||
|
sys.exit(1)
|
||||||
|
if(cut_number==0):
|
||||||
|
eprint('you must supply "--cut-number"')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Execute
|
||||||
|
#
|
||||||
|
webapi=rivwebpyapi.rivwebpyapi(url=url,username=username,password=password)
|
||||||
|
cut=rivwebpyapi.Cut()
|
||||||
|
cut.setValues(values)
|
||||||
|
|
||||||
|
try:
|
||||||
|
cut=webapi.EditCut(cart_number=cart_number,cut_number=cut_number,
|
||||||
|
values=cut.values())
|
||||||
|
except rivwebpyapi.RivWebPyError as err:
|
||||||
|
eprint('*** ERROR ***')
|
||||||
|
eprint('Response Code: '+str(err.responseCode))
|
||||||
|
eprint('ErrorString: '+str(err.errorString))
|
||||||
|
eprint('*************')
|
||||||
|
eprint('')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Display the modified cut
|
||||||
|
#
|
||||||
|
print('MODIFIED')
|
||||||
|
for key in cut.values():
|
||||||
|
print(key+': '+str(cut.values()[key]))
|
||||||
|
print('')
|
@ -82,48 +82,7 @@ except rivwebpyapi.RivWebPyError as err:
|
|||||||
#
|
#
|
||||||
# Display the cut
|
# Display the cut
|
||||||
#
|
#
|
||||||
print('cutName: '+str(cut['cutName']))
|
print('ADDED:')
|
||||||
print('cartNumber: '+str(cut['cartNumber']))
|
for key in cut.values():
|
||||||
print('cutNumber: '+str(cut['cutNumber']))
|
print(key+': '+str(cut.values()[key]))
|
||||||
print('evergreen: '+str(cut['evergreen']))
|
print('')
|
||||||
print('description: '+str(cut['description']))
|
|
||||||
print('outcue: '+str(cut['outcue']))
|
|
||||||
print('isrc: '+str(cut['isrc']))
|
|
||||||
print('isci: '+str(cut['isci']))
|
|
||||||
print('recordingMbId: '+str(cut['recordingMbId']))
|
|
||||||
print('releaseMbId: '+str(cut['releaseMbId']))
|
|
||||||
print('length: '+str(cut['length']))
|
|
||||||
print('originDatetime: '+str(cut['originDatetime']))
|
|
||||||
print('startDatetime: '+str(cut['startDatetime']))
|
|
||||||
print('endDatetime: '+str(cut['endDatetime']))
|
|
||||||
print('sun: '+str(cut['sun']))
|
|
||||||
print('mon: '+str(cut['mon']))
|
|
||||||
print('tue: '+str(cut['tue']))
|
|
||||||
print('wed: '+str(cut['wed']))
|
|
||||||
print('thu: '+str(cut['thu']))
|
|
||||||
print('fri: '+str(cut['fri']))
|
|
||||||
print('sat: '+str(cut['sat']))
|
|
||||||
print('startDaypart: '+str(cut['startDaypart']))
|
|
||||||
print('endDaypart: '+str(cut['endDaypart']))
|
|
||||||
print('originName: '+str(cut['originName']))
|
|
||||||
print('originLoginName: '+str(cut['originLoginName']))
|
|
||||||
print('sourceHostname: '+str(cut['sourceHostname']))
|
|
||||||
print('weight: '+str(cut['weight']))
|
|
||||||
print('lastPlayDatetime: '+str(cut['lastPlayDatetime']))
|
|
||||||
print('playCounter: '+str(cut['playCounter']))
|
|
||||||
print('codingFormat: '+str(cut['codingFormat']))
|
|
||||||
print('sampleRate: '+str(cut['sampleRate']))
|
|
||||||
print('bitRate: '+str(cut['bitRate']))
|
|
||||||
print('channels: '+str(cut['channels']))
|
|
||||||
print('playGain: '+str(cut['playGain']))
|
|
||||||
print('startPoint: '+str(cut['startPoint']))
|
|
||||||
print('endPoint: '+str(cut['endPoint']))
|
|
||||||
print('fadeupPoint: '+str(cut['fadeupPoint']))
|
|
||||||
print('fadedownPoint: '+str(cut['fadedownPoint']))
|
|
||||||
print('segueStartPoint: '+str(cut['segueStartPoint']))
|
|
||||||
print('segueEndPoint: '+str(cut['segueEndPoint']))
|
|
||||||
print('segueGain: '+str(cut['segueGain']))
|
|
||||||
print('hookStartPoint: '+str(cut['hookStartPoint']))
|
|
||||||
print('hookEndPoint: '+str(cut['hookEndPoint']))
|
|
||||||
print('talkStartPoint: '+str(cut['talkStartPoint']))
|
|
||||||
print('talkEndPoint: '+str(cut['talkEndPoint']))
|
|
||||||
|
@ -77,49 +77,6 @@ except rivwebpyapi.RivWebPyError as err:
|
|||||||
# Display the cut list
|
# Display the cut list
|
||||||
#
|
#
|
||||||
for cut in cuts:
|
for cut in cuts:
|
||||||
print('cutName: '+str(cut['cutName']))
|
for key in cut.values():
|
||||||
print('cartNumber: '+str(cut['cartNumber']))
|
print(key+': '+str(cut.values()[key]))
|
||||||
print('cutNumber: '+str(cut['cutNumber']))
|
|
||||||
print('evergreen: '+str(cut['evergreen']))
|
|
||||||
print('description: '+str(cut['description']))
|
|
||||||
print('outcue: '+str(cut['outcue']))
|
|
||||||
print('isrc: '+str(cut['isrc']))
|
|
||||||
print('isci: '+str(cut['isci']))
|
|
||||||
print('recordingMbId: '+str(cut['recordingMbId']))
|
|
||||||
print('releaseMbId: '+str(cut['releaseMbId']))
|
|
||||||
print('length: '+str(cut['length']))
|
|
||||||
print('originDatetime: '+str(cut['originDatetime']))
|
|
||||||
print('startDatetime: '+str(cut['startDatetime']))
|
|
||||||
print('endDatetime: '+str(cut['endDatetime']))
|
|
||||||
print('sun: '+str(cut['sun']))
|
|
||||||
print('mon: '+str(cut['mon']))
|
|
||||||
print('tue: '+str(cut['tue']))
|
|
||||||
print('wed: '+str(cut['wed']))
|
|
||||||
print('thu: '+str(cut['thu']))
|
|
||||||
print('fri: '+str(cut['fri']))
|
|
||||||
print('sat: '+str(cut['sat']))
|
|
||||||
print('startDaypart: '+str(cut['startDaypart']))
|
|
||||||
print('endDaypart: '+str(cut['endDaypart']))
|
|
||||||
print('originName: '+str(cut['originName']))
|
|
||||||
print('originLoginName: '+str(cut['originLoginName']))
|
|
||||||
print('sourceHostname: '+str(cut['sourceHostname']))
|
|
||||||
print('weight: '+str(cut['weight']))
|
|
||||||
print('lastPlayDatetime: '+str(cut['lastPlayDatetime']))
|
|
||||||
print('playCounter: '+str(cut['playCounter']))
|
|
||||||
print('codingFormat: '+str(cut['codingFormat']))
|
|
||||||
print('sampleRate: '+str(cut['sampleRate']))
|
|
||||||
print('bitRate: '+str(cut['bitRate']))
|
|
||||||
print('channels: '+str(cut['channels']))
|
|
||||||
print('playGain: '+str(cut['playGain']))
|
|
||||||
print('startPoint: '+str(cut['startPoint']))
|
|
||||||
print('endPoint: '+str(cut['endPoint']))
|
|
||||||
print('fadeupPoint: '+str(cut['fadeupPoint']))
|
|
||||||
print('fadedownPoint: '+str(cut['fadedownPoint']))
|
|
||||||
print('segueStartPoint: '+str(cut['segueStartPoint']))
|
|
||||||
print('segueEndPoint: '+str(cut['segueEndPoint']))
|
|
||||||
print('segueGain: '+str(cut['segueGain']))
|
|
||||||
print('hookStartPoint: '+str(cut['hookStartPoint']))
|
|
||||||
print('hookEndPoint: '+str(cut['hookEndPoint']))
|
|
||||||
print('talkStartPoint: '+str(cut['talkStartPoint']))
|
|
||||||
print('talkEndPoint: '+str(cut['talkEndPoint']))
|
|
||||||
print('')
|
print('')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user