def testEventMinimal(self): day = datetime.datetime(2012, 12, 31) parserOptions = ParserOptions() channel = Channel(123, 'testchan', 'http://media.teleman.pl/logos/m/tvp-1.png') event = TelemanEvent(parserOptions, channel, 'simple event', 'Movie/Drama', 'movie', None, day, day + datetime.timedelta(days=1), None) f = StringIO.StringIO() output = XmltvOutput.XmltvOutput() output.Init(f) guide = [event] output.SaveGuide(day, guide) output.SaveGuideChannels() output.Finish() expected = """ <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE tv SYSTEM "xmltv.dtd"> <tv generator-info-name="epguide generator"> <programme start="20121231000000 +0200" stop="20130101000000 +0200" channel="123"> <title>simple event</title> <category language="en">Movie/Drama</category> <category language="pl">movie</category> </programme> <channel id="123"><display-name lang="pl">testchan</display-name><icon src="http://media.teleman.pl/logos/m/tvp-1.png"/></channel> </tv> """.lstrip() self.assertEqual(f.getvalue(), expected)
def testEvent(self): channel = Channel(123, 'testchan', 'http://media.teleman.pl/logos/m/tvp-1.png') parserOptions = ParserOptions() event = TelemanEvent(parserOptions, channel, 'simple event', 'Movie/Drama', 'movie', 'this is description for an event', datetime.date.today(), datetime.date.today() + datetime.timedelta(days=1), None) f = StringIO.StringIO() output = TxtOutput.TxtOutput() output.Init(f) guide = [event] day = datetime.datetime(2012, 12, 31) output.SaveGuide(day, guide) output.Finish() expected = u""" Program testchan na dzień: 2012-12-31 -------------------------------------------- 00:00 00:00 simple event | | | Movie/Drama this is description for an event """ actual = f.getvalue() print("actual: " + actual) print("expected: " + expected) self.assertEqual(actual, expected)
def testChannel(self): p = GazetaProgrammeParser.GazetaProgrammeParser(ParserOptions()) f = codecs.open("TVP-1.html", "r", "ISO-8859-2") buf = f.read() eventDate = datetime.datetime(2013, 1, 1) channel_id = "TVP-1" events = [ to_string(c) for c in p.get_events(eventDate, channel_id, buf) ] f.close() print 'actual events:\n[\n"' + '",\n"'.join(events) + '"\n]' expected = [ "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 05:20:00', time_end:'2013-01-01 05:55:00', title:'Po prostu. Program Tomasza Sekielskiego', subtitle:None, episode_num:None, category:'Program publicystyczny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717481,Po_prostu_Program_Tomasza_Sekielskiego.html', desc:'Autorski program publicystyczno-reporterski, w którym poruszane\\n są najważniejsze tematy społeczno-polityczne. W każdym odcinku widzowie\\n zobaczą też wywiady z nietuzinkowymi osobami.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 05:55:00', time_end:'2013-01-01 08:00:00', title:'Info poranek', subtitle:None, episode_num:None, category:'Magazyn informacyjny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717482,Info_poranek.html', desc:None, details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 08:00:00', time_end:'2013-01-01 08:05:00', title:'Wiadomości', subtitle:None, episode_num:None, category:'Wiadomości', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717483,Wiadomosci.html', desc:'Serwis prezentuje najważniejsze informacje z kraju i ze świata.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 08:05:00', time_end:'2013-01-01 08:10:00', title:'Pogoda poranna', subtitle:None, episode_num:None, category:'Pogoda', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717484,Pogoda_poranna.html', desc:None, details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 08:10:00', time_end:'2013-01-01 08:25:00', title:'Polityka przy kawie', subtitle:None, episode_num:None, category:'Program publicystyczny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717485,Polityka_przy_kawie.html', desc:'W programie rozmowy z politykami na temat ostatnich ważnych wydarzeń w kraju.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 08:25:00', time_end:'2013-01-01 08:55:00', title:'Telezakupy', subtitle:None, episode_num:None, category:'Program reklamowy', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717486,Telezakupy.html', desc:'Magazyn reklamowy prezentujący artykuły gospodarstwa domowego, \\nurządzenia do poprawy kondycji i zdrowia. Po zapoznaniu się z ofertą \\nwidzowie mogą telefonicznie zamówić wybrane towary.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 08:55:00', time_end:'2013-01-01 09:55:00', title:'Ojciec Mateusz', subtitle:None, episode_num:None, category:'Serial kryminalny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717487,Ojciec_Mateusz.html', desc:'Grupa grafficiarzy pojawiła się w Sandomierzu. Jeden z nich \\nzostaje oskarżony o zabójstwo mieszkańca, z którym grupa miała zatarg. \\nKs. Mateusz nie wierzy w winę chłopaka i rozpoczyna śledztwo.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 09:55:00', time_end:'2013-01-01 11:00:00', title:'Moksgmol - biały baribal', subtitle:None, episode_num:None, category:'Film dokumentalny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717488,Moksgmol__bialy_baribal.html', desc:'Great Bear Rainforest w Kolumbii Brytyjskiej to jeden z \\nnajwiększych na świecie lasów deszczowych strefy umiarkowanej. Żyją tu \\nniedźwiedzie, wilki i wiele innych niezwykłych gatunków zwierząt.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 11:00:00', time_end:'2013-01-01 12:00:00', title:'Świat się kręci', subtitle:None, episode_num:None, category:'Magazyn', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717489,Swiat_sie_kreci.html', desc:'Codzienny program studyjny poruszający tematy społeczno-polityczne, naukowe, kulturalne, a także rozrywkowe.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 12:00:00', time_end:'2013-01-01 12:15:00', title:'Wiadomości', subtitle:None, episode_num:None, category:'Wiadomości', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717490,Wiadomosci.html', desc:'Serwis prezentuje najważniejsze informacje z kraju i ze świata.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 12:15:00', time_end:'2013-01-01 12:45:00', title:'Agrobiznes', subtitle:None, episode_num:None, category:'Magazyn rolniczy', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717491,Agrobiznes.html', desc:'Dziennik informacyjny przeznaczony głównie dla biznesmenów \\npracujących w otoczeniu rolnictwa, rolników, handlowców, ale także dla \\nmieszkańców miast.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 12:45:00', time_end:'2013-01-01 13:50:00', title:'Dzikie oblicze Andów', subtitle:None, episode_num:None, category:'Film dokumentalny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717492,Dzikie_oblicze_Andow.html', desc:'Dokument opowiada o poszukiwaniu cudów natury i historii \\nzwierząt zamieszkujących Andy, największy łańcuch górski na świecie, \\nrozciągający się na przestrzeni 9000 kilometrów.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 13:50:00', time_end:'2013-01-01 14:20:00', title:'Jaka to melodia?', subtitle:None, episode_num:None, category:'Teleturniej muzyczny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717493,Jaka_to_melodia.html', desc:'W teleturnieju bierze udział 3 uczestników, z których jeden \\njest finalistą poprzedniego odcinka. Finalista może pojawić się najwyżej\\n 3 razy pod rząd w kolejnych programach.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 14:20:00', time_end:'2013-01-01 15:00:00', title:'Moda na sukces', subtitle:None, episode_num:None, category:'Telenowela', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717494,Moda_na_sukces.html', desc:'Thorne obwieszcza Stephanie, Erykowi i Ridge'owi, że nie jest \\nojcem Liama i bardzo tego żałuje. Oliver chce odejść z firmy. Bill \\nzapewnia Liama, że nie porzucił jego matki. To ona odeszła.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 15:00:00', time_end:'2013-01-01 15:10:00', title:'Wiadomości', subtitle:None, episode_num:None, category:'Wiadomości', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717495,Wiadomosci.html', desc:'Serwis prezentuje najważniejsze informacje z kraju i ze świata.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 15:10:00', time_end:'2013-01-01 15:15:00', title:'Pogoda', subtitle:None, episode_num:None, category:'Pogoda', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717496,Pogoda.html', desc:'Codzienny serwis informacyjny z prognozą pogody.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 15:15:00', time_end:'2013-01-01 15:45:00', title:'Klan', subtitle:None, episode_num:None, category:'Telenowela', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717497,Klan.html', desc:'Kasia wdraża sekretny plan w życie i uzyskuje zgodę matki na \\nnocleg u Basi. Paweł składa Alicji kondolencje z powodu śmierci męża. \\nOkazuje się, że mężczyzna, który zginął w wypadku, to nie Marczyński.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 15:45:00', time_end:'2013-01-01 16:40:00', title:'Drużyna A', subtitle:None, episode_num:None, category:'Serial sensacyjny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717498,Druzyna_A.html', desc:'Dwie koleżanki z college'u angażują Drużynę A, by odbiła ich \\nprofesora z rąk mafii hazardowej. Udając oddział specjalny, B.A. i \\nMurdock ruszają do Las Vegas, by przejąć bossa mafii.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 16:40:00', time_end:'2013-01-01 17:00:00', title:'Polska non stop', subtitle:None, episode_num:None, category:'Magazyn reporterów', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717499,Polska_non_stop.html', desc:'Prezentacja informacji dotyczących aktualnych wydarzeń, przede \\nwszystkim krajowych. Reportaże o najważniejszych i najbardziej \\ninteresujących sprawach bieżących oraz reportaże interwencyjne.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 17:00:00', time_end:'2013-01-01 17:15:00', title:'Teleexpress', subtitle:None, episode_num:None, category:'Wiadomości', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717500,Teleexpress.html', desc:'Serwis informacyjny prezentujący aktualne wydarzenia, wiadomości kulturalne oraz ciekawostki z kraju i ze świata.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 17:15:00', time_end:'2013-01-01 17:20:00', title:'Pogoda', subtitle:None, episode_num:None, category:'Pogoda', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717501,Pogoda.html', desc:'Codzienny serwis informacyjny z prognozą pogody.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 17:20:00', time_end:'2013-01-01 17:55:00', title:'Jaka to melodia?', subtitle:None, episode_num:None, category:'Teleturniej muzyczny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717502,Jaka_to_melodia.html', desc:'W teleturnieju bierze udział 3 uczestników, z których jeden \\njest finalistą poprzedniego odcinka. Finalista może pojawić się najwyżej\\n 3 razy pod rząd w kolejnych programach.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 17:55:00', time_end:'2013-01-01 18:30:00', title:'Klan', subtitle:None, episode_num:None, category:'Telenowela', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717503,Klan.html', desc:'Wieści o Marczyńskim docierają do Leszka. Zaczyna on snuć \\nteorie spiskowe. Matka koleżanki Kasi dzwoni do Grażynki z informacją o \\nwypadku kolejowym pociągu, którym Kasia i Basia podróżowały.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 18:30:00', time_end:'2013-01-01 19:20:00', title:'Świat się kręci', subtitle:None, episode_num:None, category:'Magazyn', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717504,Swiat_sie_kreci.html', desc:'Codzienny program studyjny poruszający tematy społeczno-polityczne, naukowe, kulturalne, a także rozrywkowe.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 19:20:00', time_end:'2013-01-01 19:30:00', title:'Przepis dnia', subtitle:None, episode_num:None, category:'Magazyn kulinarny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717505,Przepis_dnia.html', desc:None, details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 19:30:00', time_end:'2013-01-01 20:00:00', title:'Wiadomości', subtitle:None, episode_num:None, category:'Wiadomości', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717506,Wiadomosci.html', desc:'Serwis prezentuje najważniejsze informacje z kraju i ze świata.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 20:00:00', time_end:'2013-01-01 20:10:00', title:'Sport', subtitle:None, episode_num:None, category:'Wiadomości sportowe', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717507,Sport.html', desc:'Informacje o najważniejszych wydarzeniach sportowych.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 20:10:00', time_end:'2013-01-01 20:20:00', title:'Pogoda', subtitle:None, episode_num:None, category:'Pogoda', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717508,Pogoda.html', desc:'Codzienny serwis informacyjny z prognozą pogody.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 20:20:00', time_end:'2013-01-01 20:25:00', title:'Piąty stadion', subtitle:None, episode_num:None, category:'Serial komediowy', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717509,Piaty_stadion.html', desc:'Serial opowiada o grupie przyjaciół - miłośników piłki nożnej, \\nktórzy spędzają dużo czasu w pubie \"Piąty Stadion\". Perypetie bohaterów \\nobfitują w zabawne i nieprzewidywalne sytuacje.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 20:25:00', time_end:'2013-01-01 20:40:00', title:'Real Madryt - Galatasaray SK', subtitle:None, episode_num:None, category:'Piłka nożna', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717510,Real_Madryt__Galatasaray_SK.html', desc:'W 5. kolejce meczów fazy grupowej LM Real Madryt spotka się z \\nGalatasarayem. Kibice wicemistrza Hiszpanii liczą, że Królewscy powtórzą\\n wynik ze Stambułu, gdzie 17 września 2013 roku wygrali 6:1.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 20:40:00', time_end:'2013-01-01 23:00:00', title:'Real Madryt - Galatasaray SK', subtitle:None, episode_num:None, category:'Piłka nożna', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717511,Real_Madryt__Galatasaray_SK.html', desc:'W 5. kolejce meczów fazy grupowej LM Real Madryt spotka się z \\nGalatasarayem. Kibice wicemistrza Hiszpanii liczą, że Królewscy powtórzą\\n wynik ze Stambułu, gdzie 17 września 2013 roku wygrali 6:1.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 23:00:00', time_end:'2013-01-01 23:05:00', title:'Liga Mistrzów', subtitle:None, episode_num:None, category:'Piłka nożna', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717512,Liga_Mistrzow.html', desc:None, details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 23:05:00', time_end:'2013-01-01 23:40:00', title:'Liga Mistrzów', subtitle:None, episode_num:None, category:'Piłka nożna', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717513,Liga_Mistrzow.html', desc:None, details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 23:40:00', time_end:'2013-01-01 23:50:00', title:'Liga Mistrzów', subtitle:None, episode_num:None, category:'Piłka nożna', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717514,Liga_Mistrzow.html', desc:None, details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-01 23:50:00', time_end:'2013-01-02 00:45:00', title:'Transporter', subtitle:None, episode_num:None, category:'Serial sensacyjny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717515,Transporter.html', desc:None, details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-02 00:45:00', time_end:'2013-01-02 01:45:00', title:'Drużyna A', subtitle:None, episode_num:None, category:'Serial sensacyjny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717516,Druzyna_A.html', desc:'Dwie koleżanki z college'u angażują Drużynę A, by odbiła ich \\nprofesora z rąk mafii hazardowej. Udając oddział specjalny, B.A. i \\nMurdock ruszają do Las Vegas, by przejąć bossa mafii.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-02 01:45:00', time_end:'2013-01-02 02:40:00', title:'Świat się kręci', subtitle:None, episode_num:None, category:'Magazyn', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717517,Swiat_sie_kreci.html', desc:'Codzienny program studyjny poruszający tematy społeczno-polityczne, naukowe, kulturalne, a także rozrywkowe.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-02 02:40:00', time_end:'2013-01-02 04:20:00', title:'Doskonałe popołudnie', subtitle:None, episode_num:None, category:'Dramat obyczajowy', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717518,Doskonale_popoludnie.html', desc:'Mikołaj i Anna mają się pobrać, lecz nie znajdują czasu na \\nprzygotowania do ślubu. Są pochłonięci pracą w swoim wydawnictwie. \\nTymczasem do matki Mikołaja po 12 latach powraca mąż.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-02 04:20:00', time_end:'2013-01-02 04:30:00', title:'Notacje', subtitle:None, episode_num:None, category:'Serial dokumentalny', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4717519,Notacje.html', desc:'Cykl programów, w których zasłużone dla Polski osoby opowiadają\\n o jednym epizodzie ze swojego życia. Bohaterką odcinka jest Barbara \\nKasprowicz.', details:None)", "GazetaEvent(channel_id:'TVP-1', channel_name:'TVP 1', time_start:'2013-01-02 04:30:00', time_end:'2013-01-02 04:30:00', title:'Przerwa w nadawaniu', subtitle:None, episode_num:None, category:'Przerwa w emisji', url:'http://tv.gazeta.pl/program_tv/0,110740,8651580,,,4739461,Przerwa_w_nadawaniu.html', desc:None, details:None)" ] self.assertEqual(events, expected)
def testChannelSplitTitle(self): parser_options = ParserOptions(split_title=True) p = TelemanProgrammeParser.TelemanProgrammeParser(parser_options) f = codecs.open("TVP-1.html", "r", "UTF-8") buf = f.read() eventDate = datetime.datetime(2013, 1, 1) channel_id = "TVP-1" events = [ to_string(c) for c in p.get_events(eventDate, channel_id, buf) ] f.close() print 'actual events:\n[\n"' + '",\n"'.join(events) + '"\n]' expected = [ "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-01 23:45:00', time_end:'2013-01-02 00:35:00', title:'Sylwester z\"Jak\xc4\x85 to melodi\xc4\x85\"', subtitle:None, episode_num:None, main_category:'Leisure hobbies', category:'teleturniej muzyczny', url:'/tv/Sylwester-z-Jaka-To-Melodia-857920', desc:None, details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 00:35:00', time_end:'2013-01-02 02:10:00', title:'Legalna blondynka', subtitle:None, episode_num:None, main_category:'Movie/Drama', category:'komedia, USA 2001', url:'/tv/Legalna-Blondynka-544481', desc:'Pi\xc4\x99kna Elle chce udowodni\xc4\x87 by\xc5\x82emu ukochanemu, \xc5\xbce nie tylko uroda jest jej atutem.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 02:10:00', time_end:'2013-01-02 03:50:00', title:'Liberator 2', subtitle:None, episode_num:None, main_category:'Movie/Drama', category:'film sensacyjny, USA 1995', url:'/tv/Liberator-2-792210', desc:'Terrory\xc5\x9bci opanowuj\xc4\x85 luksusowy poci\xc4\x85g. W\xc5\x9br\xc3\xb3d pasa\xc5\xbcer\xc3\xb3w jest komandos.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 03:50:00', time_end:'2013-01-02 04:20:00', title:'Jaka to melodia?', subtitle:None, episode_num:None, main_category:'Leisure hobbies', category:'fina\xc5\x82 grudnia', url:'/tv/Jaka-To-Melodia-385315', desc:'W prowadzonym przez Roberta Janowskiego programie uczestnicy odgaduj\xc4\x85 znane przeboje muzyki rozrywkowej.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 04:20:00', time_end:'2013-01-02 04:20:00', title:'Zako\xc5\x84czenie programu', subtitle:None, episode_num:None, main_category:'News/Current affairs', category:None, url:'/tv/Zakonczenie-Programu-41', desc:None, details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 04:20:00', time_end:'2013-01-02 05:25:00', title:'Zako\xc5\x84czenie programu', subtitle:None, episode_num:None, main_category:'News/Current affairs', category:None, url:'/tv/Zakonczenie-Programu-41', desc:None, details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 05:25:00', time_end:'2013-01-02 07:00:00', title:'Legenda', subtitle:None, episode_num:None, main_category:'Movie/Drama', category:'film fantasy, Wielka Brytania/USA 1985', url:'/tv/Legenda-718805', desc:'Nominacja do Oscara za charakteryzacj\xc4\x99.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 07:00:00', time_end:'2013-01-02 08:00:00', title:'Transmisja mszy \xc5\x9bwi\xc4\x99tej z Sanktuarium Bo\xc5\xbcego Mi\xc5\x82osierdzia w Krakowie-\xc5\x81agiewnikach', subtitle:None, episode_num:None, main_category:'News/Current affairs', category:None, url:'/tv/Transmisja-Mszy-Swietej-z-Sanktuarium-Bozego-Milosierdzia-w-Krakowie-Lagiewnikach-227300', desc:'Zobaczymy transmisj\xc4\x99 mszy \xc5\x9bwi\xc4\x99tej odprawianej w Sanktuarium Bo\xc5\xbcego Mi\xc5\x82osierdzia znajduj\xc4\x85cego si\xc4\x99 w Krakowie \xc5\x81agiewnikach.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 08:00:00', time_end:'2013-01-02 09:25:00', title:'Niebieski s\xc5\x82o\xc5\x84', subtitle:None, episode_num:None, main_category:'Children's/Youth programmes', category:'film animowany, Tajlandia 2008', url:'/tv/Niebieski-Slon-593953', desc:'Birma\xc5\x84czycy rozbijaj\xc4\x85 ob\xc3\xb3z. Ma\xc5\x82y s\xc5\x82onik Khan Kluay zakrada si\xc4\x99 tam w poszukiwaniu taty i omal nie zostaje pojmany. Pomaga mu ...\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 09:25:00', time_end:'2013-01-02 11:00:00', title:'Skok z kosmosu. Felix Baumgartner', subtitle:None, episode_num:None, main_category:'Movie/Drama', category:'film dokumentalny, Wielka Brytania 2012', url:'/tv/Skok-z-Kosmosu-Felix-Baumgartner-847305', desc:'14 pa\xc5\xbadziernika 2012 r. austriacki spadochroniarz Felix Baumgartner wykona\xc5\x82 skok ze stratosfery, bij\xc4\x85c m.in. rekord wysoko\xc5\x9bci skoku.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 11:00:00', time_end:'2013-01-02 12:00:00', title:'Sportowe wydarzenia 2012', subtitle:None, episode_num:None, main_category:'Sports', category:'magazyn sportowy', url:'/tv/Sportowe-Wydarzenia-2012-864073', desc:None, details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 12:00:00', time_end:'2013-01-02 12:15:00', title:'Anio\xc5\x82 Pa\xc5\x84ski', subtitle:None, episode_num:None, main_category:'News/Current affairs', category:None, url:'/tv/Aniol-Panski-85', desc:'Transmisja tradycyjnej modlitwy Anio\xc5\x82 Pa\xc5\x84ski odmawianej z wiernymi przez Ojca \xc5\x9awi\xc4\x99tego w Bazylice \xc5\x9awi\xc4\x99tego Piotra w Watykanie.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 12:15:00', time_end:'2013-01-02 13:50:00', title:'Podr\xc3\xb3\xc5\xbc do wn\xc4\x99trza Ziemi', subtitle:None, episode_num:None, main_category:'Movie/Drama', category:'film przygodowy, Kanada/USA 2008', url:'/tv/Podroz-Do-Wnetrza-Ziemi-682474', desc:'XIX wiek. Do prof. Brocka przychodzi \xc5\xbcona jego kolegi, kt\xc3\xb3ry nie wr\xc3\xb3ci\xc5\x82 z wyprawy do wn\xc4\x99trza Ziemi. Ma map\xc4\x99 z ...\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 13:50:00', time_end:'2013-01-02 14:00:00', title:'Skoki narciarskie: Turniej Czterech Skoczni w Garmisch-Partenkirchen', subtitle:None, episode_num:None, main_category:'Sports', category:'studio', url:'/tv/Skoki-Narciarskie-Turniej-Czterech-Skoczni-w-Garmisch-Partenkirchen-858386', desc:None, details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 14:00:00', time_end:'2013-01-02 16:10:00', title:'Skoki narciarskie: Turniej Czterech Skoczni w Garmisch-Partenkirchen', subtitle:None, episode_num:None, main_category:'Sports', category:'skoki narciarskie', url:'/tv/Skoki-Narciarskie-Turniej-Czterech-Skoczni-w-Garmisch-Partenkirchen-858387', desc:'Noworoczny konkurs w Garmisch- Partenkirchen to drugie zawody Turnieju Czterech Skoczni. Jednym z faworyt\xc3\xb3w jest Gregor Schlierenzauer.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 16:10:00', time_end:'2013-01-02 16:25:00', title:'Tylko hity! Opole 2012: Maciej Stuhr', subtitle:None, episode_num:None, main_category:'Leisure hobbies', category:'koncert', url:'/tv/Tylko-Hity-Opole-2012-Maciej-Stuhr-864074', desc:'Przegl\xc4\x85d najwi\xc4\x99kszych przeboj\xc3\xb3w, jakie zosta\xc5\x82y zaprezentowane podczas koncert\xc3\xb3w na tegorocznym, 49. KFPP w Opolu.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 16:25:00', time_end:'2013-01-02 16:55:00', title:'Gwiazdy w Jedynce: II Divo', subtitle:None, episode_num:None, main_category:'Leisure hobbies', category:'koncert', url:'/tv/Gwiazdy-w-Jedynce-II-Divo-864075', desc:None, details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 16:55:00', time_end:'2013-01-02 17:10:00', title:'Teleexpress', subtitle:None, episode_num:None, main_category:'News/Current affairs', category:None, url:'/tv/Teleexpress-28', desc:'Dynamicznie prowadzony serwis informacyjny prezentuj\xc4\x85cy aktualne wydarzenia, wiadomo\xc5\x9bci kulturalne oraz ciekawostki z kraju i ze \xc5\x9bwiata.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 17:10:00', time_end:'2013-01-02 17:15:00', title:'Pogoda', subtitle:None, episode_num:None, main_category:'News/Current affairs', category:None, url:'/tv/Pogoda-5', desc:'Szczeg\xc3\xb3\xc5\x82owe informacje na temat stanu pogody w najbli\xc5\xbcszych dniach.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 17:15:00', time_end:'2013-01-02 17:45:00', title:'Jaka to melodia?', subtitle:None, episode_num:None, main_category:'Leisure hobbies', category:'fina\xc5\x82 roku', url:'/tv/Jaka-To-Melodia-638893', desc:'W prowadzonym przez Roberta Janowskiego programie uczestnicy odgaduj\xc4\x85 znane przeboje muzyki rozrywkowej.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 17:45:00', time_end:'2013-01-02 19:30:00', title:'Wall-E', subtitle:None, episode_num:None, main_category:'Children's/Youth programmes', category:'film animowany, USA 2008', url:'/tv/Wall-E-804888', desc:'Historia mi\xc5\x82o\xc5\x9bci dwojga robot\xc3\xb3w.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 19:30:00', time_end:'2013-01-02 20:00:00', title:'Wiadomo\xc5\x9bci', subtitle:None, episode_num:None, main_category:'News/Current affairs', category:None, url:'/tv/Wiadomosci-227185', desc:'Serwis informacyjny prezentuj\xc4\x85cy najnowsze wydarzenia z kraju i ze \xc5\x9bwiata, m.in. z dziedziny polityki, gospodarki, kultury.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 20:00:00', time_end:'2013-01-02 20:05:00', title:'Sport', subtitle:None, episode_num:None, main_category:'Sports', category:None, url:'/tv/Sport-149043', desc:'Przegl\xc4\x85d najwa\xc5\xbcniejszych aktualnych wydarze\xc5\x84 sportowych ze szczeg\xc3\xb3lnym uwzgl\xc4\x99dnieniem osi\xc4\x85gni\xc4\x99\xc4\x87 polskich zawodnik\xc3\xb3w.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 20:05:00', time_end:'2013-01-02 20:20:00', title:'Pogoda', subtitle:None, episode_num:None, main_category:'News/Current affairs', category:None, url:'/tv/Pogoda-5', desc:'Szczeg\xc3\xb3\xc5\x82owe informacje na temat stanu pogody w najbli\xc5\xbcszych dniach.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 20:20:00', time_end:'2013-01-02 22:05:00', title:'Legalna blondynka', subtitle:None, episode_num:None, main_category:'Movie/Drama', category:'komedia, USA 2001', url:'/tv/Legalna-Blondynka-544481', desc:'Pi\xc4\x99kna Elle chce udowodni\xc4\x87 by\xc5\x82emu ukochanemu, \xc5\xbce nie tylko uroda jest jej atutem.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 22:05:00', time_end:'2013-01-02 23:55:00', title:'Liberator 2', subtitle:None, episode_num:None, main_category:'Movie/Drama', category:'film sensacyjny, USA 1995', url:'/tv/Liberator-2-792210', desc:'Terrory\xc5\x9bci opanowuj\xc4\x85 luksusowy poci\xc4\x85g. W\xc5\x9br\xc3\xb3d pasa\xc5\xbcer\xc3\xb3w jest komandos.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 23:55:00', time_end:'2013-01-02 01:20:00', title:'Hell Ride', subtitle:None, episode_num:None, main_category:'Movie/Drama', category:'film sensacyjny, USA 2008', url:'/tv/Hell-Ride-430110', desc:'Johnny zwany Pistolero jest przyw\xc3\xb3dc\xc4\x85 gangu motocyklowego\\n'\\nThe Victors\\n'\\n. Jego celem jest zemsta na liderach grupy\\n'\\nThe 666ers\\n'\\n.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 01:20:00', time_end:'2013-01-02 03:20:00', title:'Underworld', subtitle:None, episode_num:None, main_category:'Movie/Drama', category:'horror, Niemcy/Wielka Brytania/USA/W\xc4\x99gry 2003', url:'/tv/Underworld-128114', desc:'Student trafia w \xc5\x9brodek wojny tocz\xc4\x85cej si\xc4\x99 mi\xc4\x99dzy wampirami a wilko\xc5\x82akami.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 03:20:00', time_end:'2013-01-02 04:20:00', title:'Zagadkowa Jedynka', subtitle:None, episode_num:None, main_category:'Leisure hobbies', category:'program rozrywkowy', url:'/tv/Zagadkowa-Jedynka-227204', desc:'W tej zabawie do zdobycia s\xc4\x85 nagrody pieni\xc4\x99\xc5\xbcne. Wystarczy telefonicznie lub za pomoc\xc4\x85 sms-a poda\xc4\x87 prawid\xc5\x82owe rozwi\xc4\x85zanie zagadki s\xc5\x82ownej.\\n', details:None)", "TelemanEvent(channel_id:'TVP-1', channel_name:None, channel_icon_url:None, time_start:'2013-01-02 04:20:00', time_end:'2013-01-02 04:20:00', title:'Zako\xc5\x84czenie programu', subtitle:None, episode_num:None, main_category:'News/Current affairs', category:None, url:'/tv/Zakonczenie-Programu-41', desc:None, details:None)" ] self.assertEqual(events, expected)
def testGetDetails(self): p = GazetaProgrammeDetailsParser.GazetaProgrammeDetailsParser("a") f = codecs.open("Dziewczyna z Alabamy.html", "r", "ISO-8859-2") buf = f.read() actual = p.get_details(buf) f.close() expected_description = u"\nOpis: Narzeczona syna pani burmistrz Nowego Jorku wraca przed ślubem na\n amerykańskie Południe, by uregulować sprawy, w tym? rozwód. Plus \nniezawodna Reese Witherspoon broniąca całość przed rutyną." expected_primary_title = u"Dziewczyna z Alabamy" expected_year = u"2002" expected_country = u"USA" expected_genre = u"Komedia romantyczna" expected_duration = u"1 godzina 44 minuty" expected_photo_url = u"Dziewczyna%20z%20Alabamy_pliki/d91d2a2effa1f879bb48d3b1aa9d58ec532d0800-thumb.jpg" expected_pg = ParentalRating(u"od12", 12) expected_crew = None expected = GazetaEventDetails(expected_primary_title, expected_description, expected_year, expected_country, expected_genre, expected_duration, expected_photo_url, expected_pg, expected_crew) print("actual :" + to_string(actual)) print("expected:" + to_string(expected)) self.assertEqual(actual.description, expected.description) self.assertEqual(to_string(actual.pg), to_string(expected.pg)) self.assertEqual(actual.photo_url, expected.photo_url) self.assertEqual(str(actual), str(expected)) parserOptions = ParserOptions() channel = Channel('TVP-1', 'TVP 1') event = GazetaEvent(parserOptions, channel, 'Dziewczyna z Alabamy', \ 'Movie/Drama', 'Komedia romantyczna', \ 'Melanie jest nowojorską projektantką mody. Wkrótce ma poślubić bogatego polityka. Aby to zrobić, musi jednak wrócić do rodzinnego miasteczka i rozwieść się z pierwszym mężem. ', \ '2013-01-02 02:10:00', '2013-01-02 03:50:00',\ '', actual) self.assertEqual(event.get_title(), "Dziewczyna z Alabamy")
def testEventFull(self): day = datetime.datetime(2012, 12, 31) channel = Channel(123, 'testchan', 'http://media.teleman.pl/logos/m/tvp-1.png') parserOptions = ParserOptions(split_title=True) event = TelemanEvent(parserOptions, channel, 'simple event: subtitle for an event (2/3)', 'Movie/Drama', 'movie', 'this is description for an event', day, day + datetime.timedelta(days=1), None) f = StringIO.StringIO() output = XmltvOutput.XmltvOutput() output.Init(f) guide = [event] output.SaveGuide(day, guide) output.SaveGuideChannels() output.Finish() expected = """ <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE tv SYSTEM "xmltv.dtd"> <tv generator-info-name="epguide generator"> <programme start="20121231000000 +0200" stop="20130101000000 +0200" channel="123"> <title>simple event</title> <sub-title>subtitle for an event</sub-title> <desc><![CDATA[this is description for an event]]></desc> <category language="en">Movie/Drama</category> <category language="pl">movie</category> <episode-num system="onscreen">2/3</episode-num> </programme> <channel id="123"><display-name lang="pl">testchan</display-name><icon src="http://media.teleman.pl/logos/m/tvp-1.png"/></channel> </tv> """.lstrip() actual = f.getvalue() print("actual: " + actual) print("expected: " + expected) self.assertEqual(actual, expected)
def testShowWithSubtitleWithDetails(self): imdb_url = u"x" imdb_rank = u"x" imdb = Imdb(imdb_url, imdb_rank) filmweb_url = u"x" filmweb_rank = u"x" filmweb = Imdb(filmweb_url, filmweb_rank) photo_url = u"x" channel = Channel('x', 'x', "x") title = u'Rodzinka.pl: Zachcianki (80)' category = 'serial komediowy' desc = 'One line summary.' primary_title = u'Rodzinka.pl: Zachcianki (80)' secondary_title = None original_title = None genre = u"serial komediowy" country = u"Polska" year = u"2013" pg = ParentalRating(u"od 12 lat", 12) description = u"Long description" details = TelemanEventDetails(primary_title, secondary_title, description, original_title, year, country, genre, imdb, filmweb, photo_url, pg) main_category = 'Show/Game show' time_start = '2013-01-02 02:10:00' time_end = '2013-01-02 03:50:00' url = None parser_options = ParserOptions(split_title=False, add_original_title_to_title=True, add_year_to_title=True, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual( event.get_title(), u'Rodzinka.pl: Zachcianki (80)') # with original title and year self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), None) self.assertEqual(event.get_filename(), u'Rodzinka.pl: Zachcianki (80)') parser_options = ParserOptions(split_title=True, add_original_title_to_title=True, add_year_to_title=True, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u'Rodzinka.pl') # with original title and year self.assertEqual(event.get_subtitle(), "Zachcianki") self.assertEqual(event.get_episode_num(), "80") self.assertEqual(event.get_filename(), u'Rodzinka.pl (80) Zachcianki') parser_options = ParserOptions(split_title=True, add_original_title_to_title=False, add_year_to_title=True, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u'Rodzinka.pl') # with year self.assertEqual(event.get_subtitle(), "Zachcianki") self.assertEqual(event.get_episode_num(), "80") self.assertEqual(event.get_filename(), u'Rodzinka.pl (80) Zachcianki') parser_options = ParserOptions(split_title=True, add_original_title_to_title=True, add_year_to_title=False, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u'Rodzinka.pl') # with original title self.assertEqual(event.get_subtitle(), "Zachcianki") self.assertEqual(event.get_episode_num(), "80") parser_options = ParserOptions(split_title=True, add_original_title_to_title=False, add_year_to_title=False, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u'Rodzinka.pl') # nothing self.assertEqual(event.get_subtitle(), "Zachcianki") self.assertEqual(event.get_episode_num(), "80") parser_options = ParserOptions(split_title=True, add_original_title_to_title=True, add_year_to_title=True, add_age_rating_to_title=12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual( event.get_title(), u'Rodzinka.pl [od 12 lat]') # with original title, year and age self.assertEqual(event.get_subtitle(), "Zachcianki") self.assertEqual(event.get_episode_num(), "80") parser_options = ParserOptions(split_title=True, add_original_title_to_title=False, add_year_to_title=True, add_age_rating_to_title=12) self.assertEqual(event.get_title(), u'Rodzinka.pl [od 12 lat]') # with year and age self.assertEqual(event.get_subtitle(), "Zachcianki") self.assertEqual(event.get_episode_num(), "80") parser_options = ParserOptions(split_title=True, add_original_title_to_title=True, add_year_to_title=False, add_age_rating_to_title=12) self.assertEqual( event.get_title(), u'Rodzinka.pl [od 12 lat]') # with original title and age self.assertEqual(event.get_subtitle(), "Zachcianki") self.assertEqual(event.get_episode_num(), "80") parser_options = ParserOptions(split_title=True, add_original_title_to_title=False, add_year_to_title=False, add_age_rating_to_title=12) self.assertEqual(event.get_title(), u'Rodzinka.pl [od 12 lat]') # with age self.assertEqual(event.get_subtitle(), "Zachcianki") self.assertEqual(event.get_episode_num(), "80") self.assertEqual(event.get_description(), u'One line summary.Long description')
def testMovie(self): imdb_url = u"x" imdb_rank = u"x" imdb = Imdb(imdb_url, imdb_rank) filmweb_url = u"x" filmweb_rank = u"x" filmweb = Imdb(filmweb_url, filmweb_rank) photo_url = u"x" channel = Channel('x', 'x', "x") primary_title = 'Liberator 2' secondary_title = '' description = u"description" original_title = u"original title" year = u"2009" country = u"USA" genre = u"FILM GANGSTERSKI" pg = ParentalRating(u"od 16 lat", 16) details = TelemanEventDetails(primary_title, secondary_title, description, original_title, year, country, genre, imdb, filmweb, photo_url, pg) title = 'Megahit: Liberator 2' main_category = 'Movie/Drama' category = 'film sensacyjny, USA 1995' desc = 'summary' time_start = '2013-01-02 02:10:00' time_end = '2013-01-02 03:50:00' url = None parser_options = ParserOptions(split_title = True, add_original_title_to_title = True, add_year_to_title = True, add_age_rating_to_title = 16) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u"original title (2009) - Liberator 2 [od 16 lat] [Megahit]") self.assertEqual(event.get_filename(), u"original title (2009) - Liberator 2 [od 16 lat] [Megahit]") parser_options = ParserOptions(split_title = True, add_original_title_to_title = False, add_year_to_title = True, add_age_rating_to_title = 16) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), "Liberator 2 [od 16 lat] [Megahit]") self.assertEqual(event.get_filename(), u"Liberator 2 [od 16 lat] [Megahit]") parser_options = ParserOptions(split_title = True, add_original_title_to_title = True, add_year_to_title = False, add_age_rating_to_title = 16) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u"original title - Liberator 2 [od 16 lat] [Megahit]") self.assertEqual(event.get_filename(), u"original title - Liberator 2 [od 16 lat] [Megahit]") parser_options = ParserOptions(split_title = True, add_original_title_to_title = False, add_year_to_title = False, add_age_rating_to_title = 16) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), "Liberator 2 [od 16 lat] [Megahit]") self.assertEqual(event.get_filename(), u"Liberator 2 [od 16 lat] [Megahit]") parser_options = ParserOptions(split_title = True, add_original_title_to_title = True, add_year_to_title = True, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u"original title (2009) - Liberator 2 [Megahit]") self.assertEqual(event.get_filename(), u"original title (2009) - Liberator 2 [Megahit]") parser_options = ParserOptions(split_title = True, add_original_title_to_title = False, add_year_to_title = True, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), "Liberator 2 [Megahit]") self.assertEqual(event.get_filename(), u"Liberator 2 [Megahit]") parser_options = ParserOptions(split_title = True, add_original_title_to_title = True, add_year_to_title = False, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u"original title - Liberator 2 [Megahit]") self.assertEqual(event.get_filename(), u"original title - Liberator 2 [Megahit]") parser_options = ParserOptions(split_title = True, add_original_title_to_title = False, add_year_to_title = False, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), "Liberator 2 [Megahit]") self.assertEqual(event.get_filename(), u"Liberator 2 [Megahit]") parser_options = ParserOptions(split_title = True, add_original_title_to_title = False, add_year_to_title = False, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_description(), u'summarydescription\nTytul oryginalny:original title')
def testShowWithEpisodeNumWithoutSubtitleWithoutDetails(self): channel = Channel('x','x',"x") title = u'Barwy szczęścia (948)' category = 'serial obyczajowy' desc = 'One line summary.' main_category = 'Show/Game show' time_start = '2013-01-02 02:10:00' time_end = '2013-01-02 03:50:00' url = None parser_options = ParserOptions(split_title = False, add_original_title_to_title = True, add_year_to_title = True, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia (948)') # with original title and year self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), None) self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = False, add_original_title_to_title = False, add_year_to_title = True, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia (948)') # with year self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), None) self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = False, add_original_title_to_title = True, add_year_to_title = False, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia (948)') # with original title self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), None) self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = False, add_original_title_to_title = False, add_year_to_title = False, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia (948)')# nothing self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), None) self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = False, add_original_title_to_title = True, add_year_to_title = True, add_age_rating_to_title = 12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia (948)')# with original title, year and age self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), None) self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = False, add_original_title_to_title = False, add_year_to_title = True, add_age_rating_to_title = 12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia (948)')# with year and age self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), None) self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = False, add_original_title_to_title = True, add_year_to_title = False, add_age_rating_to_title = 12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia (948)') # with original title and age self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), None) self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = False, add_original_title_to_title = False, add_year_to_title = False, add_age_rating_to_title = 12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia (948)') # with age self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), None) self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = True, add_original_title_to_title = True, add_year_to_title = True, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia') # with original title and year self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), "948") self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = True, add_original_title_to_title = False, add_year_to_title = True, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia') # with year self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), "948") self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = True, add_original_title_to_title = True, add_year_to_title = False, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia') # with original title self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), "948") self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = True, add_original_title_to_title = False, add_year_to_title = False, add_age_rating_to_title = 18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia')# nothing self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), "948") self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = True, add_original_title_to_title = True, add_year_to_title = True, add_age_rating_to_title = 12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia')# with original title, year and age self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), "948") self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = True, add_original_title_to_title = False, add_year_to_title = True, add_age_rating_to_title = 12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia')# with year and age self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), "948") self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = True, add_original_title_to_title = True, add_year_to_title = False, add_age_rating_to_title = 12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia') # with original title and age self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), "948") self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') parser_options = ParserOptions(split_title = True, add_original_title_to_title = False, add_year_to_title = False, add_age_rating_to_title = 12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Barwy szczęścia') # with age self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_episode_num(), "948") self.assertEqual(event.get_filename(), u'Barwy szczęścia (948)') self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_description(), "One line summary.")
def testShow3(self): imdb_url = u"x" imdb_rank = u"x" imdb = Imdb(imdb_url, imdb_rank) filmweb_url = u"x" filmweb_rank = u"x" filmweb = Imdb(filmweb_url, filmweb_rank) photo_url = u"x" channel = Channel('x', 'x', "x") title = u'Na linii strzału 2 (15)' category = 'serial sensacyjny' desc = 'One line summary.' primary_title = 'Na linii strzału' secondary_title = 'sezon 2 odc. 15' original_title = "In Plain Sight: In My Humboldt Opinion" genre = u"serial sensacyjny" country = u"USA" year = u"2009" pg = ParentalRating(u"od 16 lat", 16) description = u"Long description" details = TelemanEventDetails(primary_title, secondary_title, description, original_title, year, country, genre, imdb, filmweb, photo_url, pg) main_category = 'Show/Game show' time_start = '2013-01-02 02:10:00' time_end = '2013-01-02 03:50:00' url = None parser_options = ParserOptions(split_title=False, add_original_title_to_title=True, add_year_to_title=True, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title( ), u'In Plain Sight: In My Humboldt Opinion - Na linii strza\u0142u 2 (15)' ) # with original title and year parser_options = ParserOptions(split_title=False, add_original_title_to_title=False, add_year_to_title=True, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u'Na linii strza\u0142u 2 (15)') # with year parser_options = ParserOptions(split_title=False, add_original_title_to_title=True, add_year_to_title=False, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual( event.get_title(), u'In Plain Sight: In My Humboldt Opinion - Na linii strzału 2 (15)' ) # with original title parser_options = ParserOptions(split_title=False, add_original_title_to_title=False, add_year_to_title=False, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u'Na linii strzału 2 (15)') # nothing parser_options = ParserOptions(split_title=False, add_original_title_to_title=True, add_year_to_title=True, add_age_rating_to_title=12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title( ), u'In Plain Sight: In My Humboldt Opinion - Na linii strzału 2 (15) [od 16 lat]' ) # with original title, year and age parser_options = ParserOptions(split_title=False, add_original_title_to_title=False, add_year_to_title=True, add_age_rating_to_title=12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual( event.get_title(), u'Na linii strzału 2 (15) [od 16 lat]') # with year and age parser_options = ParserOptions(split_title=False, add_original_title_to_title=True, add_year_to_title=False, add_age_rating_to_title=12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title( ), u'In Plain Sight: In My Humboldt Opinion - Na linii strzału 2 (15) [od 16 lat]' ) # with original title and age parser_options = ParserOptions(split_title=False, add_original_title_to_title=False, add_year_to_title=False, add_age_rating_to_title=12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u'Na linii strzału 2 (15) [od 16 lat]') # with age parser_options = ParserOptions(split_title=False, add_original_title_to_title=False, add_year_to_title=False, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_subtitle(), None) self.assertEqual( event.get_description(), "One line summary.Long description\nTytul oryginalny:In Plain Sight: In My Humboldt Opinion" )
def testShowWithoutEpisodeNumWithoutSubtitleWithoutDetails(self): channel = Channel('x', 'x', "x") title = u'Uwaga' category = 'magazyn reporterów' desc = 'One line summary.' main_category = 'Show/Game show' time_start = '2013-01-02 02:10:00' time_end = '2013-01-02 03:50:00' url = None parser_options = ParserOptions(split_title=False, add_original_title_to_title=True, add_year_to_title=True, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Uwaga') # with original title and year parser_options = ParserOptions(split_title=False, add_original_title_to_title=False, add_year_to_title=True, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Uwaga') # with year parser_options = ParserOptions(split_title=False, add_original_title_to_title=True, add_year_to_title=False, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Uwaga') # with original title parser_options = ParserOptions(split_title=False, add_original_title_to_title=False, add_year_to_title=False, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Uwaga') # nothing parser_options = ParserOptions(split_title=False, add_original_title_to_title=True, add_year_to_title=True, add_age_rating_to_title=12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Uwaga') # with original title, year and age parser_options = ParserOptions(split_title=False, add_original_title_to_title=False, add_year_to_title=True, add_age_rating_to_title=12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Uwaga') # with year and age parser_options = ParserOptions(split_title=False, add_original_title_to_title=True, add_year_to_title=False, add_age_rating_to_title=12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Uwaga') # with original title and age parser_options = ParserOptions(split_title=False, add_original_title_to_title=False, add_year_to_title=False, add_age_rating_to_title=12) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=None) self.assertEqual(event.get_title(), u'Uwaga') # with age self.assertEqual(event.get_subtitle(), None) self.assertEqual(event.get_description(), "One line summary.")
def testMovie(self): imdb_url = u"x" imdb_rank = u"x" imdb = Imdb(imdb_url, imdb_rank) filmweb_url = u"x" filmweb_rank = u"x" filmweb = Imdb(filmweb_url, filmweb_rank) photo_url = u"x" channel = Channel('x', 'x', "x") primary_title = 'U Pana Boga za piecem' secondary_title = "" description = u"description" original_title = "" year = u"1998" country = u"Polska" genre = u"KOMEDIA" pg = ParentalRating(u"od 16 lat", 16) details = TelemanEventDetails(primary_title, secondary_title, description, original_title, year, country, genre, imdb, filmweb, photo_url, pg) title = 'Wakacyjny hit Jedynki: U Pana Boga za piecem' main_category = 'Movie/Drama' category = 'komedia, Polska 1998' desc = 'summary' time_start = '2013-01-02 02:10:00' time_end = '2013-01-02 03:50:00' url = None parser_options = ParserOptions(split_title=False, add_original_title_to_title=False, add_year_to_title=False, add_age_rating_to_title=99) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u"Wakacyjny hit Jedynki: U Pana Boga za piecem") self.assertEqual(event.get_filename(), u"Wakacyjny hit Jedynki: U Pana Boga za piecem") parser_options = ParserOptions(split_title=False, add_original_title_to_title=True, add_year_to_title=True, add_age_rating_to_title=16) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual( event.get_title(), u"Wakacyjny hit Jedynki: U Pana Boga za piecem (1998) [od 16 lat]") self.assertEqual( event.get_filename(), u"Wakacyjny hit Jedynki: U Pana Boga za piecem (1998) [od 16 lat]") parser_options = ParserOptions(split_title=True, add_original_title_to_title=True, add_year_to_title=True, add_age_rating_to_title=16) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual( event.get_title(), u"U Pana Boga za piecem (1998) [od 16 lat] [Wakacyjny hit Jedynki]" ) self.assertEqual( event.get_filename(), u"U Pana Boga za piecem (1998) [od 16 lat] [Wakacyjny hit Jedynki]" ) parser_options = ParserOptions(split_title=True, add_original_title_to_title=False, add_year_to_title=True, add_age_rating_to_title=16) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual( event.get_title(), u"U Pana Boga za piecem (1998) [od 16 lat] [Wakacyjny hit Jedynki]" ) self.assertEqual( event.get_filename(), u"U Pana Boga za piecem (1998) [od 16 lat] [Wakacyjny hit Jedynki]" ) parser_options = ParserOptions(split_title=True, add_original_title_to_title=True, add_year_to_title=False, add_age_rating_to_title=16) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual( event.get_title(), u"U Pana Boga za piecem [od 16 lat] [Wakacyjny hit Jedynki]") self.assertEqual( event.get_filename(), u"U Pana Boga za piecem [od 16 lat] [Wakacyjny hit Jedynki]") parser_options = ParserOptions(split_title=True, add_original_title_to_title=False, add_year_to_title=False, add_age_rating_to_title=16) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual( event.get_title(), "U Pana Boga za piecem [od 16 lat] [Wakacyjny hit Jedynki]") self.assertEqual( event.get_filename(), u"U Pana Boga za piecem [od 16 lat] [Wakacyjny hit Jedynki]") parser_options = ParserOptions(split_title=True, add_original_title_to_title=True, add_year_to_title=True, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual( event.get_title(), u"U Pana Boga za piecem (1998) [Wakacyjny hit Jedynki]") self.assertEqual( event.get_filename(), u"U Pana Boga za piecem (1998) [Wakacyjny hit Jedynki]") parser_options = ParserOptions(split_title=True, add_original_title_to_title=False, add_year_to_title=True, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual( event.get_title(), "U Pana Boga za piecem (1998) [Wakacyjny hit Jedynki]") self.assertEqual( event.get_filename(), u"U Pana Boga za piecem (1998) [Wakacyjny hit Jedynki]") parser_options = ParserOptions(split_title=True, add_original_title_to_title=True, add_year_to_title=False, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), u"U Pana Boga za piecem [Wakacyjny hit Jedynki]") self.assertEqual(event.get_filename(), u"U Pana Boga za piecem [Wakacyjny hit Jedynki]") parser_options = ParserOptions(split_title=True, add_original_title_to_title=False, add_year_to_title=False, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_title(), "U Pana Boga za piecem [Wakacyjny hit Jedynki]") self.assertEqual(event.get_filename(), u"U Pana Boga za piecem [Wakacyjny hit Jedynki]") parser_options = ParserOptions(split_title=True, add_original_title_to_title=False, add_year_to_title=False, add_age_rating_to_title=18) event = TelemanEvent(parser_options, channel, title, main_category, category, desc, time_start, time_end, url, details=details) self.assertEqual(event.get_description(), u'summarydescription')