/** * Get the file list of the input path * * @param fileName the name of the file waiting to be parsed * @param walkType the type of walk routine, application can use CD_CHILD and CD_PARENT. * @return * @throws Exception Invalid input file name */ public void parseDLNAFile(String fileName, boolean walkType) throws Exception { cancelNotify(); if (walkType == CD_CHILD) { if (fileName == null || fileName.equals(mRoot)) { if (localLOGV) NetLog.d(TAG, "[parseDLNAFile][root][fileName]:" + fileName); parseRootDirectory(); return; } REQUEST_MATCH_NUM = 0; if (isDevice(fileName) == true) { // device if (localLOGV) NetLog.d(TAG, "[parseDLNAFile][device][fileName]:" + fileName); parseDevice(fileName); return; } else { // content if (localLOGV) NetLog.d(TAG, "[parseDLNAFile][content][fileName]:" + fileName); parseContent(fileName); return; } } else { try { if (mTraceFile.empty() == false) { DLNATempFile dlnaFile = mTraceFile.pop(); constructCurPath(dlnaFile.getName(), false); if (dlnaFile.getType() == DLNATempFile.TYPE_DEVICE) { if (localLOGV) NetLog.d(TAG, "[parseParent] pop device, next parse root"); mCurPath = mRoot; // player.stop(); parseRootDirectory(); return; } else { dlnaFile = mTraceFile.peek(); String name = dlnaFile.getName(); if (dlnaFile.getType() == DLNATempFile.TYPE_DEVICE) { constructCurPath(dlnaFile.getName(), false); mTraceFile.pop(); parseDevice(name); } else { parseContent(name); } } } else { if (localLOGV) NetLog.d(TAG, "[parseParent] stack is empty, next parse root"); // player.stop(); parseRootDirectory(); } } catch (Exception e) { throw new Exception(e); } } }
public boolean equals(DLNATempFile fileIns) { int type = this.getType(); if (type != fileIns.getType()) return false; if (type == TYPE_DEVICE) { if (this.getDevice().getName() == fileIns.getDevice().getName()) return true; } else if (type == TYPE_CONTENT) { if (this.getContent().getTitle() == fileIns.getContent().getTitle()) return true; } return false; }