Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -399,27 +399,30 @@ public Void doInBackground(Void... voids) {
}
List<Program> programs = getProgramsForChannel(channelUri, channelMap.valueAt(i),
startMs, endMs);
if (DEBUG) {
Log.d(TAG, programs.toString());
}
for (int index = 0; index < programs.size(); index++) {
if (programs.get(index).getChannelId() == -1) {
// Automatically set the channel id if not set
programs.set(index,
new Program.Builder(programs.get(index))
.setChannelId(channelMap.valueAt(i).getId())
.build());

if (programs != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there be cases when the program list will be null while using the library?

Copy link
Author

@zaclimon zaclimon Jun 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my case, the provider doesn't have all programs for a given channel in the EPG's XMLTV. Surely enough, I could simply pass an empty list instead of returning null on when getProgramsForChannel() is called.

if (DEBUG) {
Log.d(TAG, programs.toString());
}
for (int index = 0; index < programs.size(); index++) {
if (programs.get(index).getChannelId() == -1) {
// Automatically set the channel id if not set
programs.set(index,
new Program.Builder(programs.get(index))
.setChannelId(channelMap.valueAt(i).getId())
.build());
}
}
}

// Double check if the job is cancelled, so that this task can be finished faster
// after cancel() is called.
if (isCancelled()) {
broadcastError(ERROR_EPG_SYNC_CANCELED);
return null;
// Double check if the job is cancelled, so that this task can be finished faster
// after cancel() is called.
if (isCancelled()) {
broadcastError(ERROR_EPG_SYNC_CANCELED);
return null;
}
updatePrograms(channelUri,
getPrograms(channelMap.valueAt(i), programs, startMs, endMs));
}
updatePrograms(channelUri,
getPrograms(channelMap.valueAt(i), programs, startMs, endMs));
Intent intent = new Intent(ACTION_SYNC_STATUS_CHANGED);
intent.putExtra(EpgSyncJobService.BUNDLE_KEY_INPUT_ID, mInputId);
intent.putExtra(EpgSyncJobService.BUNDLE_KEY_CHANNELS_SCANNED, i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ private static Program parseProgram(XmlPullParser parser)
.setChannelId(channelId.hashCode())
.setTitle(title)
.setDescription(description)
.setPosterArtUri(icon.src)
.setPosterArtUri(icon != null ? icon.src : null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, will there be cases when the icon will be null using the library?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, since I can't control the the info put by the provider, some channels doesn't have an icon. This could be somehow bypassed by simply creating a "dummy" icon but it doesn't quite solve the problem.

.setCanonicalGenres(category.toArray(new String[category.size()]))
.setStartTimeUtcMillis(startTimeUtcMillis)
.setEndTimeUtcMillis(endTimeUtcMillis)
Expand Down