Exemplo n.º 1
0
    def perform(self, query):
        self.checkValid(query)
        self.query = query

        ep = query.find_one(Episode)

        log.debug('EpisodeTvdb: finding more info on %s' % ep)
        if ep.get('series') is None:
            raise SmewtException("EpisodeTVDB: Episode doesn't contain 'series' field: %s" % ep)

        # little hack: if we have no season number, add 1 as default season number
        # (helps for series which have only 1 season)
        if ep.get('season') is None:
            ep.season = 1

        try:
            mdprovider = TVDBMetadataProvider()
            result = mdprovider.startEpisode(ep)

        except SmewtException, e:
            # series could not be found, return a dummy Unknown series instead so we can group them somewhere
            log.warning('Could not find series for file: %s' % query.find_one(Media).filename)
            noposter = smewtDirectory('smewt', 'media', 'common', 'images', 'noposter.png')
            result = MemoryObjectGraph()
            result.Series(title = 'Unknown', loresImage = noposter, hiresImage = noposter)
Exemplo n.º 2
0
    def getSeriesPoster(self, tvdbID):
        """Return the low- and high-resolution posters of a tvdb object."""
        noposter = smewtDirectory('smewt', 'media', 'common', 'images', 'noposter.png')

        urls = self.tvdb.get_show_image_choices(tvdbID)
        posters = [url for url in urls if url[1] == 'poster']
        if posters:
            return self.savePoster(posters[0][0], 'series_%s' % tvdbID)

        else:
            log.warning('Could not find poster for tvdb ID %s' % tvdbID)
            return (noposter, noposter)
Exemplo n.º 3
0
    def perform(self, query):
        self.checkValid(query)

        log.debug('MovieTvdb: finding more info on %s' % query.find_one(Movie))
        movie = query.find_one(Movie)

        try:
            mdprovider = TVDBMetadataProvider()
            result = mdprovider.startMovie(movie.title)
        except SmewtException, e:
            # movie could not be found, return a dummy Unknown movie instead so we can group them somewhere
            log.warning('Could not find info for movie: %s' % toUtf8(query.find_one(Media).filename))
            noposter = smewtDirectory('smewt', 'media', 'common', 'images', 'noposter.png')
            result = MemoryObjectGraph()
            result.Movie(title = 'Unknown', loresImage = noposter, hiresImage = noposter)
Exemplo n.º 4
0
    def getMoviePoster(self, movieId):
        """Return the low- and high-resolution posters (if available) of an tvdb object."""
        noposter = smewtDirectory('smewt', 'media', 'common', 'images', 'noposter.png')

        m = self.tmdb.getMovieInfo(movieId)

        posters = []
        for poster in m['images'].posters:
            for key, value in poster.items():
                if key not in ['id', 'type']:
                    if value.startswith("http://"):
                      posters.append(value)


        if posters:
            return self.savePoster(posters[0], 'movie_%s' % movieId)

        else:
            log.warning('Could not find poster for tmdb ID %s' % movieId)
            return (noposter, noposter)
Exemplo n.º 5
0
    def __init__(self, *args):
        QDialog.__init__(self, *args)

        self.setWindowTitle('About Smewt')
        self.resize(400, 450)

        layout = QVBoxLayout()

        header = QFrame()
        header.setFrameShape(QFrame.StyledPanel)
        header.setFrameShadow(QFrame.Sunken)
        headerLayout = QHBoxLayout()
        icon = QLabel()
        icon.setPixmap(QPixmap(smewtDirectory('smewt', 'icons', 'smewt_64x64.png')))
        headerLayout.addWidget(icon)
        headerLayout.addWidget(QLabel('<h2>Smewt</h2><p><b>Version:</b> %s</p>' % smewt.__version__))
        headerLayout.addStretch()
        header.setLayout(headerLayout)

        tabs = QTabWidget()

        aboutTab = QTextBrowser()
        aboutTab.setFrameShape(QFrame.NoFrame)
        aboutTab.setStyleSheet('QTextBrowser { background:transparent }')
        aboutTab.setOpenExternalLinks(True)
        aboutTab.setHtml('<p><b>A Smart media manager</b></p>'
                         ''
                         '<p>&copy;2008-2012 by the Smewt developers</p>'
                         '<a href="http://www.smewt.com">http://www.smewt.com</a><br/>'
                         ''
                         '<p>Smewt is licensed under the <a href="http://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</a> license.</p>'
                         '<p>Please use <a href="https://github.com/wackou/smewt/issues">https://github.com/wackou/smewt/issues</a> to report bugs.</p>')

        authorsTab = QTextBrowser()
        authorsTab.setFrameShape(QFrame.NoFrame)
        authorsTab.setStyleSheet('QTextBrowser { background:transparent }')
        authorsTab.setOpenExternalLinks(True)
        authorsTab.setHtml('Smewt is developed by:'
                           '<dl>'
                           '<dt><b>Nicolas Wack</b></dt>'
                           '<dd><a href="mailto:[email protected]">[email protected]</a><br/>'
                           'Project Founder, Lead Developer</dd>'
                           '<dt><b>Ricard Marxer</b></dt>'
                           '<dd><a href="mailto:[email protected]">[email protected]</a><br/>'
                           'Lead Developer</dd>'
                           '</dl>')


        thanksTab = QTextBrowser()
        thanksTab.setFrameShape(QFrame.NoFrame)
        thanksTab.setStyleSheet('QTextBrowser { background:transparent }')
        thanksTab.setOpenExternalLinks(True)
        thanksTab.setHtml('Special thanks go to:<br/>'
                          '<dl>'
                          '<dt><b><a href=\"http://www.oxygen-icons.org\">The Oxygen Team</a></b></dt>'
                          '<dd>for most of the icons in Smewt and on the website</dd>'
                          '<dt><b><a href="http://www.openclipart.org/user-detail/papapishu">Papapishu</a></b></dt>'
                          '<dd>for the <a href="http://www.openclipart.org/detail/23677">Fried egg</a> icon</dd>'
                          '<dt><b><a href="http://famfamfam.com/">Mark James</a></b></dt>'
                          '<dd>for the <a href="http://famfamfam.com/lab/icons/flags/">flag icons</a></dd>'
                          '<dt><b><a href="http://www.davehylands.com/">Dave Hylands</a></b></dt>'
                          '<dd>for the <a href="http://www.davehylands.com/Software/Open/">open.exe</a> utility on Windows</dd>')


        tabs.addTab(aboutTab, 'About')
        tabs.addTab(authorsTab, 'Authors')
        tabs.addTab(thanksTab, 'Thanks to')

        closeLayout = QHBoxLayout()
        closeLayout.addStretch()
        closeButton = QPushButton('Close')
        QObject.connect(closeButton, SIGNAL('clicked()'), self.accept)
        closeLayout.addWidget(closeButton)


        layout.addWidget(header)
        layout.addWidget(tabs)
        layout.addLayout(closeLayout)

        self.setLayout(layout)