Exemplo n.º 1
0
    def getWidgetOneLineInfoCountries(self, media, scale):
        country_list = ", ".join(
            [_("country_" + c) for c in self.getCountries()])

        layout = QHBoxLayout()
        layout.setAlignment(Qt.AlignLeft)
        layout.setSpacing(1)
        layout.setContentsMargins(0, 0, 0, 0)

        widget = QWidget()
        widget.setLayout(layout)

        if country_list:

            key_label = QLabel(_('title_country') + ": ")
            key_label.setFont(
                QFont(PANEL_FONT_TYPE,
                      PANEL_FONT_SIZE * scale,
                      weight=QFont.Normal))
            layout.addWidget(key_label)

            value_label = QLabel(country_list)
            value_label.setFont(
                QFont(PANEL_FONT_TYPE,
                      PANEL_FONT_SIZE * scale,
                      weight=QFont.Bold))
            layout.addWidget(value_label)

        return widget
Exemplo n.º 2
0
    def getWidgetOneLineInfoSounds(self, media, scale):
        sound_list = self.getTranslatedSoundStringList()
        layout = QHBoxLayout()
        layout.setAlignment(Qt.AlignLeft)
        layout.setSpacing(1)
        layout.setContentsMargins(0, 0, 0, 0)

        widget = QWidget()
        widget.setLayout(layout)

        if sound_list:

            key_label = QLabel(_('title_sound') + ": ")
            key_label.setFont(
                QFont(PANEL_FONT_TYPE,
                      PANEL_FONT_SIZE * scale,
                      weight=QFont.Normal))
            layout.addWidget(key_label)

            value_label = QLabel(sound_list)
            value_label.setFont(
                QFont(PANEL_FONT_TYPE,
                      PANEL_FONT_SIZE * scale,
                      weight=QFont.Bold))
            layout.addWidget(value_label)
        return widget
Exemplo n.º 3
0
    def getWidgetOneLineInfoLength(self, media, scale):
        layout = QHBoxLayout()
        layout.setAlignment(Qt.AlignLeft)
        layout.setSpacing(1)
        layout.setContentsMargins(0, 0, 0, 0)

        widget = QWidget()
        widget.setLayout(layout)

        if self.getLength():

            key_label = QLabel(_('title_length') + ": ")
            key_label.setFont(
                QFont(PANEL_FONT_TYPE,
                      PANEL_FONT_SIZE * scale,
                      weight=QFont.Normal))
            layout.addWidget(key_label)

            value_label = QLabel(self.getLength())
            value_label.setFont(
                QFont(PANEL_FONT_TYPE,
                      PANEL_FONT_SIZE * scale,
                      weight=QFont.Bold))
            layout.addWidget(value_label)

        return widget
Exemplo n.º 4
0
    def getTranslatedSoundStringList(self, category=None):
        """
        Returns back the Sounds list in the respective language.
        _________________________________________________________________________________________________
        input:
        """
        sound_list = ", ".join([_("lang_" + s) for s in self.getSounds()])

        return sound_list
Exemplo n.º 5
0
    def getTranslatedThemeList(self, category=None):
        """
        Returns back the Theme list in the respective language.
        _________________________________________________________________________________________________
        input:
        """
        pre = "theme_"
        themes = [(_(pre + t), t) for t in self.getThemes()]

        return themes
Exemplo n.º 6
0
    def getTranslatedRecipeTypeList(self, category, rawRecipeTypeList=None):
        """
        Returns back the RecipeType list in the respective language.
        _________________________________________________________________________________________________
        input:
                category:    movie, music, show, presentation, alternative, miscellaneous, radioplay, audiobook
        output:
                [(translated, raw), (translated, raw), ... ]
        """
        pre = "recipetype_"
        recipetypes = [(_(pre + g), g) for g in self.getRecipeTypes()]

        return recipetypes
