📄 strings.c
字号:
INSERT_STRING_NO_FREE( buf ); break; case 'g': if( p_item ) { INSERT_STRING( input_item_GetGenre( p_item ) ); } break; case 'l': if( p_item ) { INSERT_STRING( input_item_GetLanguage( p_item ) ); } break; case 'n': if( p_item ) { INSERT_STRING( input_item_GetTrackNum( p_item ) ); } break; case 'p': if( p_item ) { INSERT_STRING( input_item_GetNowPlaying( p_item ) ); } break; case 'r': if( p_item ) { INSERT_STRING( input_item_GetRating( p_item ) ); } break; case 's': { char *lang = NULL; if( p_input ) lang = var_GetNonEmptyString( p_input, "sub-language" ); if( lang == NULL ) lang = strdup( b_empty_if_na ? "" : "-" ); INSERT_STRING( lang ); break; } case 't': if( p_item ) { INSERT_STRING( input_item_GetTitle( p_item ) ); } break; case 'u': if( p_item ) { INSERT_STRING( input_item_GetURL( p_item ) ); } break; case 'A': if( p_item ) { INSERT_STRING( input_item_GetDate( p_item ) ); } break; case 'B': if( p_input ) { snprintf( buf, 10, "%d", var_GetInteger( p_input, "bit-rate" )/1000 ); } else { sprintf( buf, b_empty_if_na ? "" : "-" ); } INSERT_STRING_NO_FREE( buf ); break; case 'C': if( p_input ) { snprintf( buf, 10, "%d", var_GetInteger( p_input, "chapter" ) ); } else { sprintf( buf, b_empty_if_na ? "" : "-" ); } INSERT_STRING_NO_FREE( buf ); break; case 'D': if( p_item ) { mtime_t i_duration = input_item_GetDuration( p_item ); sprintf( buf, "%02d:%02d:%02d", (int)(i_duration/(3600000000)), (int)((i_duration/(60000000))%60), (int)((i_duration/1000000)%60) ); } else { sprintf( buf, b_empty_if_na ? "" : "--:--:--" ); } INSERT_STRING_NO_FREE( buf ); break; case 'F': if( p_item ) { INSERT_STRING( input_item_GetURI( p_item ) ); } break; case 'I': if( p_input ) { snprintf( buf, 10, "%d", var_GetInteger( p_input, "title" ) ); } else { sprintf( buf, b_empty_if_na ? "" : "-" ); } INSERT_STRING_NO_FREE( buf ); break; case 'L': if( p_item && p_input ) { mtime_t i_duration = input_item_GetDuration( p_item ); int64_t i_time = p_input->i_time; sprintf( buf, "%02d:%02d:%02d", (int)( ( i_duration - i_time ) / 3600000000 ), (int)( ( ( i_duration - i_time ) / 60000000 ) % 60 ), (int)( ( ( i_duration - i_time ) / 1000000 ) % 60 ) ); } else { sprintf( buf, b_empty_if_na ? "" : "--:--:--" ); } INSERT_STRING_NO_FREE( buf ); break; case 'N': if( p_item ) { INSERT_STRING( input_item_GetName( p_item ) ); } break; case 'O': { char *lang = NULL; if( p_input ) lang = var_GetNonEmptyString( p_input, "audio-language" ); if( lang == NULL ) lang = strdup( b_empty_if_na ? "" : "-" ); INSERT_STRING( lang ); break; } case 'P': if( p_input ) { snprintf( buf, 10, "%2.1lf", var_GetFloat( p_input, "position" ) * 100. ); } else { sprintf( buf, b_empty_if_na ? "" : "--.-%%" ); } INSERT_STRING_NO_FREE( buf ); break; case 'R': if( p_input ) { int r = var_GetInteger( p_input, "rate" ); snprintf( buf, 10, "%d.%d", r/1000, r%1000 ); } else { sprintf( buf, b_empty_if_na ? "" : "-" ); } INSERT_STRING_NO_FREE( buf ); break; case 'S': if( p_input ) { int r = var_GetInteger( p_input, "sample-rate" ); snprintf( buf, 10, "%d.%d", r/1000, (r/100)%10 ); } else { sprintf( buf, b_empty_if_na ? "" : "-" ); } INSERT_STRING_NO_FREE( buf ); break; case 'T': if( p_input ) { sprintf( buf, "%02d:%02d:%02d", (int)( p_input->i_time / ( 3600000000 ) ), (int)( ( p_input->i_time / ( 60000000 ) ) % 60 ), (int)( ( p_input->i_time / 1000000 ) % 60 ) ); } else { sprintf( buf, b_empty_if_na ? "" : "--:--:--" ); } INSERT_STRING_NO_FREE( buf ); break; case 'U': if( p_item ) { INSERT_STRING( input_item_GetPublisher( p_item ) ); } break; case 'V': { audio_volume_t volume; aout_VolumeGet( p_object, &volume ); snprintf( buf, 10, "%d", volume ); INSERT_STRING_NO_FREE( buf ); break; } case '_': *(dst+d) = '\n'; d++; break; case ' ': b_empty_if_na = 1; break; default: *(dst+d) = *s; d++; break; } if( *s != ' ' ) b_is_format = 0; } else if( *s == '$' ) { b_is_format = 1; b_empty_if_na = 0; } else { *(dst+d) = *s; d++; } s++; } *(dst+d) = '\0'; if( p_input ) vlc_object_release( p_input ); return dst;}/** * Apply str format time and str format meta */char *__str_format( vlc_object_t *p_this, const char *psz_src ){ char *psz_buf1, *psz_buf2; psz_buf1 = str_format_time( psz_src ); psz_buf2 = str_format_meta( p_this, psz_buf1 ); free( psz_buf1 ); return psz_buf2;}/** * Remove forbidden characters from filenames (including slashes) */void filename_sanitize( char *str ){ if( *str == '.' && (str[1] == '\0' || (str[1] == '.' && str[2] == '\0' ) ) ) { while( *str ) { *str = '_'; str++; } return; } while( *str ) { switch( *str ) { case '/':#if defined( __APPLE__ ) case ':':#elif defined( WIN32 ) case '\\': case '*': case '"': case '?': case ':': case '|': case '<': case '>':#endif *str = '_'; } str++; }}/** * Remove forbidden characters from full paths (leaves slashes) */void path_sanitize( char *str ){#if 0 /* * Uncomment the two blocks to prevent /../ or /./, i'm not sure that we * want to. */ char *prev = str - 1;#endif#ifdef WIN32 /* check drive prefix if path is absolute */ if( isalpha(*str) && (':' == *(str+1)) ) str += 2;#endif while( *str ) {#if defined( __APPLE__ ) if( *str == ':' ) *str = '_';#elif defined( WIN32 ) switch( *str ) { case '*': case '"': case '?': case ':': case '|': case '<': case '>': *str = '_'; }#endif#if 0 if( *str == '/'#ifdef WIN32 || *str == '\\'#endif ) { if( str - prev == 2 && prev[1] == '.' ) { prev[1] = '.'; } else if( str - prev == 3 && prev[1] == '.' && prev[2] == '.' ) { prev[1] = '_'; prev[2] = '_'; } prev = str; }#endif str++; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -