def testGetDetails(self):
        p = TelemanProgrammeDetailsParser.TelemanProgrammeDetailsParser("a")
        f = codecs.open("Wrogowie-Publiczni-699775.html", "r", "UTF-8")
        #http://www.teleman.pl/tv/Wrogowie-Publiczni-699775
        buf = f.read()
        actual = p.get_details(buf)
        f.close()
        expected_description = u"\nOpis: USA, rok 1933. Po dziewięciu latach pozbawienia wolności John Dillinger (Johnny Depp) zostaje zwolniony warunkowo. \
Dokonuje on brawurowej akcji oswobodzenia kilku więźniów ze stanowego zakładu karnego w Michigan City. Pomaga mu John \"Red\" Hamilton (Jason Clarke). \
Po krótkim pobycie na odległej farmie dwaj wspólnicy oraz zbiegowie - Harry \"Pete\" Pierpont (David Wenham), Homer Van Meter \
(Stephen Dorff) i Ed Shouse (Michael Vieau) - przenoszą się do Chicago. Tam Dillinger i jego kompani dokonują serii śmiałych napadów na banki. \
Członkowie bandy zdobywają wielką popularność wśród zwykłych Amerykanów, zmęczonych wielkim kryzysem. \
Sam Dillinger związuje się ze śliczną Billie Frechette (Marion Cotillard). \
Przestępcy są nieuchwytni, a policja bezsilna. Dyrektor Biura Śledczego, J. Edgar Hoover (Billy Crudup), ogłasza Johna wrogiem publicznym numer jeden. \
Kierownictwo powierza zadanie złapania bandyty agentowi Melvinowi Purvisowi (Christian Bale), który stał się gwiazdą formującego się FBI po tym, \
jak zabił groźnego gangstera Pretty Boya Floyda (Channing Tatum). Rozpoczyna się pościg... \
Adaptacja książki Bryana Burrougha opowiada o ostatnim okresie życia legendarnego złoczyńcy."
        expected_primary_title = u"Wrogowie publiczni"
        expected_secondary_title = ""
        expected_original_title = u"Public Enemies"
        expected_year = u"2009"
        expected_country = u"USA"
        expected_genre = u"FILM GANGSTERSKI"
        expected_imdb_url = u"http://www.imdb.com/Title?Public+Enemies+%282009%29"
        expected_imdb_rank = u"7.0/10"
        expected_imdb = Imdb(expected_imdb_url, expected_imdb_rank)
        expected_filmweb_url = u"http://www.filmweb.pl/film/Wrogowie+publiczni-2009-467091"
        expected_filmweb_rank = u"7.2/10"
        expected_filmweb = Imdb(expected_filmweb_url, expected_filmweb_rank)
        expected_photo_url = u"http://media.teleman.pl/photos/470x265/Wrogowie-Publiczni.jpeg"
        expected_pg = ParentalRating(u"od 16 lat", 16)
        expected = TelemanEventDetails(expected_primary_title, expected_secondary_title, expected_description, expected_original_title, expected_year, expected_country, expected_genre, expected_imdb, expected_filmweb, expected_photo_url, expected_pg)
        print("expected_description  :"+str(expected_description))
        print("expected_description  :"+expected_description.encode('utf-8'))
        print("expected_description  :"+str(actual.description))
        print("expected_description  :"+actual.description.encode('utf-8'))
        print("actual  :"+to_string(actual))
        print("expected:"+to_string(expected))
        self.assertEqual(actual.description, expected.description)
        self.assertEqual(actual.original_title, expected.original_title)

        self.assertEqual(to_string(actual.filmweb), to_string(expected.filmweb))
        self.assertEqual(to_string(actual.imdb), to_string(expected.imdb))
        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 = TelemanEvent(parserOptions, channel, 'Liberator 2', \
                       'Movie/Drama', 'film sensacyjny, USA 1995', \
                       'Terrory\xc5\x9bci opanowuj\xc4\x85 luksusowy poci\xc4\x85g. ', \
                       '2013-01-02 02:10:00', '2013-01-02 03:50:00',\
                       '', actual)
        self.assertEqual(event.get_title(), "Liberator 2")
Esempio n. 2
0
    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)
Esempio n. 3
0
    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)
