Re: Feature-Request: MarginStart in INFO file of recording

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 02 Nov 2010 20:54:06 +0100, Udo Richter <udo_richter@xxxxxx>
wrote:
> Am 02.11.2010 12:20, schrieb Rene Bartsch:
>> So I suggest to add start margin (and maybe stop margin) to the info
>> files
>> of recordings.
> 
> There is no fixed start/stop margin. I have some timers with 5min before
> / 10min after, and others with 10min before and 30min after. Depends on
> how much delays the channel usually has.

I'm talking about the MARGINSTART in setup.conf or a manually per
recording
set one.

The idea is simple:

1.) Create an OTR filename from the information in the info file
    (as VDR and OTR recordings use EPG data, it's simple regex parsing)

2.) Download a cutlist for the corresponding OTR recording at Cutlist.at
    (preferably rated with 5.00)

3.) Substract the 360 seconds OTR standard leader from the cut marks

4.) Add the preset VDR leader (MARGINSTART) to the cut marks

5.) Convert the cut marks to VDR marks file

6.) Be happy

Only precondition: Reliable clock in the VDR machine (e.g. radio clock or
NTP)

> Also, this would help only partially, as there's no guarantee that
> start/stop margin is actually part of the recording. The time in the
> folder name is just the timer time, not necessarily the recording start
> time. Differences may appear on VPS recordings, timers set/enabled after
> start time, and recordings that couldn't be started because of downtime
> or missing devices.

There's no guarantee you survive crossing the street at your home. ;-)

If the VDR clock is reliable and the recording is not started delayed you
get
perfect cuts. Tried that with impressing results on a Indiana Jones
recording.

Just consider: VDR stores the UNIX_TimeStamp of the EPG event which is the
same for OTR recordings. To adjust the cutmarks you only need to know the
recording start offsets of the VDR machine and OTR.

So VDR just has to store the offset between EPG event UNIX_TimeStamp and
real recording start in the info file (tried that with fixed
MARGINSTART=10
and 360 seconds for the OTR leader -> perfect match)

For delayed starts the margin in the info file 

Best regards,

Renne



P.S: The script is a dirty hack - just a proof of concept:

#!/bin/bash


# Parameters
# $1: Absolute path to recording directory
# $2: OTR name of station (e.g. 'sat1' instead of 'SAT.1')



# Cutlist rating (cutlist.at x 100, max. 500)
RATING=500


# VDR video directory
VIDEODIR=/home/vdr/video


# VDR start margin in seconds
MARGINSTART_VDR=600


# OTR start margin in seconds
MARGINSTART_OTR=360


INFO="`head -n3 $1/info`"
STATION="$(echo $INFO | sed -r -n s/'^C .* (.*) E [0-9]+ ([0-9]+) ([0-9]+)
[0-9]+[A-Z]+ [0-9]+ T (.*)$'/\\1/p)"
START="$(echo $INFO | sed -r -n s/'^C .* (.*) E [0-9]+ ([0-9]+) ([0-9]+)
[0-9]+[A-Z]+ [0-9]+ T (.*)$'/\\2/p)"
DURATION="$(echo $INFO | sed -r -n s/'^C .* (.*) E [0-9]+ ([0-9]+)
([0-9]+) [0-9]+[A-Z]+ [0-9]+ T (.*)$'/\\3/p)"
TITLE="$(echo $INFO | sed -r -n s/'^C .* (.*) E [0-9]+ ([0-9]+) ([0-9]+)
[0-9]+[A-Z]+ [0-9]+ T (.*)$'/\\4/p)"


# Stations
STATION="$2"


# Umlauts
TITLE="${TITLE//Ã/Ae}"
TITLE="${TITLE//Ã/Oe}"
TITLE="${TITLE//Ã/Ue}"
TITLE="${TITLE//Ã/ae}"
TITLE="${TITLE//Ã/oe}"
TITLE="${TITLE//Ã/ue}"
TITLE="${TITLE//Ã/ss}"


URL="http://cutlist.at/getxml.php?name=${TITLE// /_}_`date -d @$START
+%y.%m.%d_%H-%M`_${STATION}_$(($DURATION/60))_TVOON_DE.mpg.avi"
XML="`wget --quiet -O - $URL`"
if [ "$(echo -e "$XML" | sed -r -n s:'<rating>(.*)<\/rating>':\\1:p | sed
-r -n s:'([0-9]).([0-9]+)':\\1\\2:p | head -n1)" -ge $RATING ]; then {
    URL="http://cutlist.at/getfile.php?id=$(echo -e "$XML" | sed -r -n
s:'<id>(.*)<\/id>':\\1:p | head -n1)"
    declare -a MARK
    MARK=(`wget --quiet -O - $URL`)
    for((i=0; i<${#MARK[*]}; i++)); do {
	case "${MARK[$i]}" in
	    Start*)
		MARK[$i]=`calc ${MARK[$i]#Start=} + $MARGINSTART_VDR - $MARGINSTART_OTR`
		SEC="${MARK[$i]%.*}"
		MSEC="${MARK[$i]#*.}"
		MSEC="${MSEC:0:2}"
		MARKS+="`printf %1d:%02d:%02d.%02d $(($SEC/3600)) $(($SEC%3600/60))
$(($SEC%3600%60)) $MSEC`"
	    ;;
	    Duration*)
		MARK[$i]=`calc ${MARK[$i-1]} + ${MARK[$i]#Duration=}`
		SEC="${MARK[$i]%.*}"
		MSEC="${MARK[$i]#*.}"
		MSEC="${MSEC:0:2}"
		MARKS+="`printf %1d:%02d:%02d.%02d $(($SEC/3600)) $(($SEC%3600/60))
$(($SEC%3600%60)) $MSEC`"
	    ;;
	    *)
	    ;;
	esac
    }; done
    echo -e "${MARKS//Â/\n}" > "$1\marks"
    cat  "$1\marks"
}; fi


_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr



[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux