EAN13.py revision 56dcb73b5a1df7498fc6c7722ac4a380b9646fad
'''
Copyright (C) 2007 Martin Owens
Thanks to Lineaire Chez of Inkbar ( www.inkbar.lineaire.net )
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
import sys
mapLeftFaimly = [
[ "0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011" ],
[ "0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111" ],
]
mapRight = [ "1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100" ]
mapFaimly = [ '000000','001011','001101','001110','010011','011001','011100','010101','010110','011010' ]
guardBar = '202';
centerBar = '02020';
result = ''
sys.stderr.write("Can not encode '" + number + "' into EAN13 Barcode, Size must be 12 numbers only\n")
return
else:
sys.stderr.write("EAN13 Checksum not correct for this barcode, omit last character to generate new checksum.\n")
return
i = 0
return result;
magic=10
sum = 0
# We need to work from left to right so reverse
# checksum based on first 12 digits.
# Mod it down to a single digit
if z < 0 or z >= magic:
return 0
return str(z)
return result