def test_build_xml_schedule(self): schedule = Schedule(version=2, originator='Global Radio') epg = Epg(schedule=schedule) programme = Programme(213456, crid='crid://bbc.co.uk/4969758988') programme.names.append(MediumName('Gilles Peterson')) programme.names.append(LongName('Gilles Peterson: Worldwide')) location = Location() location.times.append( Time(datetime.datetime(2003, 12, 18, 0, 0, 0, 0), datetime.timedelta(hours=2), actual_time=datetime.datetime(2003, 12, 18, 0, 0, 0, 0), actual_duration=datetime.timedelta(hours=2))) location.bearers.append(Bearer('e1.ce15.c221.0')) programme.locations.append(location) programme.media.append( ShortDescription( 'Gilles Peterson brings you two hours of global beats and the best of cool. Including the Worldwide family. KV5 are live from Maida Value with special guests.' )) programme.genres.append( Genre('urn:tva:metadata:cs:ContentCS:2002:3.6.7', name='Rap/Hip Hop/Reggae')) programme.memberships.append( Membership(1000, crid='crid://www.bbc.co.uk/WorldwideGroup')) programme.links.append( Link('mailto:[email protected]', description='Email:')) event1 = ProgrammeEvent(6353, crid='crid://www.bbc.co.uk;dab/BC81123456a', recommendation=True) event1.names.append(ShortName('Herbert')) event1.names.append(MediumName('Herbert Live')) event1.names.append(LongName('Live session from Herbert')) event_location = Location(times=[RelativeTime(45 * 60, 15 * 60)]) event1.locations.append(event_location) event1.media.append( ShortDescription( 'Live session from Herbert, recorded at Cargo on 24/2/01')) programme.events.append(event1) event2 = ProgrammeEvent(59033) event2.names.append(MediumName('PM')) event2.locations.append( Location(times=[ Time(datetime.datetime(2003, 12, 18, 17, 0, 0, 0), datetime.timedelta(hours=1)) ], bearers=[Bearer('e1.ce15.c224.0')])) programme.events.append(event2) schedule.programmes.append(programme) print marshall(epg, indent=' ')
def test_build_xml_schedule(self): schedule = Schedule(version=2, originator='Global Radio') epg = Epg(schedule=schedule) programme = Programme(213456, crid='crid://bbc.co.uk/4969758988') programme.names.append(MediumName('Gilles Peterson')) programme.names.append(LongName('Gilles Peterson: Worldwide')) location = Location() location.times.append(Time(datetime.datetime(2003, 12, 18, 0, 0, 0, 0), datetime.timedelta(hours=2), actual_time=datetime.datetime(2003, 12, 18, 0, 0, 0, 0), actual_duration=datetime.timedelta(hours=2))) location.bearers.append(Bearer('e1.ce15.c221.0')) programme.locations.append(location) programme.media.append(ShortDescription('Gilles Peterson brings you two hours of global beats and the best of cool. Including the Worldwide family. KV5 are live from Maida Value with special guests.')) programme.genres.append(Genre('urn:tva:metadata:cs:ContentCS:2002:3.6.7', name='Rap/Hip Hop/Reggae')) programme.memberships.append(Membership(1000, crid='crid://www.bbc.co.uk/WorldwideGroup')) programme.links.append(Link('mailto:[email protected]', description='Email:')) event1 = ProgrammeEvent(6353, crid='crid://www.bbc.co.uk;dab/BC81123456a', recommendation=True) event1.names.append(ShortName('Herbert')) event1.names.append(MediumName('Herbert Live')) event1.names.append(LongName('Live session from Herbert')) event_location = Location(times=[RelativeTime(45 * 60, 15 * 60)]) event1.locations.append(event_location) event1.media.append(ShortDescription('Live session from Herbert, recorded at Cargo on 24/2/01')) programme.events.append(event1) event2 = ProgrammeEvent(59033) event2.names.append(MediumName('PM')) event2.locations.append(Location(times=[Time(datetime.datetime(2003, 12, 18, 17, 0, 0, 0), datetime.timedelta(hours=1))], bearers=[Bearer('e1.ce15.c224.0')])) programme.events.append(event2) schedule.programmes.append(programme) print marshall(epg, indent=' ')
def test_parse_serviceinfo(self): pi = unmarshall(open('test/PI.xml')) print pi print marshall(pi, indent=' ')
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #=============================================================================== from dabepg import * from dabepg.bands import BAND_5A info = ServiceInfo() ensemble = Ensemble(ContentId('e1', 'cfff')) info.ensembles.append(ensemble) ensemble.frequencies.append(BAND_5A) ensemble.names.append(ShortName('Demo')) ensemble.names.append(MediumName('Demo Mux')) # Service service = Service(ContentId('e1', 'cfff', 'c0fe', '0')) service.names.append(ShortName('Service')) service.names.append(MediumName('Service')) service.media.append(Multimedia('32x32.png', Multimedia.LOGO_COLOUR_SQUARE)) service.media.append(Multimedia('112x32.png', Multimedia.LOGO_COLOUR_RECTANGLE)) service.media.append(Multimedia('128x128.png', Multimedia.LOGO_UNRESTRICTED, width=128, height=128)) service.media.append(Multimedia('http://www.capitalfm.com/logos/320x240.png', Multimedia.LOGO_UNRESTRICTED, width=320, height=240)) ensemble.services.append(service) from dabepg.xml import marshall print marshall(info, indent='\t')
def test_parse_serviceinfo(self): si = unmarshall(open('test/SI.xml')) print si print marshall(si, indent=' ')
from dabepg.bands import BAND_5A info = ServiceInfo() ensemble = Ensemble(ContentId('e1', 'cfff')) info.ensembles.append(ensemble) ensemble.frequencies.append(BAND_5A) ensemble.names.append(ShortName('Demo')) ensemble.names.append(MediumName('Demo Mux')) # Service service = Service(ContentId('e1', 'cfff', 'c0fe', '0')) service.names.append(ShortName('Service')) service.names.append(MediumName('Service')) service.media.append(Multimedia('32x32.png', Multimedia.LOGO_COLOUR_SQUARE)) service.media.append(Multimedia('112x32.png', Multimedia.LOGO_COLOUR_RECTANGLE)) service.media.append( Multimedia('128x128.png', Multimedia.LOGO_UNRESTRICTED, width=128, height=128)) service.media.append( Multimedia('http://www.capitalfm.com/logos/320x240.png', Multimedia.LOGO_UNRESTRICTED, width=320, height=240)) ensemble.services.append(service) from dabepg.xml import marshall print marshall(info, indent=' ')
def test_build_xml_serviceinfo(self): info = ServiceInfo(version=2, originator='BBC', provider='BBC', created=datetime.datetime(2001, 02, 28, 0, 0, 0, 0)) ensemble = Ensemble(ContentId('e1', 'ce15')) info.ensembles.append(ensemble) ensemble.frequencies.append(225648) ensemble.names.append(ShortName('BBC')) ensemble.names.append(MediumName('BBC National')) ensemble.media.append(ShortDescription('Digital Radio from the BBC')) ensemble.media.append( Multimedia('http://www.bbc.co.uk/radio1/images/bbclogo.png', Multimedia.LOGO_COLOUR_RECTANGLE)) ensemble.media.append( Multimedia('http://www.bbc.co.uk/radio/bbclogo_large.png', Multimedia.LOGO_UNRESTRICTED, 'image/png', 200, 200)) ensemble.keywords.append('Radio1') ensemble.keywords.append('Radio2') ensemble.keywords.append('Radio3') ensemble.keywords.append('Radio4') ensemble.keywords.append('Radio5 Live') ensemble.links.append( Link('http://www.bbc.co.uk/radio/', 'text/html', 'BBC Radio homepage')) # Radio 1 radio1 = Service(ContentId('e1', 'ca15', 'c221', '0'), bitrate=160) radio1.names.append(ShortName('Radio 1')) radio1.names.append(MediumName('BBC Radio 1')) radio1.media.append( ShortDescription('Rock and pop music from the BBC.')) radio1.media.append( Multimedia('http://www.bbc.co.uk/radio1/images/r1logo.png', Multimedia.LOGO_COLOUR_SQUARE)) radio1.genres.append( Genre('urn:tva:metadata:cs:ContentCS:2002:3.6.7', 'Rap/Hip Hop/Reggae')) radio1.genres.append( Genre('urn:tva:metadata:cs:ContentCS:2002:3.6.8', 'Electronic/Club/Urban/Dance')) radio1.genres.append( Genre('urn:tva:metadata:cs:ContentCS:2002:2.5.0', 'ARTISTIC PERFORMANCE')) radio1.genres.append( Genre('urn:tva:metadata:cs:ContentCS:2002:1.1.0', 'ENTERTAINMENT')) radio1.keywords.append('music') radio1.keywords.append('pop') radio1.keywords.append('rock') radio1.keywords.append('dance') radio1.keywords.append('hip-hop') radio1.keywords.append('soul') radio1.links.append(Link('http://www.bbc.co.uk/radio1', 'text/html')) ensemble.services.append(radio1) # Radio 2 radio2 = Service(ContentId('e1', 'ca15', 'c222', '0')) radio2.names.append(ShortName('Radio 2')) radio2.names.append(MediumName('BBC Radio 2')) ensemble.services.append(radio2) # Radio 3 radio3 = Service(ContentId('e1', 'ca15', 'c223', '0')) radio3.names.append(ShortName('Radio 3')) radio3.names.append(MediumName('BBC Radio 3')) ensemble.services.append(radio3) # Radio 4 radio4 = Service(ContentId('e1', 'ca15', 'c224', '0')) radio4.names.append(ShortName('Radio 4')) radio4.names.append(MediumName('BBC Radio 4')) ensemble.services.append(radio4) # Radio 5 radio5 = Service(ContentId('e1', 'ca15', 'c225', '0')) radio5.names.append(ShortName('Radio 5')) radio5.names.append(MediumName('BBC Radio 5')) ensemble.services.append(radio5) print marshall(info, indent=' ')