MovieJukeboxXMLReader { public boolean parseMovieXML(File xmlFile, Movie movie) { boolean forceDirtyFlag = Boolean.FALSE; Document xmlDoc; try { xmlDoc = DOMHelper.getDocFromFile(xmlFile); } catch (MalformedURLException error) { LOG.error(ERROR_FIXIT, xmlFile.getName()); LOG.error(SystemTools.getStackTrace(error)); return Boolean.FALSE; } catch (IOException error) { LOG.error(ERROR_FIXIT, xmlFile.getName()); LOG.error(SystemTools.getStackTrace(error)); return Boolean.FALSE; } catch (ParserConfigurationException | SAXException error) { LOG.error(ERROR_FIXIT, xmlFile.getName()); LOG.error(SystemTools.getStackTrace(error)); return Boolean.FALSE; } NodeList nlMovies; Node nMovie; NodeList nlElements; Node nElements; nlMovies = xmlDoc.getElementsByTagName(MOVIE); for (int loopMovie = 0; loopMovie < nlMovies.getLength(); loopMovie++) { nMovie = nlMovies.item(loopMovie); if (nMovie.getNodeType() == Node.ELEMENT_NODE) { Element eMovie = (Element) nMovie; nlElements = eMovie.getElementsByTagName("id"); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element eId = (Element) nElements; String movieDb = eId.getAttribute(MOVIEDB); if (StringTools.isNotValidString(movieDb)) { movieDb = ImdbPlugin.IMDB_PLUGIN_ID; } movie.setId(movieDb, eId.getTextContent()); } } movie.setMjbVersion(DOMHelper.getValueFromElement(eMovie, "mjbVersion")); movie.setMjbGitSHA(DOMHelper.getValueFromElement(eMovie, "mjbGitSHA")); movie.setMjbGenerationDateString(DOMHelper.getValueFromElement(eMovie, "xmlGenerationDate")); if (StringTools.isNotValidString(movie.getBaseFilename())) { movie.setBaseFilename(DOMHelper.getValueFromElement(eMovie, "baseFilenameBase")); } if (StringTools.isNotValidString(movie.getBaseName())) { movie.setBaseName(DOMHelper.getValueFromElement(eMovie, BASE_FILENAME)); } parseOverridableTitle(movie, eMovie); parseOverridableOriginalTitle(movie, eMovie); movie.setTitleSort(DOMHelper.getValueFromElement(eMovie, SORT_TITLE)); parseOverridableYear(movie, eMovie); parseOverridableReleaseDate(movie, eMovie); movie.setShowStatus(DOMHelper.getValueFromElement(eMovie, "showStatus")); nlElements = eMovie.getElementsByTagName("ratings"); if (nlElements.getLength() > 0) { nlElements = nlElements.item(0).getChildNodes(); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element eRating = (Element) nElements; String movieDb = eRating.getAttribute(MOVIEDB); if (StringTools.isNotValidString(movieDb)) { movieDb = ImdbPlugin.IMDB_PLUGIN_ID; } movie.addRating(movieDb, Integer.parseInt(eRating.getTextContent())); } } } movie.setWatchedNFO(Boolean.parseBoolean(DOMHelper.getValueFromElement(eMovie, "watchedNFO"))); movie.setWatchedFile(Boolean.parseBoolean(DOMHelper.getValueFromElement(eMovie, "watchedFile"))); movie.setPosterURL(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "posterURL"))); movie.setFanartURL(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "fanartURL"))); movie.setBannerURL(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "bannerURL"))); movie.setClearArtURL(HTMLTools.decodeHtml(DOMHelper.getValueFromElement(eMovie, "clearArtURL"))); movie.setClearLogoURL(HTMLTools.decodeHtml(DOMHelper.getValueFromElement(eMovie, "clearLogoURL"))); movie.setTvThumbURL(HTMLTools.decodeHtml(DOMHelper.getValueFromElement(eMovie, "tvThumbURL"))); movie.setSeasonThumbURL(HTMLTools.decodeHtml(DOMHelper.getValueFromElement(eMovie, "seasonThumbURL"))); movie.setMovieDiscURL(HTMLTools.decodeHtml(DOMHelper.getValueFromElement(eMovie, "movieDiscURL"))); movie.setPosterFilename(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "posterFile"))); movie.setDetailPosterFilename(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "detailPosterFile"))); movie.setThumbnailFilename(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "thumbnail"))); movie.setFanartFilename(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "fanartFile"))); movie.setBannerFilename(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "bannerFile"))); movie.setWideBannerFilename(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "wideBannerFile"))); movie.setClearArtFilename(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "clearArtFile"))); movie.setClearLogoFilename(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "clearLogoFile"))); movie.setTvThumbFilename(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "tvThumbFile"))); movie.setSeasonThumbFilename(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "seasonThumbFile"))); movie.setMovieDiscFilename(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "movieDiscFile"))); parseOverridablePlot(movie, eMovie); parseOverridableOutline(movie, eMovie); parseOverridableQuote(movie, eMovie); parseOverridableTagline(movie, eMovie); parseOverridableCompany(movie, eMovie); parseOverridableRuntime(movie, eMovie); parseOverridableTop250(movie, eMovie); nlElements = eMovie.getElementsByTagName("directors"); if (nlElements.getLength() > 0) { Element tagElement = (Element) nlElements.item(0); nlElements = tagElement.getChildNodes(); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element ePerson = (Element) nElements; movie.addDirector(ePerson.getTextContent(), tagElement.getAttribute(SOURCE)); } } } nlElements = eMovie.getElementsByTagName("writers"); if (nlElements.getLength() > 0) { Element tagElement = (Element) nlElements.item(0); nlElements = tagElement.getChildNodes(); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element ePerson = (Element) nElements; movie.addWriter(ePerson.getTextContent(), tagElement.getAttribute(SOURCE)); } } } nlElements = eMovie.getElementsByTagName("cast"); if (nlElements.getLength() > 0) { Element tagElement = (Element) nlElements.item(0); nlElements = tagElement.getChildNodes(); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element ePerson = (Element) nElements; movie.addActor(ePerson.getTextContent(), tagElement.getAttribute(SOURCE)); } } } parseOverridableCountry(movie, eMovie); nlElements = eMovie.getElementsByTagName("genres"); if (nlElements.getLength() > 0) { Element tagElement = (Element) nlElements.item(0); nlElements = tagElement.getChildNodes(); List<String> genres = new ArrayList<>(); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element eGenre = (Element) nElements; genres.add(eGenre.getTextContent()); } } movie.setGenres(genres, tagElement.getAttribute(SOURCE)); } nlElements = eMovie.getElementsByTagName("sets"); if (nlElements.getLength() > 0) { nlElements = nlElements.item(0).getChildNodes(); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element eSet = (Element) nElements; String order = eSet.getAttribute(ORDER); if (StringTools.isValidString(order)) { movie.addSet(eSet.getTextContent(), Integer.parseInt(order)); } else { movie.addSet(eSet.getTextContent()); } } } } parseOverridableCertification(movie, eMovie); parseOverridableLanguage(movie, eMovie); movie.setSubtitles(DOMHelper.getValueFromElement(eMovie, "subtitles")); movie.setTrailerExchange(DOMHelper.getValueFromElement(eMovie, "trailerExchange").equalsIgnoreCase(YES)); movie.setTrailerLastScan(DOMHelper.getValueFromElement(eMovie, TRAILER_LAST_SCAN)); parseOverridableContainer(movie, eMovie); nlElements = eMovie.getElementsByTagName("codecs"); if (nlElements.getLength() > 0) { nlElements = nlElements.item(0).getChildNodes(); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { String codecType = nElements.getNodeName(); if (nElements.getChildNodes().getLength() > 0) { for (int cLooper = 0; cLooper < nElements.getChildNodes().getLength(); cLooper++) { Node nCodec = nElements.getChildNodes().item(cLooper); if (nCodec.getNodeType() == Node.ELEMENT_NODE) { Element eCodec = (Element) nCodec; Codec codec; if (CodecType.VIDEO.toString().equalsIgnoreCase(codecType)) { codec = new Codec(CodecType.VIDEO); } else { codec = new Codec(CodecType.AUDIO); } codec.setCodecId(eCodec.getAttribute("codecId")); codec.setCodecIdHint(eCodec.getAttribute("codecIdHint")); codec.setCodecFormat(eCodec.getAttribute("format")); codec.setCodecFormatProfile(eCodec.getAttribute("formatProfile")); codec.setCodecFormatVersion(eCodec.getAttribute("formatVersion")); codec.setCodecLanguage(eCodec.getAttribute(LANGUAGE)); codec.setCodecBitRate(eCodec.getAttribute("bitrate")); String tmpValue = eCodec.getAttribute("channels"); if (StringUtils.isNotBlank(tmpValue)) { codec.setCodecChannels(Integer.parseInt(eCodec.getAttribute("channels"))); } codec.setCodec(eCodec.getTextContent().trim()); tmpValue = eCodec.getAttribute(SOURCE); if (StringTools.isValidString(tmpValue)) { codec.setCodecSource(CodecSource.fromString(tmpValue)); } else { codec.setCodecSource(CodecSource.UNKNOWN); } movie.addCodec(codec); } } } } } } parseOverridableResolution(movie, eMovie); parseOverridableVideoSource(movie, eMovie); parseOverridableVideoOutput(movie, eMovie); parseOverridableAspectRatio(movie, eMovie); parseOverridableFramesPerSecond(movie, eMovie); movie.setFirst(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "first"))); movie.setPrevious(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "previous"))); movie.setNext(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "next"))); movie.setLast(HTMLTools.decodeUrl(DOMHelper.getValueFromElement(eMovie, "last"))); String tempLibraryDescription = DOMHelper.getValueFromElement(eMovie, "libraryDescription"); if (StringTools.isNotValidString(movie.getLibraryDescription())) { movie.setLibraryDescription(tempLibraryDescription); } else if (!movie.getLibraryDescription().equals(tempLibraryDescription)) { LOG.debug("Different library description! Setting dirty INFO"); forceDirtyFlag = Boolean.TRUE; } movie.setPrebuf(Long.parseLong(DOMHelper.getValueFromElement(eMovie, "prebuf"))); nlElements = eMovie.getElementsByTagName("awards"); if (nlElements.getLength() > 0) { nlElements = nlElements.item(0).getChildNodes(); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element eAwardEvent = (Element) nElements; AwardEvent awardEvent = new AwardEvent(); awardEvent.setName(eAwardEvent.getAttribute(NAME)); Node nAward; for (int loopAwards = 0; loopAwards < eAwardEvent.getChildNodes().getLength(); loopAwards++) { nAward = eAwardEvent.getChildNodes().item(loopAwards); if (nAward.getNodeType() == Node.ELEMENT_NODE) { Element eAward = (Element) nAward; Award award = new Award(); award.setName(eAward.getTextContent()); award.setNominated(Integer.parseInt(eAward.getAttribute("nominated"))); award.setWon(Integer.parseInt(eAward.getAttribute(WON))); award.setYear(Integer.parseInt(eAward.getAttribute(YEAR))); String tmpAward = eAward.getAttribute("wons"); if (StringTools.isValidString(tmpAward)) { award.setWons(Arrays.asList(tmpAward.split(Movie.SPACE_SLASH_SPACE))); } tmpAward = eAward.getAttribute("nominations"); if (StringTools.isValidString(tmpAward)) { award.setNominations(Arrays.asList(tmpAward.split(Movie.SPACE_SLASH_SPACE))); } awardEvent.addAward(award); } } movie.addAward(awardEvent); } } } nlElements = eMovie.getElementsByTagName("people"); if (nlElements.getLength() > 0) { nlElements = nlElements.item(0).getChildNodes(); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element ePerson = (Element) nElements; Filmography person = new Filmography(); person.setCastId(ePerson.getAttribute("cast_id")); person.setCharacter(ePerson.getAttribute(CHARACTER)); person.setDepartment(ePerson.getAttribute(DEPARTMENT)); person.setDoublage(ePerson.getAttribute("doublage")); person.setId(ePerson.getAttribute("id")); person.setJob(ePerson.getAttribute(JOB)); person.setName(ePerson.getAttribute(NAME)); person.setOrder(ePerson.getAttribute(ORDER)); person.setTitle(ePerson.getAttribute(TITLE)); person.setUrl(ePerson.getAttribute(URL)); person.setPhotoFilename(ePerson.getAttribute("photoFile")); person.setFilename(ePerson.getTextContent()); for (int loopAttr = 0; loopAttr < ePerson.getAttributes().getLength(); loopAttr++) { Node nPersonAttr = ePerson.getAttributes().item(loopAttr); if (nPersonAttr.getNodeName().startsWith(ID)) { String name = nPersonAttr.getNodeName().replace(ID, ""); person.setId(name, nPersonAttr.getNodeValue()); } } String source = ePerson.getAttribute(SOURCE); if (StringTools.isValidString(source)) { person.setSource(source); if (person.getDepartment().equalsIgnoreCase(Filmography.DEPT_DIRECTING)) { movie.setOverrideSource(OverrideFlag.PEOPLE_DIRECTORS, source); } else if (person.getDepartment().equalsIgnoreCase(Filmography.DEPT_WRITING)) { movie.setOverrideSource(OverrideFlag.PEOPLE_WRITERS, source); } else if (person.getDepartment().equalsIgnoreCase(Filmography.DEPT_ACTORS)) { movie.setOverrideSource(OverrideFlag.PEOPLE_ACTORS, source); } } else { person.setSource(Movie.UNKNOWN); } movie.addPerson(person); } } } nlElements = eMovie.getElementsByTagName("business"); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element eBusiness = (Element) nElements; movie.setBudget(eBusiness.getAttribute("budget")); Node nCountry; for (int loopBus = 0; loopBus < eBusiness.getChildNodes().getLength(); loopBus++) { nCountry = eBusiness.getChildNodes().item(loopBus); if (nCountry.getNodeType() == Node.ELEMENT_NODE) { Element eCountry = (Element) nCountry; if ("gross".equalsIgnoreCase(eCountry.getNodeName())) { movie.setGross(eCountry.getAttribute(COUNTRY), eCountry.getTextContent()); } else if ("openweek".equalsIgnoreCase(eCountry.getNodeName())) { movie.setOpenWeek(eCountry.getAttribute(COUNTRY), eCountry.getTextContent()); } } } } } if (ENABLE_TRIVIA) { nlElements = eMovie.getElementsByTagName("trivia"); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); movie.addDidYouKnow(nElements.getTextContent()); } } nlElements = eMovie.getElementsByTagName("files"); if (nlElements.getLength() > 0) { nlElements = nlElements.item(0).getChildNodes(); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element eFile = (Element) nElements; MovieFile movieFile = new MovieFile(); try { File mfFile = new File(DOMHelper.getValueFromElement(eFile, "fileLocation")); if (mfFile.exists() || MovieJukebox.isJukeboxPreserve()) { movieFile.setFile(mfFile); } else { LOG.debug("Missing video file in the XML file ({}), it may have been moved or no longer exist.", mfFile.getName()); continue; } } catch (Exception ignore) { LOG.debug("Failed parsing file {}", xmlFile.getName()); continue; } String attr = eFile.getAttribute(TITLE); if (StringTools.isValidString(attr)) { movieFile.setTitle(attr); } attr = eFile.getAttribute(SEASON); if (StringUtils.isNumeric(attr)) { movieFile.setSeason(Integer.parseInt(attr)); } attr = eFile.getAttribute("firstPart"); if (StringUtils.isNumeric(attr)) { movieFile.setFirstPart(Integer.parseInt(attr)); } attr = eFile.getAttribute("lastPart"); if (StringUtils.isNumeric(attr)) { movieFile.setLastPart(Integer.parseInt(attr)); } attr = eFile.getAttribute("subtitlesExchange"); if (StringTools.isValidString(attr)) { movieFile.setSubtitlesExchange(attr.equalsIgnoreCase(YES)); } movieFile.setFilename(DOMHelper.getValueFromElement(eFile, "fileURL")); if (DOMHelper.getValueFromElement(eFile, "fileArchiveName") != null) { movieFile.setArchiveName(DOMHelper.getValueFromElement(eFile, "fileArchiveName")); } NodeList nlFileParts = eFile.getElementsByTagName("fileTitle"); if (nlFileParts.getLength() > 0) { for (int looperFile = 0; looperFile < nlFileParts.getLength(); looperFile++) { Node nFileParts = nlFileParts.item(looperFile); if (nFileParts.getNodeType() == Node.ELEMENT_NODE) { Element eFileParts = (Element) nFileParts; String part = eFileParts.getAttribute(PART); String source = eFileParts.getAttribute(SOURCE); if (StringUtils.isNumeric(part)) { movieFile.setTitle(NumberUtils.toInt(part, 0), eFileParts.getTextContent(), source); } else { movieFile.setTitle(eFileParts.getTextContent(), source); } } } } nlFileParts = eFile.getElementsByTagName("airsInfo"); if (nlFileParts.getLength() > 0) { for (int looperFile = 0; looperFile < nlFileParts.getLength(); looperFile++) { Node nFileParts = nlFileParts.item(looperFile); if (nFileParts.getNodeType() == Node.ELEMENT_NODE) { Element eFileParts = (Element) nFileParts; int part = NumberUtils.toInt(eFileParts.getAttribute(PART), 1); movieFile.setAirsAfterSeason(part, eFileParts.getAttribute("afterSeason")); movieFile.setAirsBeforeEpisode(part, eFileParts.getAttribute("beforeEpisode")); movieFile.setAirsBeforeSeason(part, eFileParts.getAttribute("beforeSeason")); } } } nlFileParts = eFile.getElementsByTagName("firstAired"); if (nlFileParts.getLength() > 0) { for (int looperFile = 0; looperFile < nlFileParts.getLength(); looperFile++) { Node nFileParts = nlFileParts.item(looperFile); if (nFileParts.getNodeType() == Node.ELEMENT_NODE) { Element eFileParts = (Element) nFileParts; int part = NumberUtils.toInt(eFileParts.getAttribute(PART), 1); String source = eFileParts.getAttribute(SOURCE); movieFile.setFirstAired(part, eFileParts.getTextContent(), source); } } } nlFileParts = eFile.getElementsByTagName("filePlot"); if (nlFileParts.getLength() > 0) { for (int looperFile = 0; looperFile < nlFileParts.getLength(); looperFile++) { Node nFileParts = nlFileParts.item(looperFile); if (nFileParts.getNodeType() == Node.ELEMENT_NODE) { Element eFileParts = (Element) nFileParts; int part = NumberUtils.toInt(eFileParts.getAttribute(PART), 1); String source = eFileParts.getAttribute(SOURCE); movieFile.setPlot(part, eFileParts.getTextContent(), source, Boolean.TRUE); } } } nlFileParts = eFile.getElementsByTagName("fileRating"); if (nlFileParts.getLength() > 0) { for (int looperFile = 0; looperFile < nlFileParts.getLength(); looperFile++) { Node nFileParts = nlFileParts.item(looperFile); if (nFileParts.getNodeType() == Node.ELEMENT_NODE) { Element eFileParts = (Element) nFileParts; int part = NumberUtils.toInt(eFileParts.getAttribute(PART), 1); String source = eFileParts.getAttribute(SOURCE); movieFile.setRating(part, eFileParts.getTextContent(), source); } } } nlFileParts = eFile.getElementsByTagName("fileImageURL"); if (nlFileParts.getLength() > 0) { for (int looperFile = 0; looperFile < nlFileParts.getLength(); looperFile++) { Node nFileParts = nlFileParts.item(looperFile); if (nFileParts.getNodeType() == Node.ELEMENT_NODE) { Element eFileParts = (Element) nFileParts; int part = NumberUtils.toInt(eFileParts.getAttribute(PART), 1); movieFile.setVideoImageURL(part, HTMLTools.decodeUrl(eFileParts.getTextContent())); } } } nlFileParts = eFile.getElementsByTagName("fileImageFile"); if (nlFileParts.getLength() > 0) { for (int looperFile = 0; looperFile < nlFileParts.getLength(); looperFile++) { Node nFileParts = nlFileParts.item(looperFile); if (nFileParts.getNodeType() == Node.ELEMENT_NODE) { Element eFileParts = (Element) nFileParts; int part = NumberUtils.toInt(eFileParts.getAttribute(PART), 1); movieFile.setVideoImageFilename(part, HTMLTools.decodeUrl(eFileParts.getTextContent())); } } } nlFileParts = eFile.getElementsByTagName("fileId"); if (nlFileParts.getLength() > 0) { for (int looperFile = 0; looperFile < nlFileParts.getLength(); looperFile++) { Node nFileParts = nlFileParts.item(looperFile); if (nFileParts.getNodeType() == Node.ELEMENT_NODE) { Element eFileParts = (Element) nFileParts; int part = NumberUtils.toInt(eFileParts.getAttribute(PART), 1); String source = eFileParts.getAttribute(SOURCE); movieFile.setId(part, source, eFileParts.getTextContent()); } } } NodeList nlAttachments = eMovie.getElementsByTagName("attachments"); if (nlAttachments.getLength() > 0) { nlAttachments = nlAttachments.item(0).getChildNodes(); for (int looperAtt = 0; looperAtt < nlAttachments.getLength(); looperAtt++) { Node nAttachment = nlAttachments.item(looperAtt); if (nAttachment.getNodeType() == Node.ELEMENT_NODE) { Element eAttachment = (Element) nAttachment; Attachment attachment = new Attachment(); attachment.setType(AttachmentType.fromString(eAttachment.getAttribute("type"))); attachment.setAttachmentId(Integer.parseInt(DOMHelper.getValueFromElement(eAttachment, "attachmentId"))); attachment.setContentType(ContentType.fromString(DOMHelper.getValueFromElement(eAttachment, "contentType"))); attachment.setMimeType(DOMHelper.getValueFromElement(eAttachment, "mimeType")); attachment.setPart(Integer.parseInt(DOMHelper.getValueFromElement(eAttachment, "part"))); attachment.setSourceFile(movieFile.getFile()); movieFile.addAttachment(attachment); } } } String watchedDateString = DOMHelper.getValueFromElement(eFile, "watchedDate"); final long watchedDate; if (StringTools.isNotValidString(watchedDateString)) { watchedDate = 0; } else { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(DateTime.parse(watchedDateString).toMillis()); cal.set(Calendar.MILLISECOND, 0); watchedDate = cal.getTimeInMillis(); } final boolean watched = Boolean.parseBoolean(eFile.getAttribute("watched")); movieFile.setWatched(watched, watchedDate); movieFile.setNewFile(Boolean.FALSE); movie.addMovieFile(movieFile); } } } nlElements = eMovie.getElementsByTagName("extras"); if (nlElements.getLength() > 0) { nlElements = nlElements.item(0).getChildNodes(); for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element eExtra = (Element) nElements; String extraTitle = eExtra.getAttribute(TITLE); String extraFilename = eExtra.getTextContent(); if (!extraTitle.isEmpty() && !extraFilename.isEmpty()) { boolean exist = Boolean.FALSE; if (extraFilename.startsWith("http:")) { ExtraFile ef = new ExtraFile(); ef.setNewFile(Boolean.FALSE); ef.setTitle(extraTitle); ef.setFilename(extraFilename); movie.addExtraFile(ef, Boolean.FALSE); exist = Boolean.TRUE; } else { for (ExtraFile ef : movie.getExtraFiles()) { if (ef.getFilename().equals(extraFilename)) { exist = Boolean.TRUE; ef.setNewFile(Boolean.FALSE); break; } } } if (!exist) { forceDirtyFlag = Boolean.TRUE; } } } } } } } movie.clearDirty(); movie.setDirty(DirtyFlag.INFO, forceDirtyFlag || movie.hasNewMovieFiles() || movie.hasNewExtraFiles()); return Boolean.TRUE; }  boolean parseMovieXML(File xmlFile, Movie movie); boolean parseSetXML(File xmlSetFile, Movie setMaster, List<Movie> moviesList); boolean parsePersonXML(File xmlFile, Person person);  }
@Test public void testParseMovieXML() { LOG.info("parseMovieXML - no test written"); }