CStdString MythProgramInfo::ChannelName()
{
    char* chan = cmyth_proginfo_channame(*m_proginfo_t);
    CStdString retval(chan);
    ref_release(chan);
    return retval;
}
Example #2
0
int
cmyth_recorder_add_chanlist(cmyth_recorder_t rec)
{
	cmyth_proginfo_t zero, first, prog;
	char *first_name;
	cmyth_chanlist_t list;
	cmyth_channel_t channel;

	/*
	 * Get a list of channels for the recorder by cycling through the
	 * current program guide.  For some reason, the first proginfo
	 * structure retrieved seems to be empty, so just ignore it.
	 */

	zero = cmyth_recorder_get_cur_proginfo(rec);

	if (zero == NULL) {
		return -1;
	}

	first = cmyth_recorder_get_next_proginfo(rec, zero,
						 BROWSE_DIRECTION_UP);

	ref_release(zero);

	first_name = cmyth_proginfo_channame(first);

	prog = ref_hold(first);

	list = cmyth_chanlist_create();

	while (1) {
		cmyth_proginfo_t prev = prog;
		char *name, *sign, *icon;
		char buf[128];

		prog = cmyth_recorder_get_next_proginfo(rec, prev,
							BROWSE_DIRECTION_UP);

		if (prog == NULL) {
			break;
		}

		name = cmyth_proginfo_channame(prog);
		sign = cmyth_proginfo_chansign(prog);

		snprintf(buf, sizeof(buf), "%s %s", name, sign);

		icon = cmyth_proginfo_chanicon(prog);
		channel = cmyth_channel_create(prog->proginfo_chanId,
					       name, sign, buf, icon);

		cmyth_chanlist_add(list, channel);

		ref_release(channel);
		ref_release(sign);
		ref_release(icon);
		ref_release(prev);

		if (strcmp(first_name, name) == 0) {
			ref_release(name);
			break;
		}

		ref_release(name);
	}

	rec->rec_chanlist = list;

	ref_release(first_name);
	ref_release(first);
	ref_release(prog);

	return 0;
}
Example #3
0
static int
show_proglist(cmyth_proglist_t episodes, int level, int show_card)
{
	int count, i;

	if (episodes == NULL) {
		return -1;
	}

	count = cmyth_proglist_get_count(episodes);

	for (i=0; i<count; i++) {
		char *title;
		char *subtitle=NULL, *channel = NULL;
		char *description=NULL, *category=NULL, *recgroup=NULL;
		char *pathname=NULL;
		cmyth_proginfo_t prog;
		int rec;

		prog = cmyth_proglist_get_item(episodes, i);

		title = cmyth_proginfo_title(prog);

		rec = cmyth_proginfo_check_recording(control, prog);

		if (level > 2) {
			subtitle = cmyth_proginfo_subtitle(prog);
			channel = cmyth_proginfo_channame(prog);
		}

		if (level > 3) {
			description = cmyth_proginfo_description(prog);
			category = cmyth_proginfo_category(prog);
			recgroup = cmyth_proginfo_recgroup(prog);
		}

		if (level > 4) {
			pathname = cmyth_proginfo_pathname(prog);
		}

		if (channel) {
			printf("\tChannel:         %s\n", channel);
		}
		if (title) {
			printf("\tTitle:           %s\n", title);
			if (rec > 0) {
				cmyth_timestamp_t end;
				char str[32];

				end = cmyth_proginfo_rec_end(prog);
				cmyth_timestamp_to_string(str, end);

				printf("\t                 RECORDING on %d until %s\n",
				       rec, str);

				ref_release(end);
			}
		}
		if (subtitle) {
			printf("\tSubtitle:        %s\n", subtitle);
		}
		if (description) {
			printf("\tDescription:     %s\n", description);
		}
		if (category) {
			printf("\tCategory:        %s\n", category);
		}
		if (recgroup) {
			printf("\tRecording Group: %s\n", recgroup);
		}
		if (pathname) {
			printf("\tPathname:        %s\n", pathname);
		}

		if (level > 4) {
			printf("\tBytes:           %lld\n",
			       cmyth_proginfo_length(prog));
		}

		if (level > 1 && show_card) {
			long card = cmyth_proginfo_card_id(prog);

			if (card == 0) {
				printf("\tRecorder:        will not record\n");
			} else {
				printf("\tRecorder:        %ld\n", card);
			}
		}

		ref_release(channel);
		ref_release(title);
		ref_release(subtitle);
		ref_release(description);
		ref_release(category);
		ref_release(recgroup);
		ref_release(pathname);

		ref_release(prog);
	}

	ref_release(episodes);

	return count;
}