Exemplo n.º 7
0
    def getTranslatedGenreList(self, category, rawGenreList=None):
        """
        Returns back the Genres list in the respective language.
        _________________________________________________________________________________________________
        input:
                category:    movie, music, show, presentation, alternative, miscellaneous, radioplay, audiobook
        output:
                [(translated, raw), (translated, raw), ... ]
        """
        #        pre = "genre" + ("_" + category if category is not None and category == "music" else "" ) + "_"
        pre = "genre_"
        genres = [(_(pre + g), g) for g in self.getGenres()]

        return genres
Exemplo n.º 8
0
            def addStorylineWidget(self, storyline_widget, title_id):
                if storyline_widget:

                    if self.hasGeneral:
                        self.grid_layout.addWidget(QHLine(), self.row, 0, 1, 2)
                        self.row = self.row + 1

                    widget_key = QLabel(_(title_id) + ":", )
                    widget_key.setFont(
                        QFont(PANEL_FONT_TYPE,
                              PANEL_FONT_SIZE * scale,
                              weight=QFont.Bold))
                    widget_key.setAlignment(Qt.AlignTop)

                    self.grid_layout.addWidget(widget_key, self.row, 0)
                    self.grid_layout.addWidget(storyline_widget, self.row, 1)
                    self.row = self.row + 1
Exemplo n.º 9
0
            def addTagWidget(self, tag_widget, title_id):
                if tag_widget:

                    self.tag_widget = tag_widget

                    self.grid_layout.addWidget(QHLine(), self.row, 0, 1, 2)
                    self.row = self.row + 1

                    widget_key = QLabel(_(title_id) + ":", )
                    widget_key.setFont(
                        QFont(PANEL_FONT_TYPE,
                              PANEL_FONT_SIZE * scale,
                              weight=QFont.Bold))
                    widget_key.setAlignment(Qt.AlignTop)

                    self.grid_layout.addWidget(widget_key, self.row, 0)
                    self.grid_layout.addWidget(tag_widget, self.row, 1)
                    self.row = self.row + 1
Exemplo n.º 10
0
            def addQlinkSimpleWidget(self, media, scale, title_id,
                                     value_method):
                value = value_method()

                if value:
                    self.hasGeneral = True

                    widget_key = QLabel(_(title_id) + ":", )
                    widget_key.setFont(
                        QFont(PANEL_FONT_TYPE,
                              PANEL_FONT_SIZE * scale,
                              weight=QFont.Bold))
                    widget_key.setAlignment(Qt.AlignTop)

                    layout = FlowLayout()
                    layout.setAlignment(Qt.AlignLeft)
                    layout.setSpacing(1)
                    layout.setContentsMargins(0, 0, 0, 0)

                    widget_value = QWidget()
                    widget_value.setLayout(layout)
                    widget_value.setFont(
                        QFont(PANEL_FONT_TYPE,
                              PANEL_FONT_SIZE * scale,
                              weight=QFont.Normal))
                    first = True
                    for d in value:
                        if not first:
                            comma_label = QLabel(", ")
                            comma_label.setFont(
                                QFont(PANEL_FONT_TYPE,
                                      PANEL_FONT_SIZE * scale,
                                      weight=QFont.Normal))
                            layout.addWidget(comma_label)
                        label = IniGeneral.QLinkLabelToSearch(
                            media, scale, d, d, title_id)
                        layout.addWidget(label)
                        first = False

                    self.grid_layout.addWidget(widget_key, self.row, 0)
                    self.grid_layout.addWidget(widget_value, self.row, 1)
                    self.row = self.row + 1
