~ubuntu-branches/ubuntu/quantal/griffith/quantal

« back to all changes in this revision

Viewing changes to lib/plugins/extensions/ge_movieposterdb.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2011-12-18 21:15:25 UTC
  • mfrom: (1.1.17) (3.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20111218211525-endbgt82m3jh9gde
Tags: 0.13-1
* New upstream release
* VCS-* fields removed (berlios will be shutdown)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- coding: UTF-8 -*-
2
2
 
3
 
__revision__ = '$Id: ge_movieposterdb.py 1384 2010-01-05 22:24:53Z piotrek $'
 
3
__revision__ = '$Id: ge_movieposterdb.py 1568 2011-08-10 20:08:12Z mikej06 $'
4
4
 
5
5
# Copyright © 2010 Michael Jahn
6
6
#
42
42
    api = 1
43
43
    enabled = True
44
44
 
45
 
    toolbar_icon = 'gtk-network'
 
45
    toolbar_icon = 'ge_movieposterdb.png'
46
46
 
47
47
    baseurltitle = 'http://www.movieposterdb.com/embed.inc.php?movie_title=%s'
48
48
    baseurltitleyear = 'http://www.movieposterdb.com/embed.inc.php?movie_title=%s[%s]'
75
75
            data = False
76
76
            if o_title:
77
77
                if movie.year:
78
 
                    url = self.baseurltitleyear % (quote(o_title), movie.year)
 
78
                    url = self.baseurltitleyear % (o_title, movie.year)
79
79
                    data = self._get(url, self.widgets['window'])
80
80
                    if data:
81
81
                        largeurl = gutils.trim(data, 'src=\\"', '\\"').replace('/t_', '/l_')
82
82
                if not data or not largeurl:
83
 
                    url = self.baseurltitle % quote(o_title)
 
83
                    url = self.baseurltitle % o_title
84
84
                    data = self._get(url, self.widgets['window'])
85
85
                    if data:
86
86
                        largeurl = gutils.trim(data, 'src=\\"', '\\"').replace('/t_', '/l_')
87
87
            if not data or not largeurl and title and title != o_title:
88
88
                if movie.year:
89
 
                    url = self.baseurltitleyear % (quote(title), movie.year)
 
89
                    url = self.baseurltitleyear % (title, movie.year)
90
90
                    data = self._get(url, self.widgets['window'])
91
91
                    if data:
92
92
                        largeurl = gutils.trim(data, 'src=\\"', '\\"').replace('/t_', '/l_')
93
93
                if not data or not largeurl:
94
 
                    url = self.baseurltitle % quote(title)
 
94
                    url = self.baseurltitle % title
95
95
                    data = self._get(url, self.widgets['window'])
96
96
                    if data:
97
97
                        largeurl = gutils.trim(data, 'src=\\"', '\\"').replace('/t_', '/l_')
118
118
        loader = gtk.gdk.PixbufLoader()
119
119
        loader.write(data, len(data))
120
120
        loader.close()
 
121
        # show before set_from_pixbuf because it doesn't resize otherwise
 
122
        self.widgets['poster_window'].show()
121
123
        handler = self.widgets['big_poster'].set_from_pixbuf(loader.get_pixbuf())
122
 
        self.widgets['poster_window'].show()
123
124
        result = gutils.question(_("Do you want to use this poster instead?"), self.widgets['window'])
124
125
        self.widgets['poster_window'].hide()
125
126
        return result