maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   Script to get rid of album art in photos (https://talk.maemo.org/showthread.php?t=74651)

qwazix 2011-07-05 23:07

Script to get rid of album art in photos
 
Disclaimer: I am not sure that all albums retain their art. Most of mine didn't have anyway, but those that I remeber having album art still have after applying the script and rebuilding tracker db. (rebuilding the db is NOT required I just did it for testing purposes)

Code:

#!/bin/sh
flag=0
#Recursively rename AlbumArt Files
find MyDocs/.sounds/ -name AlbumArt* | while read FILE
do
flag=1
NEW=`echo $FILE | sed -e 's/AlbumArt/.AlbumArt/'`
echo "renaming $FILE to $NEW"
mv "$FILE" "$NEW"
done

find MyDocs/.sounds/ -name folder.jpg | while read FILE
do
flag=1
NEW=`echo $FILE | sed -e 's/folder/.folder/'`
echo "renaming $FILE to $NEW"
mv "$FILE" "$NEW"
done

if [ $flag -eq 0 ]
then
echo "no files found"
fi

Maybe you need another block for Folder.jpg, maybe it's better to hide all jpg's in .sounds. This did most of the trick for me, I'll do the rest by hand, if you make any changes post back.

edit: the script doesn't delete anything, it just recursively makes AlbumArtblahblah and folder.jpg's hidden

5spdvl 2011-07-06 00:12

Re: Script to get rid of album art in photos
 
Geez, this is good. I need one to hide all the Starcraft and Warcraft II tilesets! But good work.

jedi 2011-07-06 07:48

Re: Script to get rid of album art in photos
 
This was my version:
Code:

#!/bin/sh
MUSICDIR="/home/user/MyDocs/Music"
find "${MUSICDIR}" -iname *.jpg -o -iname *.jpeg | while IFS="" read FILE; do
  DIRNAME=`dirname "${FILE}"`
  LASTPART=`echo "${DIRNAME}" | awk -F '/' '{print $NF}'`
  if [ "${LASTPART}" != ".mediaartlocal" ]; then
      if [ "$1" = "-d" ]; then 
        echo "${FILE} will be moved to ./mediaartlocal/"
      else
        echo "Moving ${FILE} -> ./mediaartlocal/"
        if [ ! -d "${DIRNAME}/.mediaartlocal/" ]; then
            mkdir "${DIRNAME}/.mediaartlocal/"
        fi
        mv "${FILE}" "${DIRNAME}/.mediaartlocal/"
      fi
  fi
done

Which does pretty much the same. You can run it with a '-d' option to simulate a dry-run (ie it won't change/move anything)

5spdvl 2011-07-07 11:40

Re: Script to get rid of album art in photos
 
Re: the above, some of my album art files are in .png format.

Can you change

Code:

find "${MUSICDIR}" -iname *.jpg -o -iname *.jpeg etc
to include

Code:

-iname *.png
? And any other file types?

jedi 2011-07-07 11:49

Re: Script to get rid of album art in photos
 
Quote:

Originally Posted by 5spdvl (Post 1046343)
Re: the above, some of my album art files are in .png format.

Can you change

Code:

find "${MUSICDIR}" -iname *.jpg -o -iname *.jpeg etc
to include

Code:

-iname *.png
? And any other file types?

You can do whatever you like with the script!

You can have as many "-name *.xxx" parameters as you need with the find command...


All times are GMT. The time now is 20:38.

vBulletin® Version 3.8.8