Exemplo n.º 11
0
            def addQlinkTranslatedWidget(self, media, scale, title_id,
                                         element_list):

                if element_list:
                    self.hasGeneral = True

                    widget_key = QLabel(_(title_id) + ":", )
                    widget_key.setFont(
                        QFont(PANEL_FONT_TYPE,
                              PANEL_FONT_SIZE * scale,
                              weight=QFont.Bold))

                    layout_genres = QHBoxLayout()
                    layout_genres.setAlignment(Qt.AlignLeft)
                    layout_genres.setSpacing(1)
                    layout_genres.setContentsMargins(0, 0, 0, 0)

                    widget_value = QWidget()
                    widget_value.setLayout(layout_genres)
                    widget_value.setFont(
                        QFont(PANEL_FONT_TYPE,
                              PANEL_FONT_SIZE * scale,
                              weight=QFont.Normal))
                    first = True

                    for d, e in element_list:
                        if not first:
                            comma_label = QLabel(", ")
                            comma_label.setFont(
                                QFont(PANEL_FONT_TYPE,
                                      PANEL_FONT_SIZE * scale,
                                      weight=QFont.Normal))
                            layout_genres.addWidget(comma_label)
                        label = IniGeneral.QLinkLabelToSearch(
                            media, scale, d, e, title_id)
                        layout_genres.addWidget(label)
                        first = False

                    self.grid_layout.addWidget(widget_key, self.row, 0)
                    self.grid_layout.addWidget(widget_value, self.row, 1)
                    self.row = self.row + 1
