2010-01-25, 11:09
I can across a problem where XBMC was adding episodes to the library incorrectly.
Files like:
show.S01E01-06.XviD-GROUP.avi
were added as two eps instead of as per this example six.
spiff cobbled together this script which renamed this example to:
show.S01E01E02E03E04E05E06.XviD-GROUP.avi
I should point out this was a quick hack for me and this pecific exmaple but it should at least work as a cheat sheet for others in the future.
Files like:
show.S01E01-06.XviD-GROUP.avi
were added as two eps instead of as per this example six.
spiff cobbled together this script which renamed this example to:
show.S01E01E02E03E04E05E06.XviD-GROUP.avi
I should point out this was a quick hack for me and this pecific exmaple but it should at least work as a cheat sheet for others in the future.
Code:
#!/bin/bash
ep1=`echo $1 | awk -F '-' '{print $1}'`
ep2=`echo $1 | awk -F '-' '{print $2}'`
prefix=`echo $1 | awk -F 'E0' '{print $1'}`
postfix=`echo $1 | awk -F 'DVDRip' '{print $2'}`
ep1=${ep1:(-2)}
ep2=${ep2:1:2}
for i in `seq $ep1 $ep2`; do
prefix+=E`printf %02i $i`
done
prefix+=$postfix
echo mv $1 $prefix