Exemple #1
0
static void print_id3_tag(FILE *fp, char *buf)
{
	struct id3tag {
		char tag[3];
		char title[30];
		char artist[30];
		char album[30];
		char year[4];
		char comment[30];
		unsigned char genre;
	};
	struct idxtag {
		char tag[3];
		char title[90];
		char artist[50];
		char album[50];
		char comment[50];
	};
	struct id3tag *tag = (struct id3tag *) buf;
	struct idxtag *xtag = (struct idxtag *) buf;
	char title[121]="\0";
	char artist[81]="\0";
	char album[81]="\0";
	char year[5]="\0";
	char comment[81]="\0";

	strncpy(title,tag->title,30);
	strncpy(artist,tag->artist,30);
	strncpy(album,tag->album,30);
	strncpy(year,tag->year,4);
	strncpy(comment,tag->comment,30);
	strunpad(title);
	strunpad(artist);
	strunpad(album);
	strunpad(comment);
	
	if ((fseek(fp, 384, SEEK_END) != -1) && (fread(buf, 256, 1, fp) == 1))
	{
		if (!strncmp(buf, "TXG", 3))
		{
			strncat(title, xtag->title, 90);
			strncat(artist, xtag->artist, 50);
			strncat(album, xtag->album, 50);
			strncat(comment, xtag->comment, 50);
			strunpad(title);
			strunpad(artist);
			strunpad(album);
			strunpad(comment);
		}
	}
	if (!do_hook(MODULE_LIST, "AMP ID3 \"%s\" \"%s\" \"%s\" %s %d %s", title, artist, album, year, tag->genre, comment))
	{
		bitchsay("Title  : %.120s  Artist: %s",title, artist);
		bitchsay("Album  : %.80s  Year: %4s, Genre: %d",album, year, (int)tag->genre);
		bitchsay("Comment: %.80s",comment);
	}
}
Exemple #2
0
char *strrj(char dstrg[], char strg[], int pos, int len)
  {
   register int i;
   register int j;
   int slen;
   if (len < 0)
      len = -len;
   strlj(dstrg,strg,pos,len);
   slen = strlen(dstrg);
   strunpad(dstrg,' ',slen);
   slen = strlen(dstrg);
   for (i=slen-1,j=len-1; i >=0; i--,j--)
     {
      dstrg[j] = dstrg[i];
     }
   for(; j >= 0; j--)
     {
      dstrg[j] = ' ';
     }
   dstrg[len] = 0;
   return dstrg;
  }