Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- LOGDIR="~/skype"
- US="ourskypeid"
- if [ -e ${LOGDIR}/.skype2pidid ]; then
- LASTID=$(cat ${LOGDIR}/.skype2pidid);
- else
- LASTID=0;
- fi
- printf "Last synced id is %s.\n" "${LASTID}";
- db=$(mktemp)
- cp /home/claudius/.Skype-home/.Skype/ourskypeid/main.db ${db}
- printf "${db}\n";
- for i in $(sqlite3 ${db} "select id from Messages where id > ${LASTID} and type = 61 order by timestamp;"); do
- remote=$(sqlite3 ${db} "select dialog_partner from Messages where id = ${i}")
- if [ -z "${remote}" ]; then
- convid=$(sqlite3 ${db} "select convo_id from Messages where id = ${i}")
- remote=$(sqlite3 ${db} "select dialog_partner from Messages where convo_id = ${convid} and dialog_partner != '' LIMIT 1")
- fi
- content=$(sqlite3 ${db} "select body_xml from Messages where id = ${i};")
- author=$(sqlite3 ${db} "select author from Messages where id = ${i}")
- time=$(sqlite3 ${db} "select timestamp from Messages where id = ${i}")
- printf "Got id %s (%s from/to %s).\n" "${i}" "${content}" "${remote}"
- if [ "${remote}" = "" ]; then
- remote=${author}
- fi
- mkdir -p ${LOGDIR}/${remote}
- if [ ! -e ${LOGDIR}/${remote}/$(date -d "@${time}" +%Y-%m-%d)*SKYP* ]; then
- cfile="${LOGDIR}/${remote}/$(date -d "@${time}" +%Y-%m-%d.%H%M%S+0000SKYP.html)"
- printf "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"><title>Skype Conversation with %s at %s on %s</title></head><body><h3>Skype Conversation with %s at %s on %s</h3>\n" "${remote}" "$(date -d "@${time}")" "${US}" "${remote}" "$(date -d "@${time}")" "${US}" >> "${cfile}"
- else
- cfile=$(ls ${LOGDIR}/${remote}/$(date -d "@${time}" +%Y-%m-%d)*SKYP*)
- fi
- if [ ${author} = "${US}" ]; then
- printf "<font color=\"#16569E\"><font size=\"2\">(%s)</font> <b>%s:</b></font> %s<br />\n" "$(date -d "@${time}" "+%Y-%m-%d %H:%M:%S")" "${US}" "${content}" >> "${cfile}"
- else
- printf "<font color=\"#A82F2F\"><font size=\"2\">(%s)</font> <b>%s:</b></font> %s<br />\n" "$(date -d "@${time}" "+%Y-%m-%d %H:%M:%S")" "${remote}" "${content}" >> "${cfile}"
- fi
- LASTID=${i}
- done
- printf "%s" ${LASTID} > ${LOGDIR}/.skype2pidid
- printf "Last synced id is %s.\n" "${LASTID}";
- rm ${db}
Advertisement
Add Comment
Please, Sign In to add comment