Beispiel #1
0
		private Season findSeasonOnList(int number) {
			List<Season> list = more.getSeasons();
			for (Season s : list) {
				if (s.getSeasonNumber() == number) {
					return s;
				}
			}
			return null;
		}
Beispiel #2
0
		public void endElement(String uri, String localName, String qName) {
			if (!empty) {
				if (parentElement.equals("Series") && qName.equalsIgnoreCase("Airs_DayOfWeek")) {
					more.setAirsDayOfWeek(temp);
				} else if (parentElement.equals("Series") && qName.equalsIgnoreCase("Airs_Time")) {
					more.setAirsTime(temp);
				} else if (parentElement.equals("Series") && qName.equalsIgnoreCase("Genre")) {
					more.setGenre(temp);
				} else if (parentElement.equals("Series") && qName.equalsIgnoreCase("Network")) {
					more.setNetwork(temp);
				} else if (parentElement.equals("Series") && qName.equalsIgnoreCase("Rating")) {
					more.setRating(new BigDecimal(temp));
				} else if (parentElement.equals("Series") && qName.equalsIgnoreCase("RatingCount")) {
					more.setRatingCount(Integer.parseInt(temp));
				} else if (parentElement.equals("Series") && qName.equalsIgnoreCase("Status")) {
					more.setStatus(temp);
				} else if (parentElement.equals("Series") && qName.equalsIgnoreCase("Runtime")) {
					more.setRunTime(Integer.parseInt(temp));
				} 
				// PARSOWANIE ODCINKOW
				else if (parentElement.equals("Episode") && qName.equalsIgnoreCase("EpisodeNumber")) {
					episode.setNumber(Integer.parseInt(temp));
				} else if (parentElement.equals("Episode") && qName.equalsIgnoreCase("SeasonNumber")) {
					int seasonNumber = Integer.parseInt(temp);
					Season season = findSeasonOnList(seasonNumber);
					if (season == null) {
						season = new Season(seasonNumber);
						more.addSeason(season);
					}
					season.addEpisode(episode);
				} else if (parentElement.equals("Episode") && qName.equalsIgnoreCase("EpisodeName")) {
					episode.setName(temp);
				} else if (parentElement.equals("Episode") && qName.equalsIgnoreCase("FirstAired")) {
					SimpleDateFormat dateParser = new SimpleDateFormat("yyyy-MM-dd");
					try {
						episode.setAirDate(dateParser.parse(temp));
					} catch (ParseException e) {}
					
				} else if (parentElement.equals("Episode") && qName.equalsIgnoreCase("Overview")) {
					episode.setOveriview(temp);
				} else if (parentElement.equals("Episode") && qName.equalsIgnoreCase("filename")) {
					episode.setArtwork(temp);
				}
			}
		}