def main(): opt, args = poms.opts(usage=usage, minargs=2) group_mid = args[0] group_members = poms.members(group_mid) dest_group_mids = args[1:] if len(group_members) == 0: print("The group " + group_mid + " has no members") # some math to distribute the objects as evenly as possible over the groups group_size = len(group_members) / len(dest_group_mids) remainder = len(group_members) % len(dest_group_mids) g = 0 this_group_size = 0 for m in group_members: move_to_group(m, group_mid, dest_group_mids[g], this_group_size + 1) this_group_size += 1 maxsize = group_size + (1 if g < remainder else 0) if this_group_size >= maxsize: g += 1 this_group_size = 0
def main(): NOW=datetime.datetime.utcnow() opt, args = poms.opts(usage = usage, minargs = 2) mid, program_url = args poms.set_location(mid, program_url, publishStop = NOW)
<programUrl>rtsp:someurl</programUrl> <avAttributes> <bitrate>1000000</bitrate> <avFileFormat>M4V</avFileFormat> <videoAttributes width="320" height="180"> <aspectRatio>16:9</aspectRatio> </videoAttributes> </avAttributes> <duration>P0DT0H1M40.000S</duration> </location> </locations> """ print(poms.xslt(locations, xsl, params = {"programUrl": "rtsp:someurl", "publishStop": '2012'})) def test_get_locations(self): print(poms.set_location("WO_VPRO_041686", "http://www.vpro.nl/123.mp4", publishStop="2012-10-10T20:20:00")) if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG) poms.opts(env = 'dev') poms.errors('*****@*****.**') del sys.argv[1:] suite = unittest.TestSuite() suite.addTest(POMSRSTest("test_get_locations")) runner = unittest.TextTestRunner() runner.run(suite) #unittest.main()