Skip to content

Commit 9761b0f

Browse files
+ ID3v2: Popularimeter
1 parent 78274e6 commit 9761b0f

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

Source/MediaInfo/MediaInfo_Config_Automatic.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ void MediaInfo_Config_DefaultLanguage (Translation &Info)
156156
" second1; second\n"
157157
" second2; seconds\n"
158158
" second3; seconds\n"
159+
" star1; star\n"
160+
" star2; stars\n"
161+
" star3; stars\n"
159162
" text stream1; text stream\n"
160163
" text stream2; text streams\n"
161164
" text stream3; text streams\n"

Source/MediaInfo/Tag/File_Id3v2.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,48 @@ void File_Id3v2::RGAD()
10471047
FILLING_END();
10481048
}
10491049

1050+
//---------------------------------------------------------------------------
1051+
void File_Id3v2::POPM()
1052+
{
1053+
string Owner;
1054+
size_t Owner_Size=0;
1055+
int8u Rating;
1056+
while (Element_Offset+Owner_Size<Element_Size && Buffer[Buffer_Offset+(size_t)Element_Offset+Owner_Size]!='\0')
1057+
Owner_Size++;
1058+
if (Owner_Size==0 || Element_Offset+Owner_Size>=Element_Size)
1059+
{
1060+
Skip_XX(Element_Size-Element_Offset, "Unknown");
1061+
return;
1062+
}
1063+
Get_String(Owner_Size, Owner, "Owner identifier");
1064+
Skip_B1( "Null");
1065+
Get_B1 (Rating, "Rating");
1066+
if (Element_Offset<Element_Size)
1067+
Skip_B4( "Counter");
1068+
1069+
FILLING_BEGIN();
1070+
if (Rating)
1071+
{
1072+
int8u Limits[]={31, 95, 159, 223, 255};
1073+
int8u Limit=0;
1074+
while (Rating>Limits[Limit])
1075+
Limit++;
1076+
Limit++;
1077+
Fill(Stream_General, 0, "Popularimeter", Limit);
1078+
Fill(Stream_General, 0, "Popularimeter_Numerator", Rating);
1079+
Fill(Stream_General, 0, "Popularimeter_Denominator", 255);
1080+
Fill(Stream_General, 0, "Popularimeter_Source", Owner);
1081+
auto const& Popularimeter=Retrieve_Const(Stream_General, 0, "Popularimeter");
1082+
Fill(Stream_General, 0, "Popularimeter/String", MediaInfoLib::Config.Language_Get(Popularimeter, __T(" star"))+__T(" (")+Retrieve_Const(Stream_General, 0, "Popularimeter_Numerator")+__T("/255, ")+Retrieve_Const(Stream_General, 0, "Popularimeter_Source") + __T(')'));
1083+
Fill_SetOptions(Stream_General, 0, "Popularimeter", "N NIY");
1084+
Fill_SetOptions(Stream_General, 0, "Popularimeter_Numerator", "N NIY");
1085+
Fill_SetOptions(Stream_General, 0, "Popularimeter_Denominator", "N NIY");
1086+
Fill_SetOptions(Stream_General, 0, "Popularimeter_Source", "N NTY");
1087+
Fill_SetOptions(Stream_General, 0, "Popularimeter/String", "Y NTN");
1088+
}
1089+
FILLING_END();
1090+
}
1091+
10501092
//---------------------------------------------------------------------------
10511093
void File_Id3v2::PRIV()
10521094
{

Source/MediaInfo/Tag/File_Id3v2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private :
7171
void MLLT() {Skip_XX(Element_Size, "Data");}
7272
void OWNE() {Skip_XX(Element_Size, "Data");}
7373
void PCNT() {Skip_XX(Element_Size, "Data");}
74-
void POPM() {Skip_XX(Element_Size, "Data");}
74+
void POPM();
7575
void POSS() {Skip_XX(Element_Size, "Data");}
7676
void PRIV();
7777
void RBUF() {Skip_XX(Element_Size, "Data");}
@@ -163,7 +163,7 @@ private :
163163
void MCI() {Skip_XX(Element_Size, "Data");}
164164
void MLL() {Skip_XX(Element_Size, "Data");}
165165
void PIC_() {APIC();}
166-
void POP() {Skip_XX(Element_Size, "Data");}
166+
void POP() {POPM();}
167167
void REV() {Skip_XX(Element_Size, "Data");}
168168
void RVA() {Skip_XX(Element_Size, "Data");}
169169
void SLT() {Skip_XX(Element_Size, "Data");}

Source/Resource/Text/Language/DefaultLanguage.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@
127127
second1; second
128128
second2; seconds
129129
second3; seconds
130+
star1; star
131+
star2; stars
132+
star3; stars
130133
text stream1; text stream
131134
text stream2; text streams
132135
text stream3; text streams

0 commit comments

Comments
 (0)