Your comments
For the new Pagebuilder I recommend the following changes ( Remove the ! since that mean not existing )
if [ ! -f "$(dirname "$1")/folder.jpg" ]; then
$my_dir/imageGet.sh -c "$name" -d "$start_year"
#name="${name//:/}" Some comics have : in the file name we
shouldn't sed Did you mean to put move
this one line up?
if [ -f "$my_dir/$name $start_year.jpg" ]; then
mv "$my_dir/$name $start_year.jpg" "$(dirname "$1")/folder.jpg"
fi
if [ -f "$my_dir/$name.jpg" ]; then
mv "$my_dir/$name.jpg" "$(dirname "$1")/folder.jpg"
fi
echo "Done!"
else
Got another scenario for you. In some places the code doesn't find an image. I was thinking for those cases why not create your own }:^) . Here's one way you could do it.
Preqs
- User needs cover.jpg in each comic folder. Mylar creates this automatically
- Unix users need imagemagic installed
Sample Unix Commands
- cp -pr cover.jpg folder.jpg ( Here you using the existing comic folder )
- mogrify -gravity center -extent 640x640 folder.jpg ( Create square image )
Here's how some missed comics looked before
After mogrifying existing cover.jpg
- You'll loose the title watermarks on the image ( Wahhh )
- You gain the ability though to create your own image for missing comics
- I recommed Pagebuilder perform these steps, only if it doesn't find the images that imageget ( Remember the if mv I recommended , well if we can't mv anything then make your own )
Here's what I recommend changing in the Pagebuilder code
if [ ! -f "$(dirname "$1")/folder.jpg" ]; then
name="${name//:/}"
$my_dir/imageGet.sh -c "$name" -d "$start_year"
if [ -f "$my_dir/$name $start_year.jpg" ]; then
mv "$my_dir/$name $start_year.jpg" "$(dirname "$1")/folder.jpg"
FETCH=1
fi
if [ -f "$my_dir/$name.jpg" ]; then
mv "$my_dir/$name.jpg" "$(dirname "$1")/folder.jpg"
FETCH=1
fi
case $FETCH in
1) echo "Done!" ;;
*) if [ -f "$(dirname "$1")/cover.jpg" ]; then
echo "Manually creating thumbnail "$(dirname "$1")/folder.jpg""
cp "$(dirname "$1")/cover.jpg" "$(dirname "$1")/folder.jpg"
mogrify -gravity center -extent 640x640 "$(dirname "$1")/folder.jpg"
fi ;;
esac
unset FETCH
else
echo "folder.jpg already exists, skipping"
fi
Noticed a major bug in the new release :'-( The code, imageGet.sh, writes the jpg as Poet Anderson The Dream Walker 2015.jpg but PageBuilder.sh is looking for Poet Anderson: The Dream Walker.jpg. The following changes should be made
# after this line for debug output
Side note in PageBuilder.sh does this line need to change from
if [ -f "$my_dir/$name $start_year.jpg ]; then
mv "$my_dir/$name $start_year.jpg" "$(dirname "$1")/folder.jpg"
fi
if [ -f "$my_dir/$name.jpg ]; then
mv "$my_dir/$name.jpg" "$(dirname "$1")/folder.jpg"
fi
That seems like a great idea, since it up to google to figure out what's a square. If you've got the logic written I can test it out.
Anytime here one other case I came across
Comic exist but comixology has the wrong metadata
Here I'm not sure what can be done when the source system has bad data. If we look for Poet Anderson's dream walker
The image search runs www.google.com/search?q=Poet Anderson: The Dream Walker\+site:comixology.com&tbm=isch&tbs=isz:ex%2Ciszw:312%2Ciszh:312
again brings us to the wrong image
Even if we adjust the query to something simple, http://www.google.com/search?q=+The+Dream+Walker%5C+site%3Acomixology.com&btnG=Search&tbs=isz%3Aex%2Ciszw%3A312%2Ciszh%3A312&tbm=isch
we still get the wrong image
Manually
searching comixology reveals the image exist, but we can see the image.
I can only guess the metadata about the image is incorrect
Hey you've done an excellent job. I'm glad to be able to offer any help with the bash scripting.
I think overall your cases boil down to the following:
Image Scenarios
Comic exist on comixology <- You've got this part coded today
Comic exist but has special characters <- This part is missing
Comic exist but comixology has the wrong metadata
Comic doesn't exist on comixology
Comic doesn't exist and has special characters < - Example provided below ( Code shouldn't produce any images here )
Comic doesn't exist and has special characters
It looks like Lock & Key: Alpha 2013 doesn't exist on comixology. The code fetches the wrong image, but here's why in this case
The image search runs ( Twww.google.com/search?q=Locke & Key: Alpha\+site:comixology.com&tbm=isch&tbs=isz:ex%2Ciszw:312%2Ciszh:312 ) which brings yah this back to this
When really it needs to replace the & and the : with %26 and %3A and then pass the query off to google like this
At this point the code could just fall through and not retrieve any images for place where the comic doesn't exist instead of fetching up an incorrect image
Take this line in the PageBuilder.sh
sh $my_dir/imageGet.sh "$name $start_year"
and change it to ( I believe the problem is when you invoke a new sh, no environment variables are setup for it find imageGet.sh in the PATH variable )
$my_dir/imageGet.sh "$name $start_year"
Here how it looked before
Here's how image looks after the code change
I added this to the code
####################################################################################
# Main
# - Parse Parameters
########################################################################################
my_dir=`dirname $0`
while [ "$1" != "" ]; do
case $1 in
-c | --comic ) shift
comicname=$1
echo Debug Main Var comicname set to $comicname;;
-d | --date ) shift
date=$1
echo Debug Main Var date set to $date;;
-h | --help ) usage
exit ;;
* ) usage
exit 1
esac
shift
done
getMyImages 1 $comicname;
and changed
google_image="$my_dir/$comicname $date.jpg"
For the page build script I changed
echo $my_dir/imageGet.sh -c ""$name"" -d "$start_year"
$my_dir/imageGet.sh -c "$name" -d "$start_year"
mv "$my_dir/$name $start_year.jpg" "$(dirname "$1")/folder.jpg"
Having a small issue that's left me scratching my head. The process works really well for fetching DC images, but for some reason Image and a few other have issues. Here's an Example
The code executes imageGet.sh "Big Man Plans 2015" this fetches the incorrect image for the folder.jpg
File Name Big Man Plans 2015.jpg
If I run from command line, imageGet.sh 'Big Man Plans' 2015 it fetches the correct image but truncates the year from the file name. What changes need to be made to fetch this image?
File Name Big Man Plans.jpg
Customer support service by UserEcho
I noticed the the quality of matching can vary by switch from .com to .eu. Not sure if this is something you want to change, but may be worth kicking the tires on. Image comic seem to do slighlty better with eu, but there are still one off with both :-\ 11 out of 86 mismatches and 6 out of 86 manual creations ( so about 80% accurate ). Image for the US had 20 out of 86 mismatches and 4 out of 86 manual creations ( so about 71% accurate)
Here's what I experimented with
link="www.google.com/search?q='${webquery}'+inurl:series+intitle:Digital&as_sitesearch=www.comixology.eu&tbs=iar:s,isz:ex&tbm=isch"
Boom Studio Searching with .com
- Many errors in matching 4/10 incorrect ( 60% accurate )
Boom Studio Searching with (Same code, only changed to the eu site )
- Only Empty Man comes up incorrectly 1/10 incorrect 1/10 manual creations ( 80% accurate )
IDW Publishing Searching .com ( Many mismatches )
IDW Publishing Searching .eu ( Not going to count but you can just see the improvement for page one )