Refactor
This commit is contained in:
parent
c1b169cdb5
commit
7b3b7cc2ba
@ -61,11 +61,11 @@ public class NSITunes extends Namespace {
|
|||||||
state.getFeed().setAuthor(author);
|
state.getFeed().setAuthor(author);
|
||||||
}
|
}
|
||||||
} else if (DURATION.equals(localName)) {
|
} else if (DURATION.equals(localName)) {
|
||||||
String duration = state.getContentBuf().toString();
|
String durationStr = state.getContentBuf().toString();
|
||||||
if(TextUtils.isEmpty(duration)) {
|
if(TextUtils.isEmpty(durationStr)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String[] parts = duration.trim().split(":");
|
String[] parts = durationStr.trim().split(":");
|
||||||
try {
|
try {
|
||||||
int durationMs = 0;
|
int durationMs = 0;
|
||||||
if (parts.length == 2) {
|
if (parts.length == 2) {
|
||||||
@ -80,8 +80,7 @@ public class NSITunes extends Namespace {
|
|||||||
}
|
}
|
||||||
state.getTempObjects().put(DURATION, durationMs);
|
state.getTempObjects().put(DURATION, durationMs);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Log.e(NSTAG, "duration: " + duration);
|
Log.e(NSTAG, "Duration \"" + durationStr + "\" could not be parsed");
|
||||||
Log.e(NSTAG, Log.getStackTraceString(e));
|
|
||||||
}
|
}
|
||||||
} else if (SUBTITLE.equals(localName)) {
|
} else if (SUBTITLE.equals(localName)) {
|
||||||
String subtitle = state.getContentBuf().toString();
|
String subtitle = state.getContentBuf().toString();
|
||||||
|
@ -40,10 +40,11 @@ public class NSMedia extends Namespace {
|
|||||||
if (state.getCurrentItem() != null && state.getCurrentItem().getMedia() == null &&
|
if (state.getCurrentItem() != null && state.getCurrentItem().getMedia() == null &&
|
||||||
url != null && validType) {
|
url != null && validType) {
|
||||||
long size = 0;
|
long size = 0;
|
||||||
|
String sizeStr = attributes.getValue(SIZE);
|
||||||
try {
|
try {
|
||||||
size = Long.parseLong(attributes.getValue(SIZE));
|
size = Long.parseLong(sizeStr);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Log.e(TAG, "Length attribute could not be parsed.");
|
Log.e(TAG, "Size \"" + sizeStr + "\" could not be parsed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int durationMs = 0;
|
int durationMs = 0;
|
||||||
@ -53,7 +54,7 @@ public class NSMedia extends Namespace {
|
|||||||
long duration = Long.parseLong(durationStr);
|
long duration = Long.parseLong(durationStr);
|
||||||
durationMs = (int) TimeUnit.MILLISECONDS.convert(duration, TimeUnit.SECONDS);
|
durationMs = (int) TimeUnit.MILLISECONDS.convert(duration, TimeUnit.SECONDS);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Log.e(TAG, "Duration attribute could not be parsed");
|
Log.e(TAG, "Duration \"" + durationStr + "\" could not be parsed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FeedMedia media = new FeedMedia(state.getCurrentItem(), url, size, type);
|
FeedMedia media = new FeedMedia(state.getCurrentItem(), url, size, type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user