Re: [Easytag-mailing] disc number
- From: Jérôme Couderc <j couderc ifrance com>
- To: Andre' Draszik <andid gmx net>
- Cc: easytag-mailing lists sourceforge net
- Subject: Re: [Easytag-mailing] disc number
- Date: Thu Feb 10 13:27:05 2005
Here is my patch for disc number support
Jerome
Andre' Draszik wrote, the 10.02.2005 19:28 :
Hi Jerome,
i just wanted to submit my disc number patch for easytag. but then i
realised you announced support for that in the upcoming version.
so, have you finished disc number support already or would my patch be
useful because it's still on your TODO?
greets,
andre'
--
EasyTAG - Tag editor for MP3 and Ogg Vorbis files
http://easytag.sourceforge.net
--
Jerome COUDERC <j couderc ifrance com>
diff -ruN easytag-1.99.3/src/easytag.c easytag-1.99.3-disc_number/src/easytag.c
--- easytag-1.99.3/src/easytag.c 2005-01-20 22:10:26.000000000 +0100
+++ easytag-1.99.3-disc_number/src/easytag.c 2005-02-02 23:51:48.000000000 +0100
@@ -555,12 +555,12 @@
gtk_misc_set_alignment(GTK_MISC(AlbumLabel),1,0.5);
AlbumEntry = gtk_entry_new();
- gtk_table_attach_defaults(GTK_TABLE(Table),AlbumEntry,1,10,2,3);
+ gtk_table_attach_defaults(GTK_TABLE(Table),AlbumEntry,1,7,2,3);
AlbumMButton = gtk_button_new();
//gtk_widget_set_size_request(AlbumMButton, 10, 10);
gtk_widget_set_size_request(AlbumMButton,MButtonSize,MButtonSize);
- gtk_table_attach(GTK_TABLE(Table),AlbumMButton,10,11,2,3,0,0,0,0);
+ gtk_table_attach(GTK_TABLE(Table),AlbumMButton,7,8,2,3,0,0,0,0);
g_signal_connect(G_OBJECT(AlbumMButton),"clicked",G_CALLBACK(Mini_Button_Clicked),NULL);
gtk_tooltips_set_tip(Tips,AlbumMButton,_("Tag selected files with this album name"),NULL);
@@ -568,6 +568,26 @@
g_object_set_data(G_OBJECT(AlbumEntry),"MButtonName",AlbumMButton);
g_signal_connect(G_OBJECT(AlbumEntry),"key_press_event", G_CALLBACK(Tag_Area_Entry_Key_Press),NULL);
+ /* Disc Number */
+ DiscNumberLabel = gtk_label_new(_("#:"));
+ gtk_table_attach(GTK_TABLE(Table),DiscNumberLabel,8,9,2,3,GTK_FILL,GTK_FILL,0,0);
+ gtk_misc_set_alignment(GTK_MISC(DiscNumberLabel),1,0.5);
+
+ DiscNumberEntry = gtk_entry_new();
+ gtk_table_attach_defaults(GTK_TABLE(Table),DiscNumberEntry,9,10,2,3);
+ gtk_widget_set_size_request(DiscNumberEntry,30,-1);
+
+ DiscNumberMButton = gtk_button_new();
+ //gtk_widget_set_size_request(DiscNumberMButton, 10, 10);
+ gtk_widget_set_size_request(DiscNumberMButton,MButtonSize,MButtonSize);
+ gtk_table_attach(GTK_TABLE(Table),DiscNumberMButton,10,11,2,3,0,0,0,0);
+ g_signal_connect(G_OBJECT(DiscNumberMButton),"clicked",G_CALLBACK(Mini_Button_Clicked),NULL);
+ gtk_tooltips_set_tip(Tips,DiscNumberMButton,_("Tag selected files with this disc number"),NULL);
+
+ Attach_Popup_Menu_To_Tag_Entries(GTK_ENTRY(DiscNumberEntry));
+ g_object_set_data(G_OBJECT(DiscNumberEntry),"MButtonName",DiscNumberMButton);
+ g_signal_connect(G_OBJECT(DiscNumberEntry),"key_press_event", G_CALLBACK(Tag_Area_Entry_Key_Press),NULL);
+
/* Year */
YearLabel = gtk_label_new(_("Year:"));
gtk_table_attach(GTK_TABLE(Table),YearLabel,0,1,3,4,GTK_FILL,GTK_FILL,0,0);
@@ -593,7 +613,7 @@
gtk_table_attach(GTK_TABLE(Table),Separator,3,4,3,4,GTK_FILL,GTK_FILL,2,2);
- /* Track */
+ /* Track and Track total */
TrackMButtonSequence = gtk_button_new();
gtk_widget_set_size_request(TrackMButtonSequence,MButtonSize,MButtonSize);
gtk_table_attach(GTK_TABLE(Table),TrackMButtonSequence,4,5,3,4,0,0,0,0);
@@ -625,7 +645,7 @@
Label = gtk_label_new("/");
gtk_table_attach(GTK_TABLE(Table),Label,7,8,3,4,GTK_FILL,GTK_FILL,0,0);
- gtk_misc_set_alignment(GTK_MISC(Label),1,0.5);
+ gtk_misc_set_alignment(GTK_MISC(Label),0.5,0.5);
TrackMButtonNbrFiles = gtk_button_new();
gtk_widget_set_size_request(TrackMButtonNbrFiles,MButtonSize,MButtonSize);
@@ -817,7 +837,8 @@
// Managing of entries when pressing the Enter key
g_signal_connect_swapped(G_OBJECT(TitleEntry), "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(ArtistEntry));
g_signal_connect_swapped(G_OBJECT(ArtistEntry), "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(AlbumEntry));
- g_signal_connect_swapped(G_OBJECT(AlbumEntry), "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(YearEntry));
+ g_signal_connect_swapped(G_OBJECT(AlbumEntry), "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(DiscNumberEntry));
+ g_signal_connect_swapped(G_OBJECT(DiscNumberEntry), "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(YearEntry));
g_signal_connect_swapped(G_OBJECT(YearEntry), "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(GTK_ENTRY(GTK_BIN(TrackEntryCombo)->child)));
g_signal_connect_swapped(G_OBJECT(GTK_ENTRY(GTK_BIN(TrackEntryCombo)->child)),"activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(TrackTotalEntry));
g_signal_connect_swapped(G_OBJECT(TrackTotalEntry), "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(GTK_BIN(GenreCombo)->child));
@@ -827,6 +848,7 @@
g_signal_connect_swapped(G_OBJECT(OrigArtistEntry), "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(CopyrightEntry));
g_signal_connect_swapped(G_OBJECT(CopyrightEntry), "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(URLEntry));
g_signal_connect_swapped(G_OBJECT(URLEntry), "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(EncodedByEntry));
+ g_signal_connect_swapped(G_OBJECT(URLEntry), "activate",G_CALLBACK(gtk_widget_grab_focus),G_OBJECT(TitleEntry));
/*
@@ -1043,6 +1065,25 @@
else
msg = g_strdup(_("Removed album name from selected files."));
}
+ else if (object==G_OBJECT(DiscNumberMButton))
+ {
+ string_to_set = gtk_editable_get_chars(GTK_EDITABLE(DiscNumberEntry),0,-1);
+ while (selfilelist)
+ {
+ etfile = Browser_List_Get_ETFile_From_Path(selfilelist->data);
+ FileTag = ET_File_Tag_Item_New();
+ ET_Copy_File_Tag_Item(etfile,FileTag);
+ ET_Set_Field_File_Tag_Item(&FileTag->disc_number,string_to_set);
+ ET_Manage_Changes_Of_File_Data(etfile,NULL,FileTag);
+
+ if (!selfilelist->next) break;
+ selfilelist = g_list_next(selfilelist);
+ }
+ if (string_to_set != NULL && g_utf8_strlen(string_to_set, -1)>0)
+ msg = g_strdup_printf(_("Selected files tagged with disc number '%s'."),string_to_set);
+ else
+ msg = g_strdup(_("Removed disc number from selected files."));
+ }
else if (object==G_OBJECT(YearMButton))
{
string_to_set = gtk_editable_get_chars(GTK_EDITABLE(YearEntry),0,-1);
@@ -3121,6 +3162,7 @@
gtk_widget_set_sensitive(GTK_WIDGET(TitleEntry), activate);
gtk_widget_set_sensitive(GTK_WIDGET(ArtistEntry), activate);
gtk_widget_set_sensitive(GTK_WIDGET(AlbumEntry), activate);
+ gtk_widget_set_sensitive(GTK_WIDGET(DiscNumberEntry), activate);
gtk_widget_set_sensitive(GTK_WIDGET(YearEntry), activate);
gtk_widget_set_sensitive(GTK_WIDGET(TrackEntryCombo), activate);
gtk_widget_set_sensitive(GTK_WIDGET(TrackTotalEntry), activate);
@@ -3130,6 +3172,7 @@
// Mini buttons
gtk_widget_set_sensitive(GTK_WIDGET(TitleMButton), activate);
gtk_widget_set_sensitive(GTK_WIDGET(ArtistMButton), activate);
+ gtk_widget_set_sensitive(GTK_WIDGET(DiscNumberMButton), activate);
gtk_widget_set_sensitive(GTK_WIDGET(AlbumMButton), activate);
gtk_widget_set_sensitive(GTK_WIDGET(YearMButton), activate);
gtk_widget_set_sensitive(GTK_WIDGET(TrackMButton), activate);
@@ -3191,6 +3234,9 @@
if (!WRITE_ID3V2_TAG)
{
// Hide specifics ID3v2 fields if not activated!
+ gtk_widget_hide(GTK_WIDGET(DiscNumberLabel));
+ gtk_widget_hide(GTK_WIDGET(DiscNumberEntry));
+ gtk_widget_hide(GTK_WIDGET(DiscNumberMButton));
gtk_widget_hide(GTK_WIDGET(ComposerLabel));
gtk_widget_hide(GTK_WIDGET(ComposerEntry));
gtk_widget_hide(GTK_WIDGET(ComposerMButton));
@@ -3215,6 +3261,9 @@
gtk_widget_hide(GTK_WIDGET(PicturePropertiesButton));
}else
{
+ gtk_widget_show(GTK_WIDGET(DiscNumberLabel));
+ gtk_widget_show(GTK_WIDGET(DiscNumberEntry));
+ gtk_widget_show(GTK_WIDGET(DiscNumberMButton));
gtk_widget_show(GTK_WIDGET(ComposerLabel));
gtk_widget_show(GTK_WIDGET(ComposerEntry));
gtk_widget_show(GTK_WIDGET(ComposerMButton));
@@ -3242,6 +3291,9 @@
#ifdef ENABLE_OGG
case OGG_TAG:
+ gtk_widget_show(GTK_WIDGET(DiscNumberLabel));
+ gtk_widget_show(GTK_WIDGET(DiscNumberEntry));
+ gtk_widget_show(GTK_WIDGET(DiscNumberMButton));
gtk_widget_show(GTK_WIDGET(ComposerLabel));
gtk_widget_show(GTK_WIDGET(ComposerEntry));
gtk_widget_show(GTK_WIDGET(ComposerMButton));
@@ -3269,6 +3321,9 @@
#ifdef ENABLE_FLAC
case FLAC_TAG:
+ gtk_widget_show(GTK_WIDGET(DiscNumberLabel));
+ gtk_widget_show(GTK_WIDGET(DiscNumberEntry));
+ gtk_widget_show(GTK_WIDGET(DiscNumberMButton));
gtk_widget_show(GTK_WIDGET(ComposerLabel));
gtk_widget_show(GTK_WIDGET(ComposerEntry));
gtk_widget_show(GTK_WIDGET(ComposerMButton));
@@ -3295,6 +3350,9 @@
#endif
case APE_TAG:
+ gtk_widget_show(GTK_WIDGET(DiscNumberLabel));
+ gtk_widget_show(GTK_WIDGET(DiscNumberEntry));
+ gtk_widget_show(GTK_WIDGET(DiscNumberMButton));
gtk_widget_show(GTK_WIDGET(ComposerLabel));
gtk_widget_show(GTK_WIDGET(ComposerEntry));
gtk_widget_show(GTK_WIDGET(ComposerMButton));
@@ -3321,6 +3379,9 @@
case UNKNOWN_TAG:
default:
+ gtk_widget_hide(GTK_WIDGET(DiscNumberLabel));
+ gtk_widget_hide(GTK_WIDGET(DiscNumberEntry));
+ gtk_widget_hide(GTK_WIDGET(DiscNumberMButton));
gtk_widget_hide(GTK_WIDGET(ComposerLabel));
gtk_widget_hide(GTK_WIDGET(ComposerEntry));
gtk_widget_hide(GTK_WIDGET(ComposerMButton));
@@ -3360,6 +3421,7 @@
gtk_entry_set_text(GTK_ENTRY(TitleEntry), "");
gtk_entry_set_text(GTK_ENTRY(ArtistEntry), "");
gtk_entry_set_text(GTK_ENTRY(AlbumEntry), "");
+ gtk_entry_set_text(GTK_ENTRY(DiscNumberEntry), "");
gtk_entry_set_text(GTK_ENTRY(YearEntry), "");
gtk_entry_set_text(GTK_ENTRY(GTK_BIN(TrackEntryCombo)->child), "");
gtk_entry_set_text(GTK_ENTRY(TrackTotalEntry), "");
@@ -3439,7 +3501,8 @@
/*
- * Attach event to the entry to select previous or next file when pression PageUp and PageDown keys.
+ * Attach event to the entry to select previous or next file when pressing
+ * the PageUp and PageDown keys.
*/
gboolean Tag_Area_Entry_Key_Press (GtkWidget *widget, GdkEvent *event)
{
diff -ruN easytag-1.99.3/src/easytag.h easytag-1.99.3-disc_number/src/easytag.h
--- easytag-1.99.3/src/easytag.h 2004-11-26 00:45:22.000000000 +0100
+++ easytag-1.99.3-disc_number/src/easytag.h 2005-01-31 22:50:48.000000000 +0100
@@ -87,6 +87,7 @@
GtkWidget *TitleEntry;
GtkWidget *ArtistEntry;
GtkWidget *AlbumEntry;
+GtkWidget *DiscNumberEntry;
GtkWidget *YearEntry;
GtkWidget *TrackEntryCombo;
GtkListStore *TrackEntryComboModel;
@@ -106,6 +107,7 @@
GtkWidget *TitleLabel;
GtkWidget *ArtistLabel;
GtkWidget *AlbumLabel;
+GtkWidget *DiscNumberLabel;
GtkWidget *YearLabel;
GtkWidget *TrackLabel;
GtkWidget *GenreLabel;
@@ -120,6 +122,7 @@
GtkWidget *TitleMButton;
GtkWidget *ArtistMButton;
GtkWidget *AlbumMButton;
+GtkWidget *DiscNumberMButton;
GtkWidget *YearMButton;
GtkWidget *TrackMButton;
GtkWidget *TrackMButtonSequence;
diff -ruN easytag-1.99.3/src/et_core.c easytag-1.99.3-disc_number/src/et_core.c
--- easytag-1.99.3/src/et_core.c 2004-11-29 22:32:56.000000000 +0100
+++ easytag-1.99.3-disc_number/src/et_core.c 2005-01-31 22:26:16.000000000 +0100
@@ -341,6 +341,7 @@
FileTag->title = NULL;
FileTag->artist = NULL;
FileTag->album = NULL;
+ FileTag->disc_number = NULL;
FileTag->track = NULL;
FileTag->track_total = NULL;
FileTag->year = NULL;
@@ -2001,6 +2002,7 @@
g_free(FileTag->title);
g_free(FileTag->artist);
g_free(FileTag->album);
+ g_free(FileTag->disc_number);
g_free(FileTag->year);
g_free(FileTag->track);
g_free(FileTag->track_total);
@@ -2161,6 +2163,15 @@
FileTag->album = NULL;
}
+ if (FileTagCur->disc_number)
+ {
+ FileTag->disc_number = g_strdup(FileTagCur->disc_number);
+ }else
+ {
+ g_free(FileTag->disc_number);
+ FileTag->disc_number = NULL;
+ }
+
if (FileTagCur->year)
{
FileTag->year = g_strdup(FileTagCur->year);
@@ -2559,6 +2570,12 @@
else
gtk_entry_set_text(GTK_ENTRY(AlbumEntry),"");
+ /* Show disc_number */
+ if (FileTag && FileTag->disc_number)
+ gtk_entry_set_text(GTK_ENTRY(DiscNumberEntry), FileTag->disc_number);
+ else
+ gtk_entry_set_text(GTK_ENTRY(DiscNumberEntry),"");
+
/* Show year */
if (FileTag && FileTag->year)
gtk_entry_set_text(GTK_ENTRY(YearEntry),FileTag->year);
@@ -2944,6 +2961,18 @@
g_free(buffer);
}
+ /* Disc Number */
+ buffer = g_strdup(gtk_entry_get_text(GTK_ENTRY(DiscNumberEntry)));
+ Strip_String(buffer);
+
+ if ( g_utf8_strlen(buffer, -1) > 0 )
+ FileTag->disc_number = buffer;
+ else
+ {
+ FileTag->disc_number = NULL;
+ g_free(buffer);
+ }
+
/* Year */
buffer = g_strdup(gtk_entry_get_text(GTK_ENTRY(YearEntry)));
Strip_String(buffer);
@@ -3152,6 +3181,17 @@
Strip_String(FileTag->album);
+ /* Disc Number */
+ if ( FileTagCur->disc_number && g_utf8_strlen(FileTagCur->disc_number, -1)>0 )
+ {
+ FileTag->disc_number = g_strdup(FileTagCur->disc_number);
+ } else
+ {
+ FileTag->disc_number = NULL;
+ }
+ Strip_String(FileTag->disc_number);
+
+
/* Year */
if ( FileTagCur->year && g_utf8_strlen(FileTagCur->year, -1)>0 )
{
@@ -3526,6 +3566,11 @@
if (!FileTag1->album && FileTag2->album && g_utf8_strlen(FileTag2->album, -1)>0 ) return TRUE;
if ( FileTag1->album && FileTag2->album && g_utf8_collate(FileTag1->album,FileTag2->album)!=0 ) return TRUE;
+ /* Disc Number */
+ if ( FileTag1->disc_number && !FileTag2->disc_number && g_utf8_strlen(FileTag1->disc_number, -1)>0 ) return TRUE;
+ if (!FileTag1->disc_number && FileTag2->disc_number && g_utf8_strlen(FileTag2->disc_number, -1)>0 ) return TRUE;
+ if ( FileTag1->disc_number && FileTag2->disc_number && g_utf8_collate(FileTag1->disc_number,FileTag2->disc_number)!=0 ) return TRUE;
+
/* Year */
if ( FileTag1->year && !FileTag2->year && g_utf8_strlen(FileTag1->year, -1)>0 ) return TRUE;
if (!FileTag1->year && FileTag2->year && g_utf8_strlen(FileTag2->year, -1)>0 ) return TRUE;
@@ -4232,6 +4277,7 @@
g_print("| |-> title : '%s'\n",((File_Tag *)filetaglist->data)->title);
g_print("| |-> artist : '%s'\n",((File_Tag *)filetaglist->data)->artist);
g_print("| |-> album : '%s'\n",((File_Tag *)filetaglist->data)->album);
+ g_print("| |-> disc_number : '%s'\n",((File_Tag *)filetaglist->data)->disc_number);
g_print("| |-> year : '%s'\n",((File_Tag *)filetaglist->data)->year);
g_print("| |-> track : '%s'\n",((File_Tag *)filetaglist->data)->track);
g_print("| |-> track_total : '%s'\n",((File_Tag *)filetaglist->data)->track_total);
diff -ruN easytag-1.99.3/src/et_core.h easytag-1.99.3-disc_number/src/et_core.h
--- easytag-1.99.3/src/et_core.h 2005-01-13 22:39:05.000000000 +0100
+++ easytag-1.99.3-disc_number/src/et_core.h 2005-01-31 21:59:53.000000000 +0100
@@ -171,6 +171,7 @@
gchar *title; /* Title of track */
gchar *artist; /* Artist name */
gchar *album; /* Album name */
+ gchar *disc_number; /* Disc number */
gchar *year; /* Year of track */
gchar *track; /* Position of track in the album */
gchar *track_total; /* The number of tracks for the album (ex: 12/20) */
diff -ruN easytag-1.99.3/src/flac_tag.c easytag-1.99.3-disc_number/src/flac_tag.c
--- easytag-1.99.3/src/flac_tag.c 2004-11-23 18:13:26.000000000 +0100
+++ easytag-1.99.3-disc_number/src/flac_tag.c 2005-01-31 22:46:09.000000000 +0100
@@ -209,6 +209,24 @@
}
}
+ /***************
+ * Disc Number *
+ ***************/
+ if ( (field_num = FLAC__metadata_object_vorbiscomment_find_entry_from(vc_block,0,"DISCNUMBER")) >= 0 )
+ {
+ /* Extract field value */
+ field = &vc->comments[field_num];
+ field_value = memchr(field->entry, '=', field->length);
+
+ if ( field_value && g_utf8_strlen(field_value, -1) > 0 )
+ {
+ field_value++;
+ field_len = field->length - (field_value - (gchar*) field->entry);
+ field_value = g_strndup(field_value, field_len);
+ FileTag->year = field_value;
+ }
+ }
+
/********
* Year *
********/
@@ -458,6 +476,7 @@
if ( strncasecmp(field->entry,"TITLE=", MIN(6, field->length)) != 0
&& strncasecmp(field->entry,"ARTIST=", MIN(7, field->length)) != 0
&& strncasecmp(field->entry,"ALBUM=", MIN(6, field->length)) != 0
+ && strncasecmp(field->entry,"DISCNUMBER=", MIN(11, field->length)) != 0
&& strncasecmp(field->entry,"DATE=", MIN(5, field->length)) != 0
&& strncasecmp(field->entry,"TRACKNUMBER=", MIN(12, field->length)) != 0
&& strncasecmp(field->entry,"GENRE=", MIN(6, field->length)) != 0
@@ -480,6 +499,7 @@
if ( FileTag->title == NULL
&& FileTag->artist == NULL
&& FileTag->album == NULL
+ && FileTag->disc_number == NULL
&& FileTag->year == NULL
&& FileTag->track == NULL
&& FileTag->track_total == NULL
@@ -497,6 +517,7 @@
if ( FileTag->title != NULL
|| FileTag->artist != NULL
|| FileTag->album != NULL
+ || FileTag->disc_number != NULL
|| FileTag->year != NULL
|| FileTag->track != NULL
|| FileTag->track_total != NULL
@@ -596,6 +617,18 @@
g_free(string);
}
+ /***************
+ * Disc Number *
+ ***************/
+ if ( FileTag->disc_number )
+ {
+ string = g_strconcat("DISCNUMBER=",FileTag->disc_number,NULL);
+ field.entry = string;
+ field.length = strlen(string);
+ FLAC__metadata_object_vorbiscomment_insert_comment(vc_block,vc_block->data.vorbis_comment.num_comments,field,true);
+ g_free(string);
+ }
+
/********
* Year *
********/
diff -ruN easytag-1.99.3/src/id3_tag.c easytag-1.99.3-disc_number/src/id3_tag.c
--- easytag-1.99.3/src/id3_tag.c 2004-12-29 23:47:34.000000000 +0100
+++ easytag-1.99.3-disc_number/src/id3_tag.c 2005-01-31 22:10:01.000000000 +0100
@@ -198,6 +198,22 @@
}
+ /************************
+ * Part of a set (TPOS) *
+ ************************/
+ if ( (id3_frame = ID3Tag_FindFrameWithID(id3_tag,ID3FID_PARTINSET)) )
+ {
+ if ( (id3_field = ID3Frame_GetField(id3_frame,ID3FN_TEXT)) )
+ {
+ if ( (num_chars=ID3Field_GetASCII_1(id3_field,string,ID3V2_MAX_STRING_LEN,field_num)) > 0
+ && string != NULL )
+ {
+ HANDLE_TRANSLATION_READ(FileTag->disc_number, string);
+ }
+ }
+ }
+
+
/***************
* Year (TYER) *
***************/
@@ -517,6 +533,7 @@
gboolean has_title = 1;
gboolean has_artist = 1;
gboolean has_album = 1;
+ gboolean has_disc_number = 1;
gboolean has_year = 1;
gboolean has_track = 1;
gboolean has_genre = 1;
@@ -627,6 +644,26 @@
}
+ /***************
+ * Part of set *
+ ***************/
+ while ( (id3_frame = ID3Tag_FindFrameWithID(id3_tag,ID3FID_PARTINSET)) )
+ ID3Tag_RemoveFrame(id3_tag,id3_frame);
+ if (FileTag->album && g_utf8_strlen(FileTag->disc_number, -1) > 0)
+ {
+ id3_frame = ID3Frame_NewID(ID3FID_PARTINSET);
+ ID3Tag_AttachFrame(id3_tag,id3_frame);
+
+ if ((id3_field = ID3Frame_GetField(id3_frame,ID3FN_TEXT)))
+ {
+ HANDLE_TRANSLATION_SAVE(string, FileTag->disc_number, id3_field);
+ }
+ } else
+ {
+ has_disc_number = 0;
+ }
+
+
/********
* Year *
********/
@@ -939,7 +976,7 @@
if ( STRIP_TAG_WHEN_EMPTY_FIELDS
&& !has_title && !has_artist && !has_album && !has_year && !has_track
&& !has_genre && !has_composer && !has_orig_artist && !has_copyright && !has_url
- && !has_encoded_by && !has_picture && !has_comment )//&& !has_song_len )
+ && !has_encoded_by && !has_picture && !has_comment && !has_disc_number)//&& !has_song_len )
{
error_strip_id3v1 = ID3Tag_Strip(id3_tag,ID3TT_ID3V1);
error_strip_id3v2 = ID3Tag_Strip(id3_tag,ID3TT_ID3V2);
diff -ruN easytag-1.99.3/src/ogg_tag.c easytag-1.99.3-disc_number/src/ogg_tag.c
--- easytag-1.99.3/src/ogg_tag.c 2004-12-02 00:32:11.000000000 +0100
+++ easytag-1.99.3-disc_number/src/ogg_tag.c 2005-01-31 22:13:55.000000000 +0100
@@ -217,6 +217,12 @@
}
}
+ /*******************************
+ * Disc Number (Part of a Set) *
+ *******************************/
+ if ( (string = vorbis_comment_query(vc,"DISCNUMBER",0)) != NULL && g_utf8_strlen(string, -1) > 0 )
+ FileTag->disc_number = g_strdup(string);
+
/********
* Year *
********/
@@ -382,6 +388,7 @@
if ( strncasecmp(vc->user_comments[i],"TITLE=", 6) != 0
&& strncasecmp(vc->user_comments[i],"ARTIST=", 7) != 0
&& strncasecmp(vc->user_comments[i],"ALBUM=", 6) != 0
+ && strncasecmp(vc->user_comments[i],"DISCNUMBER=", 11) != 0
&& strncasecmp(vc->user_comments[i],"DATE=", 5) != 0
&& strncasecmp(vc->user_comments[i],"TRACKNUMBER=",12) != 0
&& strncasecmp(vc->user_comments[i],"GENRE=", 6) != 0
@@ -512,6 +519,16 @@
g_free(string);
}
+ /***************
+ * Disc Number *
+ ***************/
+ if ( FileTag->disc_number )
+ {
+ string = g_strconcat("DISCNUMBER=",FileTag->disc_number,NULL);
+ vorbis_comment_add(vc,string);
+ g_free(string);
+ }
+
/********
* Year *
********/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]