Add bitrate keyword to smart playlists

This commit is contained in:
Ron Pedde 2004-09-08 04:07:53 +00:00
parent 84d1ee1cca
commit a96622cbe7
3 changed files with 9 additions and 0 deletions

View File

@ -53,6 +53,7 @@ grouping { yylval.ival=GROUPING; return(GROUPING); }
year { yylval.ival=YEAR; return(YEAR); } year { yylval.ival=YEAR; return(YEAR); }
bpm { yylval.ival=BPM; return(BPM); } bpm { yylval.ival=BPM; return(BPM); }
bitrate { yylval.ival=BITRATE; return(BITRATE); }
is { yylval.ival=IS; return(IS); } is { yylval.ival=IS; return(IS); }
includes { yylval.ival=INCLUDES; return(INCLUDES); } includes { yylval.ival=INCLUDES; return(INCLUDES); }

View File

@ -79,6 +79,7 @@ int pl_number=2;
%token <ival> YEAR %token <ival> YEAR
%token <ival> BPM %token <ival> BPM
%token <ival> BITRATE
%type <plval> expression %type <plval> expression
%type <plval> predicate %type <plval> predicate
@ -109,6 +110,7 @@ predicate: strtag strbool ID { $$=pl_newcharpredicate($1, $2, $3); }
inttag: YEAR inttag: YEAR
| BPM | BPM
| BITRATE
; ;
intbool: EQUALS { $$ = $1; } intbool: EQUALS { $$ = $1; }

View File

@ -119,6 +119,9 @@ void pl_dump_node(PL_NODE *pnode, int indent) {
case BPM: case BPM:
printf("BPM "); printf("BPM ");
break; break;
case BITRATE:
printf("BITRATE ");
break;
default: default:
printf ("<unknown tag> "); printf ("<unknown tag> ");
break; break;
@ -293,6 +296,9 @@ int pl_eval_node(MP3FILE *pmp3, PL_NODE *pnode) {
case BPM: case BPM:
ival=pmp3->bpm; ival=pmp3->bpm;
break; break;
case BITRATE:
ival=pmp3->bitrate / 1024; // bitrate in Kbps
break;
} }
boolarg=(pnode->op) & 0x7FFFFFFF; boolarg=(pnode->op) & 0x7FFFFFFF;