🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #1441

Re: Script en bash para grabar programa de radio por internet

#1441
From: AnimAlf
Date: Wed, 02 Nov 2005 17:40
45 lines
2523 bytes
El mié, 02-11-2005 a las 08:11 +0100, Artabros escribió:
>     El caso es q curiosamente el mplayer se detiene (o al menos lo hizo
> las dos veces que lo intenté), pero bien pasados los $minutos y
> siempre con el  mismo tamaño de fichero resultante, como ya dije. No
> sé... parece más que se detiene por algún límite en el tamaño
> de1 fichero que por otra cosa. Sin embargo 194783607 bytes (unos 186Mb) no
> me suena a límite de ningún tipo  :?

Puedes matarlo si no ha obedecido, en C lo haría así
#include <time.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>

#define _HORA_FIN_ 18
#define _MIN_FIN_ 17

/* falta asignar $emisora */

int main(void) {
   int pid;
   struct tm *tptr;
   time_t t;
   pid=fork();
   if (pid == 0){ 
      execlp("mplayer", "mplayer", "-playlist $emisora", "-ao
pcm:file=/tmp/radio_pipe 2",NULL);
   } else {
      do {
         t = time(NULL);
         tptr = localtime(&t);
         sleep(5);
      } while ((tptr->tm_hour<(int)_HORA_FIN_) &&
(tptr->tm_min<=(int)_MIN_FIN_));
      kill(pid,SIGTERM);
      printf("\ntodo termino bien. %d:%d \n
\n",tptr->tm_hour,tptr->tm_min);
   }
   return 0;
}

Saludos
Technical Details
Message-ID: <1130953210.22964.12.camel@localhost.localdomain>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!telenews.teleline.es!not-for-mail
References: <pan.2005.11.01.10.27.44.528274@gmail.com> <slrndmg49o.4nk.claudio@example.org> <pan.2005.11.02.07.11.06.43908@gmail.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f86c8,bbbc0ab481634926
X-Google-Attributes: gidf86c8,public
X-Google-Language: SPANISH,UTF8
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!telenews.teleline.es!not-for-mail
X-Trace-PostClient-IP: 80.32.76.249
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Script en bash para grabar programa de radio por internet
From: AnimAlf <AnimAlf@engendro.sytes.net>
In-Reply-To: <pan.2005.11.02.07.11.06.43908@gmail.com>
References: <pan.2005.11.01.10.27.44.528274@gmail.com>
  <slrndmg49o.4nk.claudio@example.org>
  <pan.2005.11.02.07.11.06.43908@gmail.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Organization: Is the trut out there?
Message-ID: <1130953210.22964.12.camel@localhost.localdomain>
Mime-Version: 1.0
X-Mailer: Evolution 2.4.1 
Lines: 47
Date: Wed, 02 Nov 2005 17:40:05 GMT
NNTP-Posting-Host: 10.20.31.4
X-Complaints-To: usenet@teleline.es
X-Trace: telenews.teleline.es 1130953205 10.20.31.4 (Wed, 02 Nov 2005 18:40:05 MET)
NNTP-Posting-Date: Wed, 02 Nov 2005 18:40:05 MET