nZEDb

nZEDb => Modifications => Topic started by: gregorys on 2014-10-19, 04:00:35 pm

Title: script to undo renaming of 480p.HDTV to 720p.HDTV releases
Post by: gregorys on 2014-10-19, 04:00:35 pm
My nzedb install is renaming 480p.HDTV releases to 720p.HDTV using "NFO, predb" method.
I made a simple bash script (can't write php) to fix this. It's not optimal code but it does the job...

Code: [Select]
#!/bin/bash
/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf -B -s -r -e "select id from releases where (name LIKE '%480p.HDTV%') AND (searchname LIKE '%720p.HDTV%') AND (categoryid = '5040') AND (isrenamed = '1')" nzedb > /tmp/ids
for i in `cat /tmp/ids`; do /usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf -B -s -r -e "update releases set categoryid = '5030' where (id = "$i");" nzedb; done
for i in `cat /tmp/ids`; do /usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf -B -s -r -e "update releases set searchname = REPLACE(searchname, '720p.HDTV', '480p.HDTV') where (id = "$i")" nzedb; done