void create_directory_helper::format_filename(const metadb_handle_ptr & handle,titleformat_hook * p_hook,const char * spec,pfc::string8 & out)
{
    pfc::string8 temp;
    handle->format_title_legacy(p_hook,temp,spec,&titleformat_text_filter_impl_createdir());
    temp.replace_char('/','\\');
    temp.fix_filename_chars('_','\\');
    out = temp;
}
Beispiel #2
0
	virtual void on_playback_new_track(metadb_handle_ptr track)
	{
		pfc::string8		out = "";
		pfc::string8		fullTitle = "";
		pfc::string8		artist = "";
		pfc::string8		title = "";

       	char	songTitle[1024] = "";
	    char	songTitle2[1024] = "";
	    static	char currentTitle[1024] = "";
	    int		windowTitle = 1;
        char    newTitle[2046] = "";


        if (track != NULL) {
            track->metadb_lock();
			const file_info * info;
			track->get_info_async_locked(info);
            if (info) {
				freeComment();
                int numInfos = info->meta_get_count();
                for (int i=0;i<numInfos;i++) {
                    const char *pName = info->meta_enum_name(i);
                    const char *pValue = info->meta_enum_value(i,0);
                    char *buffer;
                    int bufferlen = 0;
                    bufferlen = strlen(pName) + strlen(pValue) + strlen("=") + 1;
                    buffer = (char *)calloc(1, bufferlen);
                    sprintf(buffer, "%s=%s", pName, pValue);
                    pfc::string8 theout = "";
                    theout.add_string(buffer);
					addComment((char *)(const char *)pfc::stringcvt::string_ansi_from_utf8(theout));
                    free(buffer);
					if (pName) {
						if (!stricmp(pName, "ARTIST")) {
							if (pValue) {
								artist.add_string(pValue);
							}
						}
						if (!stricmp(pName, "TITLE")) {
							if (pValue) {
								title.add_string(" - ");
								title.add_string(pValue);
							}
						}
					}
                }
				if (numInfos == 0) {
			        static const char * TITLE_FORMAT = "%_filename%";
					track->format_title_legacy(0,fullTitle,TITLE_FORMAT,0);
				}
				else {
					fullTitle.add_string(artist);
					fullTitle.add_string(title);
					/*
					track->handle_query_meta_field("ARTIST", 0, out);
					fullTitle.add_string(out);
					track->handle_query_meta_field("TITLE", 0, out);
					fullTitle.add_string(" - ");
					fullTitle.add_string(out);
					*/
					;
				}
	    	    setMetadataFromMediaPlayer((char *)(const char *)pfc::stringcvt::string_ansi_from_utf8(fullTitle));
            }
			track->metadb_unlock();
        }
	}