I'm actually searching for a good alternative to skype (I'm not going to link it here!). I think I don't have to explain where, but may be I should explain, what I'm searching for. In fact I want a pidgin with Video/VoIp support. But as you can read here, the developers don't think about integrating it. Even it would become the Killer application then. (I want to have a Jabber-Client with Video-Support).
Anyway, during the search I found a good-old-friend, for which I was told, should support Video: kopete. Well it does not support Video in Jabber, but it is a nice programm. The only thing I was really missing, have been the Smileys from Pidgin. So I opened the theme-file in the folder of the pidgin smileys-theme and took a look at the xml-schema of the emoticons.xml from kopete (first the theme-file):
Name=Pidgin 2.0.2 Smileys
Description=Pidgin smileys from v. 2.0.2.
Icon=smile.png
Author=Hylke (Port by hund-ONE)
# default smileys
[default]
wink.png ;) 
shock.png :-O :-o :O :o
tongue.png :P :p
:-p
glasses-cool.png (H) (h)
....
<messaging-emoticon-map>
<emoticon file="shock.png">
<string>:o</string>
<string>:O</string>
<string>:-o</string>
<string>:-O</string>
</emoticon>
....
Well, that looks to be compatible.
And so I started to make copy-paste. As I was at the tenth entried, I though "How much is this" and scrolled down. And what to say: it is way to much. So I made a small python script to let me do this. And that script improved nearly by itself, because I wasn't happy with it after every step. Here are the steps of the process:
- copy all with all strings
- escape the strings (with CDDATA)
- sort the result
- better finding of the best suiting smiley
- improve finding
- and again
- add list of already known smileys-codes (because they should not be doubled)
- add a sections-ignoring filter
Well, anyway. Here is the finished script. Feel free to copy it as you like. I put it under the MIT.
ignore_sections = ('[QQ]')
writer = open('output.xml', 'w')
start = '<messaging-emoticon-map>\n'
writer.write(start)
read = False
printer_dict = {}
already_found = []
def strange_sort(in_list):
"""
This is a strange sort-algorithm. it returns a sorted list. Strange means,
that it is meant for smileys
and does not make really sense to use
it...
"""
in_list.sort()
# normally sorting works quiet good. the bad thing is, that it prefer /
# before : and that it prefers uppercase from lowercase. To have the most
# simple and easiest smiley as the first one, we have this algorithm
def simple_first(first, new):
if len(new) < len(first):
return True
if first < new:
return True
return False
def has_eyes(item):
if item.find(':') != -1:
return True
if item.find(';') != -1:
return True
if item.find('8') != -1:
return True
return False
next_list = []
for item in in_list:
if len(next_list) == 0:
# at least one item!
next_list.append(item)
continue
if has_eyes(item):
# we prefer items with eyes
if '-' not in item:
# if we also don't have a nose, we are really easy, so lets
# use this one as the first one
next_list.insert(0, item)
else:
# if we have a nose, we should check if the 'first' item is
# easier than we are
first = next_list[0]
if not has_eyes(first):
next_list.insert(0, item)
elif '-' not in first:
next_list.insert(1, item)
else:
# smiley counter: both easy. use the one that is lowercase
if simple_first(first, item):
next_list.insert(0, item)
else:
next_list.insert(1, item)
elif '-' in item:
first = next_list[0]
if has_eyes(first):
# it has eyes!
next_list.insert(1, item)
elif '-' not in first:
# it has no nose and no eyes, but we have a nose!
next_list.insert(0, item)
else:
# smiley counter: both easy. use the one that is lowercase
if simple_first(first, item):
next_list.insert(0, item)
else:
next_list.insert(1, item)
else:
# no eyes, we did not identify the smiley. hopefully that sort was
# doing it thing good. just place it at the end again
next_list.append(item)
return next_list
for line in open('theme'):
if line.startswith('['):
line = line.rstrip(' \n')
print line
if line not in ignore_sections:
read = True
else:
read = False
continue
if not read:
continue
parts = line.split()
if len(parts) < 2 or parts[0][0] in ('#', '!'):
# this one should be ignored
continue
file = parts.pop(0)
if file not in printer_dict.keys():
printer_dict[file] = []
while(len(parts) > 0):
string = parts.pop(0)
if string not in printer_dict[file] and string not in already_found:
already_found.append(string)
printer_dict[file].append(string)
for file, chars in printer_dict.iteritems():
writer.write(' <emoticon file="%s">\n' % file)
chars = strange_sort(chars)
for char in chars:
writer.write(' <string><![CDATA[%s]]></string>\n' % char)
writer.write(' </emoticon>\n')
writer.write('</messaging-emoticon-map>')
print "done!"
Anyway, you can it here. And as I might think, most of you are more intrested in the output.xml, which you have to rename to emoticons.xml and put in the directory of the smileys. After that put it under ~/.kde/emoticons/. So that youn have a directory there and in that directory is the emoticons.xml file. Now Kopete should find it. If you want to have a finished packages, you might write this here as a comment!
Nachdem ich mila endlich davon überzeugen konnte Pidgin zu nutzen, wollten wir heute eine List mit Smileys für Jabber machen. Die in dem Standartumfang enthaltenen reichten der lieben nämich nicht aus. Also zählte sie mal so auf, was s
Tracked: Nov 24, 18:01