Audio-RaveMP

 view release on metacpan or  search on metacpan

ravemp.c  view on Meta::CPAN

		blk2no = i;

	    avail++;

	}
    }

    /* Get file information (note we simplistically determine if it's an MP3
       file or not by checking for a .mp3 extension) */

    if (stat(fname,&fileinfo) != 0) {
	RMP_TRACE(fprintf(stderr, "Unable to access file %s\n",fname));
	return 0;
    }

    fsize = fileinfo.st_size;

    fblocks = (fsize+DATA_SIZE-1)/DATA_SIZE;

    RMP_TRACE(fprintf(stderr, "File size: %u bytes [%u blocks needed, %u available]\n",fsize,fblocks,avail));

ravemp.c  view on Meta::CPAN

    /* Extract filename, which is spread across the tags, starting at offset 20 (we
       assume the name length to less than 256-20 or 226 characters) */

    for (i=0;i<256/TAG_SIZE;i++)	/* Collect all tags into buffer */
	memcpy(&tagbuff[i*TAG_SIZE],datablk+i*(PAGE_SIZE+TAG_SIZE)+PAGE_SIZE,TAG_SIZE);

    RMP_TRACE(fprintf(stderr, "File Name: %s File Size: %u\n",&tagbuff[20],fsize)); /**/

    /* Check if file already exists */

    if (stat(&tagbuff[20],&fileinfo) == 0) {
	RMP_TRACE(fprintf(stderr, "\n*** File with same name already exists - download cancelled ***\n"));
	free(baseblk);
	free(datablk);
	return 0;
    }

    /* Create file to save data in */

    if (dest == NULL) {
	dest = &tagbuff[20];



( run in 1.226 second using v1.01-cache-2.11-cpan-49f99fa48dc )