Skip to content

Instantly share code, notes, and snippets.

@joeybaker
Last active November 21, 2017 00:22
Show Gist options
  • Save joeybaker/b7c6530ab7308ea922b1 to your computer and use it in GitHub Desktop.
Save joeybaker/b7c6530ab7308ea922b1 to your computer and use it in GitHub Desktop.
Export from a couch potato database
# print all the titles in the db
strings -a -t x id_stor | pcregrep -M '[a-z0-9]{1,9}\stitles\[\n[a-z0-9]{1,9}\s(.*?)u$' | grep -v 'titles' | cut -d " " -f 2- | sort | uniq | sed 's/u$//' | sed 's/://' | sed 's/\///' > couchpotato_export.txt
# get all current movies
# note: with GNU sed, the `sed -E` should be `sed -r`
ls /Volumes/raid6/Movies | sed 's/ ([0-9][0-9][0-9][0-9])//' | sed -E 's/(.*), The/The \1/' | sort > movie_files.txt
# get the wanted movies
grep -v -f couchpotato_export.txt movie_files.txt
# or
awk 'FNR==NR{old[$0];next};!($0 in old)' movie_files.txt couchpotato_export.txt
@castortray
Copy link

Hi,
When I run your script I've got an error:

cp_export.sh: strings: command not found

Is there any way to run it on Windows ?
I found strings for windows on https://technet.microsoft.com/en-us/sysinternals/bb897439.aspx
But it looks that is not the same as on linux :(

Thanks in advance for help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment