Changeset 1860

Show
Ignore:
Timestamp:
02/11/08 19:21:47 (2 months ago)
Author:
duncan
svm:headrev:

cc3e1ea1-1e01-0410-8d68-8b121e83a9d5:11142
Message:

[ 2214605 ] imdb searches fails
Fix applied

Location:
freevo
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • freevo/ChangeLog

    r1849 r1860  
    2929 * Fixed headlines plug-in to ignore items without a title, etc. (B#2183225) 
    3030 * Fixed imdb helper to correctly handle dates when available (B#2075291) 
     31 * Fixed imdb search when a season is specified but no episode (B#2214605) 
    3132 * Fixed joy plug-in to remove any pending events when enabled (B#1916407) 
    3233 * Fixed mplayer crash when auto cropping is enabled (B#2089592) 
  • freevo/src/util/fxdimdb.py

    r1764 r1860  
    141141 
    142142        # find <season>X<episode> 
     143        season = '' 
     144        episode = '' 
    143145        m = re.compile('([0-9]+)[xX]([0-9]+)') 
    144146        res = m.search(name) 
     
    256258        self.id = id 
    257259 
    258         if season and episode: 
     260        if season is None or episode is None: 
     261            episodeid = None 
     262        else: 
    259263            # This is a TV series, lets use a special search 
    260             url = 'http://us.imdb.com/title/tt%s/episodes' % id 
     264            url = 'http://www.imdb.com/title/tt%s/episodes' % id 
    261265            req = urllib2.Request(url, txdata, txheaders) 
    262266 
    263267            try: 
    264268                idpage = urllib2.urlopen(req) 
    265             except urllib2.HTTPError, error: 
    266                 raise FxdImdb_Net_Error("IMDB unreachable" + error) 
     269            except urllib2.HTTPError, why: 
     270                raise FxdImdb_Net_Error('IMDB unreachable' + str(why)) 
    267271 
    268272            episodeid = self.find_episode(idpage, id, season, episode) 
     
    270274 
    271275        # do the standard search 
    272         url = 'http://us.imdb.com/title/tt%s' % episodeid 
     276        url = 'http://www.imdb.com/title/tt%s' % id 
    273277        req = urllib2.Request(url, txdata, txheaders) 
    274278 
    275279        try: 
    276280            idpage = urllib2.urlopen(req) 
    277         except urllib2.HTTPError, error: 
    278             raise FxdImdb_Net_Error("IMDB unreachable" + error) 
     281        except urllib2.HTTPError, why: 
     282            raise FxdImdb_Net_Error('IMDB unreachable' + str(why)) 
    279283 
    280284        self.parse_data(idpage, id, episodeid, season, episode) 
  • freevo/src/video/plugins/imdb.py

    r1772 r1860  
    146146                except UnicodeError, e: 
    147147                    print e 
    148               # if filename had a season/episode letsŽ grab it 
    149             self.season = fxd.season 
    150             self.episode = fxd.episode 
    151  
    152         except Exception, e: 
    153             print 'imdb_search:', e 
     148            # if filename had a season/episode lets' grab it 
     149            self.season = hasattr(fxd, 'season') and fxd.season or '' 
     150            self.episode = hasattr(fxd, 'episode') and fxd.episode or '' 
     151 
     152        except urllib2.HTTPError, why: 
     153            _debug_('%s', (why,), DWARNING) 
    154154            box.destroy() 
    155             box = PopupBox(text=_('Unknown error while connecting to IMDB')) 
     155            box = PopupBox(text=_('Connecting to IMDB failed:') + str(why)) 
    156156            box.show() 
    157157            time.sleep(2) 
     
    160160 
    161161        # for d in duplicates: 
    162         #     items = [ menu.MenuItem('Add to "%s"' % d.name, 
    163         #                             self.imdb_add_to_fxd, (d, 'add')), 
    164         #               menu.MenuItem('Variant to "%s"' % d.name, 
    165         #                             self.imdb_add_to_fxd, (d, 'variant')) ] + items 
     162        #     items = [ 
     163        #         menu.MenuItem('Add to "%s"' % d.name, self.imdb_add_to_fxd, (d, 'add')), 
     164        #         menu.MenuItem('Variant to "%s"' % d.name, self.imdb_add_to_fxd, (d, 'variant')) 
     165        #     ] + items 
    166166 
    167167        box.destroy()