Exemplo n.º 12
0
    def getOrderTitle(self, media):
        """
        Returns back the modified title with episodes and seasons if there is
        
        if no season no episode (simple movie)
            getTranslatedTitle()
        
        if episode + no season in the parent Collector (miniseries/saga)
            Parents_Collector.getTranslatedTitle() {episode} getTranslatedTitle()
            
        if episode + season in the parent Collector (series)
            Parent's_Parent's_Collector.getTranslatedTitle() (S{season}E{episode}) getTranslatedTitle()
        """
        formatted_title = self.getTranslatedTitle()
        parent_collector = media.getParentCollector()

        if parent_collector:
            media_media = media.control.getMedia()
            media_category = media.control.getCategory()

            episode = media.general.getEpisode()
            track = media.general.getTrack()
            volume = media.general.getVolume()
            part = media.general.getPart()

            parent_season = parent_collector.general.getSeason()
            parent_album = parent_collector.general.getAlbum().zfill(
                4) + parent_collector.getTranslatedTitle(
                ) if parent_collector.general.getAlbum() else None
            parent_parent_collector = parent_collector.getParentCollector()
            parent_book = parent_collector.general.getBook()

            from medlib.mediamodel.media_collector import MediaCollector

            # if media is Collector
            if issubclass(media.__class__, MediaCollector):
                season = media.general.getSeason()
                album = media.general.getAlbum()
                book = media.general.getBook()

                # Season (the season real title is omitted)
                if season:
                    formatted_title = _("title_season").format(season.zfill(4))

                # Album
                elif album:
                    formatted_title = album + "-" + formatted_title

                # Book
                elif book:
                    formatted_title = book + "-" + formatted_title

            # does not matter what media is that if it has "part"
            elif part:

                #formatted_title = _("title_part").format(part.zfill(4)) + formatted_title
                parent_title = parent_collector.getTranslatedTitle()

                if parent_title != self.getTranslatedTitle(
                ) and config_ini["keep_hierarchy"] == "n":
                    formatted_title = parent_title + "-" + _(
                        "title_part").format(part.zfill(4)) + formatted_title
                else:
                    formatted_title = _("title_part").format(
                        part.zfill(4)) + formatted_title

            # video/audio + music
            elif media_category == 'music':

                # There is Track but not in Album
                if track and not parent_album:
                    parent_title = parent_collector.getTranslatedTitle()

                    formatted_title = track.zfill(4) + formatted_title

                    if config_ini["keep_hierarchy"] == "n":
                        formatted_title = parent_title + ": " + formatted_title

                # Track in Album
                elif track and parent_album:
                    formatted_title = track.zfill(4) + ". " + formatted_title

                    parent_parent_collector = parent_collector.getParentCollector(
                    )
                    performer_title = parent_parent_collector.getTranslatedTitle(
                    )

                    # bulk list - The Album title is not visible - you have to attache it
                    if config_ini["keep_hierarchy"] == "n":
                        formatted_title = performer_title + ": (" + parent_album + ") " + formatted_title

            # video
            elif media_media == 'video':

                # MOVIE
                if True:  #media_category == 'movie':

                    # There is Episode but not in Season => Miniseries/Universe/film with multi parts
                    if episode and not parent_season:
                        #formatted_title = formatted_title + _("title_part").format(episode.zfill(4))
                        parent_title = parent_collector.getTranslatedTitle()

                        # Miniseries / Universe
                        if config_ini[
                                "keep_hierarchy"] == "n" and parent_title != self.getTranslatedTitle(
                                ):
                            formatted_title = parent_title + ": " + _(
                                "title_part").format(
                                    episode.zfill(4)) + formatted_title

                        # Movie in multi episodes
                        else:
                            formatted_title = _("title_part").format(
                                episode.zfill(4)) + formatted_title

                    # Episode in Season => Series
                    elif episode and parent_season:
                        formatted_title = "(S" + parent_season.zfill(
                            2) + "E" + episode.zfill(2) + ")" + formatted_title

                        parent_parent_collector = parent_collector.getParentCollector(
                        )
                        series_title = parent_parent_collector.getTranslatedTitle(
                        )

                        # bulk list - The series title is not visible - you have to attache it
                        if config_ini["keep_hierarchy"] == "n":
                            formatted_title = series_title + ": " + formatted_title

            # text
            elif media_media == 'text' or media_media == 'audio':

                # BOOK
                if media_category == 'book' or media_category == 'audiobook':

                    # There is Volume but not in Book
                    if volume and not parent_book:
                        formatted_title = volume.zfill(4) + formatted_title
                        author_title = parent_collector.getTranslatedTitle()

                        if config_ini["keep_hierarchy"] == "n":
                            formatted_title = author_title + ": " + formatted_title

                    # Volume in Book
                    elif volume and parent_book:
                        book_title = parent_collector.getTranslatedTitle()
                        parent_parent_collector = parent_collector.getParentCollector(
                        )
                        author_title = parent_parent_collector.getTranslatedTitle(
                        )

                        if config_ini["keep_hierarchy"] == "n":
                            formatted_title = author_title + ": " + parent_book.zfill(
                                4) + " (" + book_title + " " + volume.zfill(
                                    4) + ".)" + formatted_title
                        else:
                            formatted_title = volume.zfill(4) + formatted_title

                    # Normal book in off-hierarchy
                    elif config_ini["keep_hierarchy"] == "n":
                        author_title = parent_collector.getTranslatedTitle()
                        formatted_title = author_title + ": " + formatted_title

        return formatted_title
