const SQInfo * sq_automation_find_info ( const char * const _name, int * _foundIndex )
{
   int i;

   for ( i = 0; i < NUMBER_OF_INFO; i++ )
   {
      if ( SQ_CONSTANT_STRCMP(_name, SQ_STRING_CONSTANT_FROM_ARRAY(&INFO_LIST[i].name)) == 0 )
      {
         if ( _foundIndex != NULL )
         {
            *_foundIndex = i;
         }
         return sq_get_info ( i );
      }
   }
   return NULL;
}
Esempio n. 2
0
int WebGetInfo(const char *FileName, struct File_Info *Info)
{
	struct stat Status;
	void 		*p;
	s32_t 		FileSize;
	u16_t		IcyInterval = 0;
	struct Extra_Headers *Headers = Info->extra_headers;

	while (Headers->name) {
		LOG_INFO("Headers: %s: %s", Headers->name, Headers->value);

		if (stristr(Headers->name, "Icy-MetaData") && sq_is_remote(FileName)) {
			char *p = malloc(128);

			IcyInterval = 32000;
			sprintf(p, "icy-metaint:%d", IcyInterval);
			Headers->resp = p;
		}

		Headers++;
	}

	if ((p = sq_get_info(FileName, &FileSize, &Info->content_type, NULL, IcyInterval)) == NULL) {
		return UPNP_E_FILE_NOT_FOUND;
	}

	Status.st_ctime 	= 0;
	Info->is_directory 	= false;
	Info->is_readable 	= true;
	Info->last_modified = Status.st_ctime;
	Info->file_length 	= FileSize;

	LOG_INFO("[%p]: GetInfo %s %Ld %s", p, FileName, (s64_t) Info->file_length, Info->content_type);

	return UPNP_E_SUCCESS;
}