예제 #1
0
static void getfileinfo(char *filename, char *title, int *length_in_msec)
{
	FLAC__StreamMetadata streaminfo;

	if (!filename || !*filename) {
		filename = lastfn_;
		if (length_in_msec) {
			*length_in_msec = stream_data_.length_in_msec;
			length_in_msec = 0;    /* force skip in following code */
		}
	}

	if (!FLAC__metadata_get_streaminfo(filename, &streaminfo)) {
		if (length_in_msec)
			*length_in_msec = -1;
		return;
	}

	if (title) {
		static WCHAR buffer[400];
		format_title(filename, buffer, 400);
		WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, buffer, -1, title, 400, NULL, NULL);
	}

	if (length_in_msec) {
		/* with VC++ you have to spoon feed it the casting from uint64->int64->double */
		FLAC__uint64 l = (FLAC__uint64)((double)(FLAC__int64)streaminfo.data.stream_info.total_samples / (double)streaminfo.data.stream_info.sample_rate * 1000.0 + 0.5);
		if (l > INT_MAX)
			l = INT_MAX;
		*length_in_msec = (int)l;
	}
}
      std::string chatty_work_history(position::pointer job) const
      {
	std::stringstream out;	
	
	out << format_title(job);

	out << "Description: " << job->get_description() << "\\par" << std::endl;
	out << "Skills used: ";
	bool first_skill = true;
	for (std::string skill : job->get_skills()) {
	  if (!first_skill) {
	    out << ", ";
	  }
	  first_skill = false;
	  out << skill;
	}
	out << "\\par" << std::endl;
	if (list_responsibilities) {
	  out << "Responsibilities:" << std::endl;
	  out << "\\begin{itemize}" << std::endl;
	  for (std::string resp : job->get_responsibilities()) {
	    out << "\\item " << resp << std::endl;
	  }
	  out << "\\end{itemize}" << std::endl;
	}
	if (list_achievements) {
	  out << std::endl << "Achievements:" << std::endl;
	  out << "\\begin{itemize}" << std::endl;
	  for (std::string achievement : job->get_achievements()) {
	    out << "\\item " << achievement << std::endl;
	  }
	  out << "\\end{itemize}" << std::endl;
	}
	return out.str();
      }
예제 #3
0
bool metadb_handle::format_title_legacy(titleformat_hook * p_hook,pfc::string_base & p_out,const char * p_spec,titleformat_text_filter * p_filter)
{
	service_ptr_t<titleformat_object> script;
	if (static_api_ptr_t<titleformat_compiler>()->compile(script,p_spec)) {
		return format_title(p_hook,p_out,script,p_filter);
	} else {
		p_out.reset();
		return false;
	}
}
      std::string terse_work_history(position::pointer job) const
      {
	return format_title(job);
      }