Exemplo n.º 13
0
    def getFormattedTitle(self, media):
        """
        Returns back the modified title with episodes and seasons if there is
        
        """

        formatted_title = self.getTranslatedTitle()
        parent_collector = media.getParentCollector()

        if parent_collector:
            media_media = media.control.getMedia()
            media_category = media.control.getCategory()

            episode = media.general.getEpisode()
            track = media.general.getTrack()
            volume = media.general.getVolume()
            part = media.general.getPart()

            parent_season = parent_collector.general.getSeason()
            parent_album = parent_collector.general.getAlbum(
            ) + "-" + parent_collector.getTranslatedTitle(
            ) if parent_collector.general.getAlbum() else None
            parent_book = parent_collector.getTranslatedTitle(
            ) + " " + parent_collector.general.getBook(
            ) + "." if parent_collector.general.getBook() else None

            from medlib.mediamodel.media_collector import MediaCollector

            # if media is Collector
            if issubclass(media.__class__, MediaCollector):
                season = media.general.getSeason()
                album = media.general.getAlbum()

                # Season
                if season:
                    formatted_title = _("title_season").format(season)

                # Album
                elif album:
                    formatted_title = album + "-" + formatted_title

                # Volume
                elif volume:
                    formatted_title = formatted_title + " " + parent_collector.general.getBook(
                    ) + "."

            # does not matter what media is that if it has "part"
            elif part:

                formatted_title = formatted_title + "-" + _(
                    "title_part").format(part)
                parent_title = parent_collector.getTranslatedTitle()

                if parent_title != self.getTranslatedTitle(
                ) and config_ini["keep_hierarchy"] == "n":
                    formatted_title = parent_title + "-" + formatted_title

            # video/audio + music
            elif media_category == 'music':

                # There is Track but not in Album
                if track and not parent_album:
                    parent_title = parent_collector.getTranslatedTitle()

                    formatted_title = formatted_title + " #" + track

                    if config_ini["keep_hierarchy"] == "n":
                        formatted_title = parent_title + ": " + formatted_title  #+ " " + track

                # Track in Album
                elif track and parent_album:
                    formatted_title = track + ". " + formatted_title

                    parent_parent_collector = parent_collector.getParentCollector(
                    )
                    performer_title = parent_parent_collector.getTranslatedTitle(
                    )

                    # bulk list - The Album title is not visible - you have to attache it
                    if config_ini["keep_hierarchy"] == "n":
                        formatted_title = performer_title + ": (" + parent_album + ") " + formatted_title

            # video
            elif media_media == 'video':

                # MOVIE
                if True:  #media_category == 'movie':

                    # There is Episode but not in Season => Miniseries/Universe/film with multi parts
                    if episode and not parent_season:
                        formatted_title = formatted_title + "-" + _(
                            "title_part").format(episode)
                        parent_title = parent_collector.getTranslatedTitle()

                        # Miniseries / Universe
                        if config_ini[
                                "keep_hierarchy"] == "n" and parent_title != self.getTranslatedTitle(
                                ):
                            formatted_title = parent_title + ": " + formatted_title

                    # Episode in Season => Series
                    elif episode and parent_season:
                        formatted_title = formatted_title + " (S" + parent_season.zfill(
                            2) + "E" + episode.zfill(2) + ")"

                        parent_parent_collector = parent_collector.getParentCollector(
                        )
                        series_title = parent_parent_collector.getTranslatedTitle(
                        )

                        # bulk list - The series title is not visible - you have to attache it
                        if config_ini["keep_hierarchy"] == "n":
                            formatted_title = series_title + ": " + formatted_title

#                    # Normal Film in off-hierarchy
#                    elif config_ini["keep_hierarchy"] == "n":
#                        formatted_title = ((", ".join(media.general.getDirectors()) + ": ") if media.general.getDirectors() else "") + formatted_title

# text
            elif media_media == 'text' or media_media == 'audio':

                # BOOK
                if media_category == 'book' or media_category == 'audiobook':

                    # There is Volume but not in Book
                    if volume and not parent_book:
                        author_title = parent_collector.getTranslatedTitle()

                        if config_ini["keep_hierarchy"] == "n":
                            formatted_title = author_title + ": " + formatted_title + " #" + volume
                        else:
                            formatted_title = formatted_title + " #" + volume

                    # Volume in Book
                    elif volume and parent_book:
                        book_title = parent_collector.getTranslatedTitle()
                        parent_parent_collector = parent_collector.getParentCollector(
                        )
                        author_title = parent_parent_collector.getTranslatedTitle(
                        )

                        if config_ini["keep_hierarchy"] == "n":
                            formatted_title = author_title + ": " + formatted_title + " (" + book_title + " " + volume + ".)"
                        else:
                            formatted_title = formatted_title + " #" + volume

                    # Normal book in off-hierarchy
                    elif config_ini["keep_hierarchy"] == "n":
                        author_title = parent_collector.getTranslatedTitle()
                        formatted_title = author_title + ": " + formatted_title

        return formatted_title