-
1
- #1
I just got a video capture card, and am running linux. I want to add cronjobs that record shows, and I like to record as I watch (so I can pause live TV and stuff)... Now the hard part of getting my Linux box up and running with the card is over, but I want to write a couple of scripts and I have a couple of problems...
To record I use:
dd if=/dev/video0 of=<file>
and then to watch as I record, I already have a script that does the above followed by starting my movie player with <file>... that's all fine.
xine file:<file>
When I want to record a show I like, and I've been watching already, the cron job will not run, and the file wouldn't get the right name... What I would love is for the scripts I run in the cron job to check to see if I am recording/watching already, if I am, kill the current process... And since I'm there restart the player. Otherwise record without starting the player.
When done rename the shows I want to record something meaningful and move it to a better location.
What I am thinking is a lock file of sorts maybe... perhaps the movie it's self?
Current watching script
What I am thinking for the cron jobs
Then a cron job to kill the dd when the show ends (and maybe commercial -- if I get daring). This has some obvious problems, and I still need to write the kill script.. And I don't like killalling xine and dd as I might be using them in other tasks. I'd like to keep the pids, but I'm not sure where or how.
To record I use:
dd if=/dev/video0 of=<file>
and then to watch as I record, I already have a script that does the above followed by starting my movie player with <file>... that's all fine.
xine file:<file>
When I want to record a show I like, and I've been watching already, the cron job will not run, and the file wouldn't get the right name... What I would love is for the scripts I run in the cron job to check to see if I am recording/watching already, if I am, kill the current process... And since I'm there restart the player. Otherwise record without starting the player.
When done rename the shows I want to record something meaningful and move it to a better location.
What I am thinking is a lock file of sorts maybe... perhaps the movie it's self?
Current watching script
Code:
dd if=/dev/video0 of=watching &
sleep 10 # the player studers if I start watching too soon.
xine file:/home/streich/watching
killall dd #don't like this need PID of this dd...
What I am thinking for the cron jobs
Code:
i = 0
if[ -f /home/streich/watching]
killall xine
i = 1
rm /home/streich/watching
fi
ptune.pl -c $1
dd if=/dev/video0 of=/home/streich/watching &
# amp so it doesn't stop the script
if[ i -e 1]
xine /home/streich/watching & # amp so I can close xine
# w/o killing the record
fi
Then a cron job to kill the dd when the show ends (and maybe commercial -- if I get daring). This has some obvious problems, and I still need to write the kill script.. And I don't like killalling xine and dd as I might be using them in other tasks. I'd like to keep the pids, but I'm not sure where or how.