-
Notifications
You must be signed in to change notification settings - Fork 0
/
camelot_start.sh
110 lines (92 loc) · 2.97 KB
/
camelot_start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
#
# @uthor: Filipe Madureira
#
# Uses camelot_extractor.sh <-- extracts cards from scan files
#
# Checks and triggers the camelot_extractor.sh script if any default
# template files exist in the directory, checks for every single case
# preemptively and triggers just cases in whcih a file has actually
# been found in the current directory
#
if [ $# -ne 2 ]
then
#In case no enough arguments are given
echo ''
echo 'Not enough arguments!'
echo 'Usage:'
echo 'camelot_start.sh <input_filename> <deck_name>'
echo ''
echo '!!! IMPORTANT !!!'
echo ''
echo '1. Leave in this folder all the useful files. The program will look for'
echo 'specific names, for example, if your input filename is "deck"'
echo 'the script will look for predefined deck_A.png, deck_Q.png,.. and so on'
echo 'and process all the files it can find.'
echo ''
echo '2. A folder with the given deck_name will be created with all the extracted'
echo 'cards inside of it, numbered following this script logic (see documentation)'
echo 'Examples:'
echo '1.png - Ace of hearts'
echo '2.png - Ace of diamonds'
echo '...'
echo ''
else
#Variables declaration
FILENAME=input/$1
DECKNAME=$2
#creazione cartella che conterra i file
mkdir output/${DECKNAME}
if [ -f ${FILENAME}_A.png ]
then
bash camelot_extractor.sh ${FILENAME}_A.png ${DECKNAME} A
fi
if [ -f ${FILENAME}_K.png ]
then
bash camelot_extractor.sh ${FILENAME}_K.png ${DECKNAME} K
fi
if [ -f ${FILENAME}_Q.png ]
then
bash camelot_extractor.sh ${FILENAME}_Q.png ${DECKNAME} Q
fi
if [ -f ${FILENAME}_J.png ]
then
bash camelot_extractor.sh ${FILENAME}_J.png ${DECKNAME} J
fi
if [ -f ${FILENAME}_10.png ]
then
bash camelot_extractor.sh ${FILENAME}_10.png ${DECKNAME} 10
fi
if [ -f ${FILENAME}_9.png ]
then
bash camelot_extractor.sh ${FILENAME}_9.png ${DECKNAME} 9
fi
if [ -f ${FILENAME}_8.png ]
then
bash camelot_extractor.sh ${FILENAME}_8.png ${DECKNAME} 8
fi
if [ -f ${FILENAME}_7.png ]
then
bash camelot_extractor.sh ${FILENAME}_7.png ${DECKNAME} 7
fi
if [ -f ${FILENAME}_6.png ]
then
bash camelot_extractor.sh ${FILENAME}_6.png ${DECKNAME} 6
fi
if [ -f ${FILENAME}_5.png ]
then
bash camelot_extractor.sh ${FILENAME}_5.png ${DECKNAME} 5
fi
if [ -f ${FILENAME}_4.png ]
then
bash camelot_extractor.sh ${FILENAME}_4.png ${DECKNAME} 4
fi
if [ -f ${FILENAME}_3.png ]
then
bash camelot_extractor.sh ${FILENAME}_3.png ${DECKNAME} 3
fi
if [ -f ${FILENAME}_2.png ]
then
bash camelot_extractor.sh ${FILENAME}_2.png ${DECKNAME} 2
fi
fi