Esempio n. 1
0
/**
 * wrapper to handle FAV and DNP. Uses the given title and the range definitions in cmd
 * to create the proper config line and immediately applies it to the current playlist
 */
int handleRangeCmd( mptitle *title, mpcmd cmd ) {
	char line[MAXPATHLEN];
	struct marklist_t buff;
	int cnt=-1;
	mpconfig *config=getConfig();

	if( addRangePrefix(line, cmd) == 0 ) {
		switch( MPC_RANGE(cmd) ) {
		case mpc_title:
			strtcat( line, title->title, NAMELEN );
			break;
		case mpc_artist:
			strtcat( line, title->artist, NAMELEN );
			break;
		case mpc_album:
			strtcat( line, title->album, NAMELEN );
			break;
		case mpc_genre:
			strtcat( line, title->genre, NAMELEN );
			break;
		case mpc_display:
			strtcat( line, title->display, MAXPATHLEN );
			break;
		default:
			addMessage( 0, "Illegal range 0x%04x", MPC_RANGE(cmd) );
			break;
		}
		if( strlen( line ) < 5 ) {
			addMessage( 0, "Not enough info in %s!", line );
			return 0;
		}

		buff.next=NULL;
		strcpy( buff.dir, line );

		if( MPC_CMD(cmd) == mpc_fav ) {
			addToFile( config->favname, line );
			cnt=applyFAVlist( title, &buff );
		}
		else if( MPC_CMD(cmd) == mpc_dnp ) {
			addToFile( config->dnpname, line );
			cnt=applyDNPlist( title, &buff );
		}
	}

	if( cnt > 0 ) {
		notifyChange();
	}
	return cnt;
}
Esempio n. 2
0
std::string		UsualInterface::makeBehavior(void) {
	createNewFile("interface", path + "/include/" + genMapName["${CLASS_NAME}"] + ".hpp", genMapName, loopMapName);
	addToFile("INTERFACE", genMapName["${CLASS_NAME}"], path + "/Makefile", false);
	return ("Interface " + genMapName["${CLASS_NAME}"] + " created successfully!");
}