+++ /dev/null
-#!/usr/bin/python2.5
-# -*- coding: utf-8 -*-
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published
-## by the Free Software Foundation; version 2 only.
-##
-## 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.
-##
-import py2deb
-import os
-if __name__ == "__main__":
- try:
- os.chdir(os.path.dirname(sys.argv[0]))
- except:
- pass
- print
- p=py2deb.Py2deb("comic-widget") #This is the package name and MUST be in lowercase! (using e.g. "mClock" fails miserably...)
- p.description="A widget that displays comics taken from the web."
- p.author="Marcus Wikstrom"
- p.mail="mece@ovi.com"
- p.depends = "python2.5, python-osso, python-gtk2, python-hildon, python-hildondesktop, python2.5-cairo, hildon-desktop-python-loader"
- p.section="user/desktop"
- p.icon = "/home/user/MyDocs/python/comic-widget/source-images/icon.png"
- p.arch="all" #should be all for python, any for all arch
- p.urgency="low" #not used in maemo onl for deb os
- p.distribution="fremantle"
- p.repository="extras-devel"
- p.xsbc_bugtracker="http://bugs.maemo.org"
- # p.postinstall="""#!/bin/sh
- # chmod +x /usr/bin/mclock.py""" #Set here your post install script
- # p.postremove="""#!/bin/sh
- # chmod +x /usr/bin/mclock.py""" #Set here your post remove script
- # p.preinstall="""#!/bin/sh
- # chmod +x /usr/bin/mclock.py""" #Set here your pre install script
- # p.preremove="""#!/bin/sh
- # chmod +x /usr/bin/mclock.py""" #Set here your pre remove script
- version = "0.2.5" #Version of your software, e.g. "1.2.0" or "0.8.2"
- build = "1" #Build number, e.g. "1" for the first build of this version of your software. Increment for later re-builds of the same version of your software.
- #Text with changelog information to be displayed in the package "Details" tab of the Maemo Application Manager
- changeloginformation = "First build. Here be dragons!"
- dir_name = "src" #Name of the subfolder containing your package source files (e.g. usr\share\icons\hicolor\scalable\myappicon.svg, usr\lib\myapp\somelib.py). We suggest to leave it named src in all projects and will refer to that in the wiki article on maemo.org
- #Thanks to DareTheHair from talk.maemo.org for this snippet that recursively builds the file list
- for root, dirs, files in os.walk(dir_name):
- real_dir = root[len(dir_name):]
- fake_file = []
- for f in files:
- fake_file.append(root + os.sep + f + "|" + f)
- if len(fake_file) > 0:
- p[real_dir] = fake_file
- print p
- r = p.generate(version,build,changelog=changeloginformation,tar=True,dsc=True,changes=True,build=False,src=True)
--- /dev/null
+comic-widget (0.2.5-1) stable; urgency=low
+
+ First build. Here be dragons!
+
+ -- Marcus Wikstrom <mece@ovi.com> Sun, 31 Jan 2010 02:58:18 +0000
--- /dev/null
+Source: comic-widget
+Section: user/desktop
+Priority: extra
+Maintainer: Marcus Wikstrom <mece@ovi.com>
+Build-Depends: debhelper (>= 5)
+Standards-Version: 3.7.2
+
+Package: comic-widget
+Architecture: all
+Depends: python2.5, python-osso, python-gtk2, python-hildon, python-hildondesktop, python2.5-cairo, hildon-desktop-python-loader
+Description: A widget that displays comics taken from the web.
+XB-Maemo-Icon-26:
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAAZiS0dEAOoA
+ 3gDefVuD6AAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oBHhUpKwDAm8UAAAAZdEVYdENv
+ bW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAOBklEQVRo3tWaa4xd1XXHf/t17mPu3Jk7fsx4
+ xp6xkfED2xgMgTEJbpw4DjEDAUQtW+VRwBRRUUTTCkuRQZWqVomiBItGTVqqlOAEFZoUYhcQBhFS
+ I2wwDUrNDDZ+DBh7xuN5Pzwz93HO7odz7rnnztyxjfwpRzr37vPYe6+19lr/tfZaRwA8tnEjO/fu
+ 5aEbb1SO46wFGi1IAAF4+Bc2uC4eNtIWFa4rvVfp/alzRPtH5vSArnwut/+n+/a5RZrF39x8Mz98
+ 5RUe27hxKXBISmm0lABWgLAViGMaoRYbIbn4frFvxf4WhCDSW8zIqIdPSMF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bpuur0fnfCy9u4NUqbytxHE7zFmDWIVmeqYcz4jcSUksGF/VAFv5B3sQXy
+ WL1fAPy8fedSKUV7KlOltFaRwnKQKy7VmEt1B1FKO9oLSju6hLZcr0SkFGkjRe6yL0BKE7t5l9HB
+ cddzvRV/vvKvj4ift+/k3hWPsav96aVCyUPGaGMc7ctbCCGiwZsoT3tOXQEoZ7RS0f2iDXiaZCz5
+ bIFCvpD3rLvqniseO/Js+1P+vL/o+CfuuuKveLH9X1ReuGsFolEIJFPQzlYEFxv5fMAv/1hhw/mj
+ H21U/CbHXhxDFuuB7ZLC7N+6/CF318dPc/fyR/l/MJaMUFvvRHwAAAAASUVORK5CYII=
\ No newline at end of file
--- /dev/null
+This package was py2debianized(0.5.1) by Marcus Wikstrom <mece@ovi.com> on
+Sun, 31 Jan 2010 02:58:18 +0000.
+
+It was downloaded from
+
+Upstream Author: Marcus Wikstrom <mece@ovi.com>
+
+Copyright: 2010 by Marcus Wikstrom
+
+License:
+
+
+ This package is free software; you can redistribute it and/or modify
+ 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 package 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 package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+
+The Debian packaging is (C) 2010, Marcus Wikstrom <mece@ovi.com> and
+is licensed under the GPL, see above.
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
--- /dev/null
+opt/comic-widget/db/
+opt/comic-widget/images/
+usr/lib/hildon-desktop/
+usr/share/applications/hildon-home/
\ No newline at end of file
--- /dev/null
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ # Add here commands to configure the package.
+
+ touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # ======================================================
+ #$(MAKE) DESTDIR="$(CURDIR)/debian/comic-widget" install
+ mkdir -p "$(CURDIR)/debian/comic-widget"
+
+# mkdir -p "$(CURDIR)/debian/comic-widget/usr/lib/hildon-desktop/"
+ cp -a "src/usr/lib/hildon-desktop/comic-widget.py" "$(CURDIR)/debian/comic-widget/usr/lib/hildon-desktop/comic-widget.py"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/"
+ cp -a "src/opt/comic-widget/images/down0-48x48.png" "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/down0-48x48.png"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/"
+ cp -a "src/opt/comic-widget/images/down1-48x48.png" "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/down1-48x48.png"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/"
+ cp -a "src/opt/comic-widget/images/next0-48x48.png" "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/next0-48x48.png"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/"
+ cp -a "src/opt/comic-widget/images/next1-48x48.png" "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/next1-48x48.png"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/"
+ cp -a "src/opt/comic-widget/images/prev0-48x48.png" "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/prev0-48x48.png"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/"
+ cp -a "src/opt/comic-widget/images/prev1-48x48.png" "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/prev1-48x48.png"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/"
+ cp -a "src/opt/comic-widget/images/switch0-48x48.png" "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/switch0-48x48.png"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/"
+ cp -a "src/opt/comic-widget/images/switch1-48x48.png" "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/switch1-48x48.png"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/"
+ cp -a "src/opt/comic-widget/images/up0-48x48.png" "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/up0-48x48.png"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/"
+ cp -a "src/opt/comic-widget/images/up1-48x48.png" "$(CURDIR)/debian/comic-widget/opt/comic-widget/images/up1-48x48.png"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/db/"
+ cp -a "src/opt/comic-widget/db/comicdb.dilbert.csv" "$(CURDIR)/debian/comic-widget/opt/comic-widget/db/comicdb.dilbert.csv"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/db/"
+ cp -a "src/opt/comic-widget/db/comicdb.sinfest.csv" "$(CURDIR)/debian/comic-widget/opt/comic-widget/db/comicdb.sinfest.csv"
+ mkdir -p "$(CURDIR)/debian/comic-widget/opt/comic-widget/db/"
+ cp -a "src/opt/comic-widget/db/comicdb.xkcd.csv" "$(CURDIR)/debian/comic-widget/opt/comic-widget/db/comicdb.xkcd.csv"
+ mkdir -p "$(CURDIR)/debian/comic-widget/usr/share/applications/hildon-home/"
+ cp -a "src/usr/share/applications/hildon-home/comic-widget.desktop" "$(CURDIR)/debian/comic-widget/usr/share/applications/hildon-home/comic-widget.desktop"
+
+ # ======================================================
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs debian/changelog
+ dh_installdocs
+ dh_installexamples
+# dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
import osso
import cairo
import datetime
+import shutil
supports_alpha = False
# comiccache is the location of the images
APP_VERSION = "0.2.5"
+basedbdir = "/opt/comic-widget/db/"
imagedir = "/opt/comic-widget/images/"
-dbdir = "/opt/comic-widget/db/"
+dbdir = "/home/user/.comic-widget/"
comiccache = "/home/user/MyDocs/.comics/"
comics = {"xkcd":{"name":"xkcd","link":"http://xkcd.org/","start":666,"dbfile":dbdir + "comicdb.xkcd.csv"},
"sinfest":{"name":"Sinfest","link":"http://sinfest.com/","start":3400,"dbfile":dbdir + "comicdb.sinfest.csv"},
if os.path.isfile(self.dbfile) == True:
dbf = open(self.dbfile, 'r')
# if not, create it.
- else:
- dbf = open(self.dbfile, 'w')
- dbf.write('comic,id,link,url,filename,title\n')
- dbf.close()
- dbf = open(self.dbfile, 'r')
- self.fetch_latest_std(self.comic, self.start)
-
- if not os.path.exists(comiccache + self.comic + "/"):
- try:
- os.makedirs(comiccache + self.comic + "/")
- except:
- print "comic cache creation failed"
- exit()
+ dbf = self.get_dbfile()
dbr = csv.DictReader(dbf)
self.db = []
for row in dbr:
dbf.close()
self.currentcomic = 0
+
+
+ def get_dbfile(self):
+ #if db file exist, read it
+ if os.path.isfile(self.dbfile) == True:
+ dbf = open(self.dbfile, 'r')
+ return dbf
+ # if not, copy it.
+ else:
+ if not os.path.exists(dbdir):
+ try:
+ os.makedirs(dbdir)
+ except:
+ print "comic db creation failed on mkdir"
+ exit()
+ try:
+ shutil.copyfile(basedbdir + "comicdb." + self.comic + ".csv", dbdir + "comicdb." + self.comic + ".csv")
+ except:
+ print "comic db creation failed on copy"
+ exit()
+ if os.path.isfile(self.dbfile) == True:
+ dbf = open(self.dbfile, 'r')
+ return dbf
+ else:
+ print "comic db creation failed after copy"
+ exit()
+
+
def get_comic(self):
print str(self.currentcomic)
if self.currentcomic < 0: