🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#1440
From: AnimAlf
Date: Wed, 02 Nov 2005 17:24
49 lines
2505 bytes
El mié, 02-11-2005 a las 08:11 +0100, Artabros escribió:
>    Hola,
hola
> 
>      mi intención es grabar únicamente $minutos min. de programa (es
> decir, lo que dura). Date cuenta que quiero meter este script en el cron
> para que se ejecute solo y, a la hora que termina el programa, yo ya estoy
> durmiendo.

puedes forzarlo a morir. en C sería

#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 a $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);
	 printf("\nhora actual: %d:%d   vs   %d:%d\n",
		tptr->tm_hour,tptr->tm_min,_HORA_FIN_,_MIN_FIN_);
      } 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: <1130952299.22964.5.camel@localhost.localdomain>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newshub.sdsu.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!nntp.theplanet.net!inewsm1.nntp.theplanet.net!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!news3.google.com!newshub.sdsu.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!nntp.theplanet.net!inewsm1.nntp.theplanet.net!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: <1130952299.22964.5.camel@localhost.localdomain>
Mime-Version: 1.0
X-Mailer: Evolution 2.4.1 
Lines: 50
Date: Wed, 02 Nov 2005 17:24:54 GMT
NNTP-Posting-Host: 10.20.31.4
X-Complaints-To: usenet@teleline.es
X-Trace: telenews.teleline.es 1130952294 10.20.31.4 (Wed, 02 Nov 2005 18:24:54 MET)
NNTP-Posting-Date: Wed, 02 Nov 2005 18:24:54 MET