Esempio n. 4
0
    def create_event(self, event_element, channel, event_date):
        #<li class="cat-ser with-photo" id="prog7532796">
        #  <a href="/tv/Faceci-Do-Wziecia-Szkola-Rodzenia-41-988883">
        #    <img width="100" height="63" class="photo" alt="zdjęcie" src="http://media.teleman.pl/photos/crop-100x63/Faceci-Do-Wziecia.jpeg">
        #  </a>
        #  <em>6:00</em>
        #  <div class="detail">
        #    <a href="/tv/Faceci-Do-Wziecia-Szkola-Rodzenia-41-988883">Faceci do wzięcia: Szkoła rodzenia (41)</a>
        #    <p class="genre">serial komediowy</p>
        #    <p>Dziennikarz Wiktor jest bałaganiarzem. Fotograf Roman to klasyczny pedant. Obaj, porzuceni przez żony, zamieszkują w jednym mieszkaniu.</p>
        #  </div>
        #</li>
        prog_id = event_element.get("id")
        if prog_id:
            title = self.get_texts(event_element, 'div[@class="detail"]/a')
            self.log.debug("  title: '" + title.encode('utf8') + "'")
            url = self.get_attr(event_element, 'div[@class="detail"]/a',
                                "href")

            time_start_string = self.get_texts(event_element, 'em')
            datetime_start_string = "%s %s" % (event_date.strftime("%Y-%m-%d"),
                                               time_start_string)
            time_start_struct = time.strptime(datetime_start_string,
                                              '%Y-%m-%d %H:%M')
            time_start = datetime.datetime.fromtimestamp(
                time.mktime(time_start_struct))

            time_end = time_start  #TODO
            category = self.get_texts(
                event_element, 'div[@class="detail"]/p[@class="genre"]')
            summary = self.get_texts(event_element,
                                     'div[@class="detail"]/p[@class="genre"]')
            #http://media.teleman.pl/photos/crop-100x63/Barwy-Szczescia_1.jpeg
            photo_url = self.get_attr(event_element, 'a/img', "src")
            #http://media.teleman.pl/photos/470x265/Barwy-Szczescia_1.jpeg
            photo_url = photo_url.replace("crop-100x63", "470x265")

            class_attrs = event_element.get("class").split()
            main_category_class = next(
                (c for c in class_attrs if c.startswith("cat-")), None)
            main_category = self.category_classes_to_main_category.get(
                main_category_class, "")
            self.log.debug("main_category_class:" + main_category_class +
                           " main_category:" + main_category)

            self.log.debug("event_element: " + str(channel) + " " +
                           str(time_start) + " " + str(time_end) + " " +
                           title.encode('utf8') + " " + " " +
                           main_category.encode('utf8') + " " +
                           category.encode('utf8') + " " + url)
            event = TelemanEvent(self.parser_options, channel, title,
                                 main_category, category, summary, time_start,
                                 time_end, url, None, photo_url, prog_id)

            return event
        else:
            return None
Esempio n. 5
0
    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 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.")
Esempio n. 9
0
    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.")
Esempio n. 10
0
    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.")
Esempio n. 12
0
    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 testShowWithDetailsWithSecondaryTitle(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 dobre i na złe: Pierwszy dzień (518)'
        category = 'serial obyczajowy'
        desc = 'One line summary.'
        
        primary_title = u'Na dobre i na złe'
        secondary_title = u'odc. 518: Pierwszy dzień'
        original_title = None
        genre = u"serial obyczajowy"
        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'Na dobre i na złe: Pierwszy dzień (518)')  
        self.assertEqual(event.get_subtitle(), None)
        self.assertEqual(event.get_episode_num(), None)
        self.assertEqual(event.get_filename(), u'Na dobre i na złe: Pierwszy dzień (518)')  

        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'Na dobre i na złe')  # with original title and year 
        self.assertEqual(event.get_subtitle(), u"Pierwszy dzień")
        self.assertEqual(event.get_episode_num(), "518")
        self.assertEqual(event.get_filename(), u'Na dobre i na złe (518) Pierwszy dzień')  

        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'Na dobre i na złe')  # with year 
        self.assertEqual(event.get_subtitle(), u"Pierwszy dzień")
        self.assertEqual(event.get_episode_num(), "518")
        self.assertEqual(event.get_filename(), u'Na dobre i na złe (518) Pierwszy dzień')  

        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'Na dobre i na złe')  # with original title 
        self.assertEqual(event.get_subtitle(), u"Pierwszy dzień")
        self.assertEqual(event.get_episode_num(), "518")
        self.assertEqual(event.get_filename(), u'Na dobre i na złe (518) Pierwszy dzień')  

        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'Na dobre i na złe')  # nothing
        self.assertEqual(event.get_subtitle(), u"Pierwszy dzień")
        self.assertEqual(event.get_episode_num(), "518")
        self.assertEqual(event.get_filename(), u'Na dobre i na złe (518) Pierwszy dzień')  


        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'Na dobre i na złe [od 12 lat]')  # with original title, year and age
        self.assertEqual(event.get_subtitle(), u"Pierwszy dzień")
        self.assertEqual(event.get_episode_num(), "518")
        self.assertEqual(event.get_filename(), u'Na dobre i na złe [od 12 lat] (518) Pierwszy dzień')  

        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=details)
        self.assertEqual(event.get_title(), u'Na dobre i na złe [od 12 lat]')  # with year and age
        self.assertEqual(event.get_subtitle(), u"Pierwszy dzień")
        self.assertEqual(event.get_episode_num(), "518")
        self.assertEqual(event.get_filename(), u'Na dobre i na złe [od 12 lat] (518) Pierwszy dzień')  

        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=details)
        self.assertEqual(event.get_title(), u'Na dobre i na złe [od 12 lat]')  # with original title and age
        self.assertEqual(event.get_subtitle(), u"Pierwszy dzień")
        self.assertEqual(event.get_episode_num(), "518")
        self.assertEqual(event.get_filename(), u'Na dobre i na złe [od 12 lat] (518) Pierwszy dzień')  

        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=details)
        self.assertEqual(event.get_title(), u'Na dobre i na złe [od 12 lat]')  # with age
        self.assertEqual(event.get_subtitle(), u"Pierwszy dzień")
        self.assertEqual(event.get_episode_num(), "518")
        self.assertEqual(event.get_filename(), u'Na dobre i na złe [od 12 lat] (518) Pierwszy dzień')  

        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 = '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')
    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')