diff -Nru chorder-1.0.0-20~85235fc/chorder chorder-1.0.0-21~9f9496c/chorder --- chorder-1.0.0-20~85235fc/chorder 2013-12-19 20:08:50.000000000 +0000 +++ chorder-1.0.0-21~9f9496c/chorder 2014-01-07 09:04:03.000000000 +0000 @@ -67,6 +67,9 @@ -o Write to the specified output file instead of stdout. -d Write debug messages to the specified file instead of sterr. -t Template file. + -U Unique channels only. If there are several channels with the + same name, provider and source, only the first channel is + selected and the remaining are filtered out. -v Verbose mode - print debug information. -h Print help. EOF @@ -89,7 +92,7 @@ ################################################################################ ############################## Parse arguments ################################# -while getopts 'x:X:f:F:i:o:d:t:vh' o +while getopts 'x:X:f:F:i:o:d:t:Uvh' o do case "$o" in x) @@ -128,6 +131,10 @@ TEMPLATE="$OPTARG" shift 2 ;; + U) + UNIQUE_ONLY='true' + shift 1 + ;; v) VERBOSE='true' shift 1 @@ -166,22 +173,25 @@ ################################################################################ ############################## Delete duplicates ############################### -debug '\nDuplicates:' -> "$TMP_OUTPUT_FILE" +if [ "$UNIQUE_ONLY" = 'true' ] +then + debug '\nFiltered out:' + > "$TMP_OUTPUT_FILE" -perl -ne 'print if s/'"$CH_PATTERN"'/$f7=(($7 eq 0) or (index($7, "0=", 0) eq 0)) ? "0(=.*)?" : "([1-9]|[0-9]{2,}?)(=.*)?"; " *(\\\\Q$1\\\\E) *".";"." *(\\\\Q$2\\\\E) *".":"." *(.+?) *".":"." *(.+?) *".":"." *(\\\\Q$5\\\\E) *".":"." *(.+?) *".":"." *($f7) *".":"." *(.+?) *".":"." *(.+?) *".":"." *(.+?) *".":"." *(.+?) *".":"." *(.+?) *".":"." *(.+?) *".":"." *(.+?) *"/ge' < "$TMP_INPUT_FILE" | sort -Vu | \ -while read i -do - grep -P "^ $i\$" < "$TMP_INPUT_FILE" | tee "$TMP_FILE" | head -n 1 >> "$TMP_OUTPUT_FILE" + perl -ne 'print if s/'"$CH_PATTERN"'/$f7=(($7 eq 0) or (index($7, "0=", 0) eq 0)) ? "0(=.*)?" : "([1-9]|[0-9]{2,}?)(=.*)?"; " *(\\\\Q$1\\\\E) *".";"." *(\\\\Q$2\\\\E) *".":"." *(.+?) *".":"." *(.+?) *".":"." *(\\\\Q$5\\\\E) *".":"." *(.+?) *".":"." *($f7) *".":"." *(.+?) *".":"." *(.+?) *".":"." *(.+?) *".":"." *(.+?) *".":"." *(.+?) *".":"." *(.+?) *".":"." *(.+?) *"/ge' < "$TMP_INPUT_FILE" | sort -Vu | \ + while read i + do + grep -P "^ $i\$" < "$TMP_INPUT_FILE" | tee "$TMP_FILE" | head -n 1 >> "$TMP_OUTPUT_FILE" - # Debug duplicates - if [ ! -z "$VERBOSE" ] && [ "$(wc -l < "$TMP_FILE")" != '1' ] - then - tail -n +2 "$TMP_FILE" >> "$DEBUG" - fi -done + # Debug filtered + if [ ! -z "$VERBOSE" ] && [ "$(wc -l < "$TMP_FILE")" != '1' ] + then + tail -n +2 "$TMP_FILE" >> "$DEBUG" + fi + done -mv "$TMP_OUTPUT_FILE" "$TMP_INPUT_FILE" + mv "$TMP_OUTPUT_FILE" "$TMP_INPUT_FILE" +fi ################################################################################ ############################## Order channels ################################## diff -Nru chorder-1.0.0-20~85235fc/debian/changelog chorder-1.0.0-21~9f9496c/debian/changelog --- chorder-1.0.0-20~85235fc/debian/changelog 2013-12-19 20:08:52.000000000 +0000 +++ chorder-1.0.0-21~9f9496c/debian/changelog 2014-01-07 09:04:09.000000000 +0000 @@ -1,6 +1,7 @@ -chorder (1.0.0-20~85235fc-ppa1~raring) raring; urgency=medium +chorder (1.0.0-21~9f9496c-ppa1~raring) raring; urgency=medium - * [85235fcaa0807f84f5e93ca64eee513c24c22be3] - Use sort -Vu instead of uniq. + * [9f9496c6bb1e812f7ddf33690ee952c56c620c50] + Do not delete duplicates by default. + Fixes #1. - -- Andrey Pavlenko Fri, 20 Dec 2013 00:08:52 +0400 + -- Andrey Pavlenko Tue, 07 Jan 2014 13:04:08 +0400