def set_season_info(self): """Sets the info for the current season in the display window""" series_id = dbTV.get_series_id(self.series_name) season_list = dbTV.make_episodes_list(series_id, self.season_number) model = SeasonListModel(season_list) self.ui.listView_season_episode_full.setModel(model) self.selected_season_poster = dbTV.get_selected_banner_url(\ series_id, 'season', self.season_number) if not self.selected_season_poster == "": filename = TVDB.retrieve_banner(self.selected_season_poster) season_poster_pixmap = QtGui.QPixmap(filename).scaled(300, 450,\ QtCore.Qt.KeepAspectRatio) self.ui.label_season_poster.setPixmap(season_poster_pixmap) else: self.ui.label_season_poster.clear() self.ui.label_season_poster.setText("No season poster selected") self.selected_season_banner_wide = dbTV.get_selected_banner_url(\ series_id, 'seasonwide', self.season_number) if not self.selected_season_banner_wide == "": filename = TVDB.retrieve_banner(self.selected_season_banner_wide) season_banner_wide_pixmap = \ QtGui.QPixmap(filename).scaledToHeight(140) self.ui.label_season_banner_wide.setPixmap(\ season_banner_wide_pixmap) else: self.ui.label_season_banner_wide.clear() self.ui.label_season_banner_wide.setText(\ "No season wide banner selected")
def set_season_banners_wide(self): """Downloads the wide banners for a season and displays them""" #Season Wide Banners Tab season_banners_wide = [] self.progress.setLabelText("Downloading Season Wide Banners...") self.progress.setMaximum(len(self.season_banners_wide_url)) for banner_url in self.season_banners_wide_url: self.progress.setValue( \ self.season_banners_wide_url.index(banner_url)) filename = TVDB.retrieve_banner(str(banner_url)) banner_pixmap = QtGui.QPixmap(filename).scaledToHeight(140) season_banners_wide.append((banner_pixmap, banner_url)) banner_model_season_wide = BannerWideModel(season_banners_wide) self.ui.tableView.setModel(banner_model_season_wide) self.ui.tableView.resizeColumnsToContents() self.ui.tableView.resizeRowsToContents() self.ui.tableView.verticalHeader().hide() self.ui.tableView.horizontalHeader().hide() self.progress.setValue(len(self.season_banners_wide_url))
def set_season_banners(self): """Downloads the posters for a season and displays them""" #Season Posters Tab season_banners = [] self.progress.setLabelText("Downloading Season Posters...") self.progress.setMaximum(len(self.season_banners_url)) for banner_url in self.season_banners_url: self.progress.setValue(self.season_banners_url.index(banner_url)) filename = TVDB.retrieve_banner(str(banner_url).replace( \ 'banners/', 'banners/_cache/')) banner_pixmap = QtGui.QPixmap(filename).scaledToHeight(450) season_banners.append((banner_pixmap, banner_url)) banner_model_season = BannerModel(season_banners) self.ui.tableView.setModel(banner_model_season) self.ui.tableView.resizeColumnsToContents() self.ui.tableView.resizeRowsToContents() self.ui.tableView.verticalHeader().hide() self.ui.tableView.horizontalHeader().hide() self.progress.setValue(len(self.season_banners_url))
def set_series_fanart(self): """Downloads the series fanart and displays it""" #Fanart series_fanart_banners = [] self.progress.setLabelText("Downloading Series Fanart...") self.progress.setMaximum(len(self.series_fanart_banners_url)) for banner_url in self.series_fanart_banners_url: self.progress.setValue( \ self.series_fanart_banners_url.index(banner_url)) filename = TVDB.retrieve_banner(str(banner_url)) banner_pixmap = QtGui.QPixmap(filename) series_fanart_banners.append((banner_pixmap, banner_url)) banner_model_series_fanart = BannerModel(series_fanart_banners) self.ui.tableView.setModel(banner_model_series_fanart) self.ui.tableView.resizeColumnsToContents() self.ui.tableView.resizeRowsToContents() self.ui.tableView.verticalHeader().hide() self.ui.tableView.horizontalHeader().hide() self.progress.setValue(len(self.series_fanart_banners_url))
def set_episode_info_from_dom(self, dom): """Sets the info for the show in the display window""" episode_root = dom.firstChildElement('episodedetails') #Extract the details and fill in the display elem_episode_title = episode_root.firstChildElement('title') episode_title = elem_episode_title.text() self.ui.line_episode_name.setText(episode_title) elem_episode_plot = episode_root.firstChildElement('plot') episode_plot = QtCore.QString(elem_episode_plot.text()) self.ui.text_episode_plot.setPlainText(episode_plot) elem_episode_thumb = episode_root.firstChildElement('thumb') if not elem_episode_thumb.isNull(): episode_thumb = elem_episode_thumb.text() else: episode_thumb = "none" #Set the preview image image_file = TVDB.retrieve_banner(str(episode_thumb)) if image_file is not None: image = QtGui.QPixmap(image_file) self.ui.label_episode_thumb.setPixmap(image) elem_episode_airdate = episode_root.firstChildElement('aired') episode_airdate = elem_episode_airdate.text() self.ui.line_airdate.setText(episode_airdate) elem_episode_id = episode_root.firstChildElement('id') episode_id = elem_episode_id.text() self.ui.line_tvdb_id.setText(episode_id) elem_episode_rating = episode_root.firstChildElement('rating') episode_rating = elem_episode_rating.text() self.ui.line_tvdb_rating.setText(episode_rating) elem_episode_directors = episode_root.firstChildElement('director') episode_directors = unicode(elem_episode_directors.text(), \ "latin-1").split('|') self.ui.combo_directors.clear() for director in episode_directors: self.ui.combo_directors.addItem(director) elem_episode_writers = episode_root.firstChildElement('credits') episode_writers = unicode(elem_episode_writers.text(), \ "latin-1").split('|') self.ui.combo_writers.clear() for writer in episode_writers: self.ui.combo_writers.addItem(writer) episode_actors = [] elem_episode_actor = episode_root.firstChildElement('actor') self.ui.combo_guests.clear() while not elem_episode_actor.isNull(): elem_episode_actor_name = \ elem_episode_actor.firstChildElement('name') episode_actor_name = elem_episode_actor_name.text() episode_actors.append(episode_actor_name) elem_episode_actor = elem_episode_actor.nextSiblingElement('actor') episode_actors = set(episode_actors) for episode_actor in episode_actors: if self.ui.combo_actors.findText(episode_actor) < 0: self.ui.combo_guests.addItem(episode_actor) self.ui.tabWidget_tv_info.setCurrentIndex(3)
def set_series_info_from_dom(self, series_doc, tab_index): """Sets the info for the current series in the display window""" series_root = series_doc.firstChildElement('tvshow') #Extract the details and fill in the display elem_series_name = series_root.firstChildElement('title') series_name = elem_series_name.text() self.ui.lineEdit_series_name.setText(series_name) elem_series_plot = series_root.firstChildElement('plot') series_plot = QtCore.QString(elem_series_plot.text()) self.ui.plainTextEdit_overview.setPlainText(series_plot) series_actors = [] self.ui.combo_actors.clear() elem_series_actor = series_root.firstChildElement('actor') while not elem_series_actor.isNull(): elem_series_actor_name = \ elem_series_actor.firstChildElement('name') series_actor_name = elem_series_actor_name.text() if not series_actor_name in series_actors: series_actors.append(series_actor_name) elem_series_actor = elem_series_actor.nextSiblingElement('actor') series_actors.sort() for series_actor in series_actors: self.ui.combo_actors.addItem(series_actor) elem_series_network = series_root.firstChildElement('network') series_network = elem_series_network.text() self.ui.lineEdit_network.setText(series_network) elem_series_airs_day = series_root.firstChildElement('airsday') series_airs_day = elem_series_airs_day.text() elem_series_airs_time = series_root.firstChildElement('airstime') series_airs_time = elem_series_airs_time.text() if not series_airs_day == '': series_airtime = series_airs_day + " at " + series_airs_time else: series_airtime = '' self.ui.lineEdit_airtime.setText(series_airtime) elem_series_runtime = series_root.firstChildElement('runtime') series_runtime = elem_series_runtime.text() self.ui.lineEdit_runtime.setText(series_runtime) elem_series_status = series_root.firstChildElement('status') series_status = elem_series_status.text() self.ui.lineEdit_status.setText(series_status) series_id = dbTV.get_series_id(self.series_name) self.ui.lineEdit_tvdb_series_id.setText(str(series_id)) self.selected_series_poster = \ dbTV.get_selected_banner_url(series_id, 'poster', '') if not self.selected_series_poster == "": filename = TVDB.retrieve_banner(self.selected_series_poster) series_poster_pixmap = QtGui.QPixmap(filename).scaledToHeight(450) self.ui.label_series_banner.setPixmap(series_poster_pixmap) else: self.ui.label_series_banner.clear() self.ui.label_series_banner.setText("No series poster selected") self.selected_series_wide_banner = \ dbTV.get_selected_banner_url(series_id, 'series', '') if not self.selected_series_wide_banner == "": filename = TVDB.retrieve_banner(self.selected_series_wide_banner) series_wide_pixmap = QtGui.QPixmap(filename).scaledToHeight(140) self.ui.label_banner_wide.setPixmap(series_wide_pixmap) else: self.ui.label_banner_wide.clear() self.ui.label_banner_wide.setText("No series wide banner selected") self.selected_series_fanart = \ dbTV.get_selected_banner_url(series_id, 'fanart', '') if not self.selected_series_fanart == "": filename = TVDB.retrieve_banner(self.selected_series_fanart) series_fanart_pixmap = QtGui.QPixmap(filename).scaledToHeight(480) self.ui.label_series_fanart.setPixmap(series_fanart_pixmap) else: self.ui.label_series_fanart.clear() self.ui.label_series_fanart.setText("No fanart selected") self.ui.tabWidget_tv_info.setCurrentIndex(tab_index)