#! /usr/bin/perl -w

# (C) Copyright Craig Sanders <cas@taz.net.au> 2009
#
# This script is licensed under the terms of the GNU General Public
# License version 3 (or later, at your option).

# run like so:
#   myth-list-titles.sh -r simpsons | grep -E '\.(nuv|mpg)' | awk -F'|' '{print $6}' | tail -20 | xargs myth-delete-recording.pl
# or:
#   myth-list-titles.sh -r simpsons --basename-only | xargs echo myth-delete-recording.pl

use MythTV;

$Myth = new MythTV();

foreach my $basename (@ARGV) {
  print "deleting $basename\n" ;
  my $file = $Myth->new_recording($basename);
  $Myth->backend_command(['FORCE_DELETE_RECORDING', $file->to_string()], '0');
};


