Skip to content

Commit

Permalink
Merge pull request #412 from teltek/dev_365
Browse files Browse the repository at this point in the history
Refactor duration in scheduled recordings #365
  • Loading branch information
dpeite authored Aug 29, 2016
2 parents 2970ab6 + a18c52e commit 8a2af19
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion galicaster/classui/listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def insert_data_in_list(self, lista, mps):
"""Appends the mediapackage data into the list"""
lista.clear()
for mp in mps:
duration = mp.getDuration()
duration = round(mp.getDuration(), -3)
if duration in ["", None]:
duration = 0

Expand Down
2 changes: 1 addition & 1 deletion galicaster/mediapackage/deserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def fromXML(xml, logger=None):
mp = mediapackage.Mediapackage(uri = mp_uri)
manifest = minidom.parse(xml)
principal = manifest.getElementsByTagName("mediapackage")
mp.setDuration(round(int(principal[0].getAttribute("duration")), -3) or 0) # FIXME check if empty and take out patch in listing.populatetreeview
mp.setDuration(principal[0].getAttribute("duration") or 0) # FIXME check if empty and take out patch in listing.populatetreeview
mp.setIdentifier(principal[0].getAttribute("id"))

if principal[0].hasAttribute("start"):
Expand Down
24 changes: 12 additions & 12 deletions tests/core/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,20 +327,20 @@ def test_track_property(self):


def test_get_hostname(self):
# conf = Conf()
self.conf.set('config', 'ingest', None)
self.conf.set('basic', 'admin', 'True')
self.conf.set('ingest', 'hostname', None)
self.assertEqual('GCMobile-' + socket.gethostname(), self.conf.get_hostname())
conf = Conf(self.conf_file)
conf.set('config', 'ingest', None)
conf.set('basic', 'admin', 'True')
conf.set('ingest', 'hostname', None)
self.assertEqual('GCMobile-' + socket.gethostname(), conf.get_hostname())
self.assertEqual(1, len(conf.get_tracks_in_oc_dict()))
self.assertEqual({'capture.device.names': 'defaults'}, self.conf.get_tracks_in_oc_dict())
self.conf.set('basic', 'admin', 'False')
self.conf.set('ingest', 'hostname', None)
self.assertEqual('GC-' + socket.gethostname(), self.conf.get_hostname())
self.assertEqual({'capture.device.names': 'defaults'}, conf.get_tracks_in_oc_dict())
conf.set('basic', 'admin', 'False')
conf.set('ingest', 'hostname', None)
self.assertEqual('GC-' + socket.gethostname(), conf.get_hostname())
name = "123456_654321"
self.conf.set('ingest', 'hostname', name)
self.assertEqual(name, self.conf.get_hostname())
a = self.conf.remove_option('ingest', 'hostname')
conf.set('ingest', 'hostname', name)
self.assertEqual(name, conf.get_hostname())
a = conf.remove_option('ingest', 'hostname')


def test_get_ip_address(self):
Expand Down

0 comments on commit 8a2af19

Please sign in to comment.