~ubuntu-branches/ubuntu/utopic/awn-extras-applets/utopic

« back to all changes in this revision

Viewing changes to src/comic/getborn.py

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-01-13 21:50:33 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100113215033-kd9otcdjrajmiag0
Tags: 0.3.9~bzr1944-0ubuntu1
* New upstream snapshot.
 - Catch error in weather applet (LP: #359668)
* debian/patches: Refresh.
* debian/*.install: 
 - Update to new location and new applets.
 - Disable dialect applet until python-xklavier is in the archive.
 - Disable MiMenu and Pandora applets, there are unmaintained and not stable.
* debian/awn-applets-c-core: Dropped, not needed.
* debian/control:
 - Update description with new applets.
 - Remove libawn-extras and python-awnlib, all merged in python-awn-extras.
 - Replace awn-manager by awn-settings.
 - Drop build-depends on libgnome-desktop-dev, python*-dev, python2.5,
   awn-manager, libglade2-dev and libgnomeui-dev.
 - Add build-depends on libdesktop-agnostic-bin and vala-awn.
 - Bump build-depends of libawn-dev (>= 0.3.9~bzr1890), valac (>= 0.7.7) and
   debhelper (>= 7.0.50~).
 - Bump Standards-Version to 3.8.3 (no change needed).
 - Demote gconf-editor to Suggest, it's only needed for very advanced
   settings.
 - Update Recommends for python applets with new applets.
 - Suggest python-gconf for notification-area and alacarte for YAMA.
 - Add a debug package for C applets.
* debian/libawn-extras*: Removed, libawn-extras was removed upstream.
* debian/python-awnlib*: Merged with python-awn-extras.
* debian/rules:
 - Rewrite to use overrides.
* debian/copyright:
 - Update copyright and licenses.
* debian/README.source: Added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
 
3
 
# This program is free software; you can redistribute it and/or modify
4
 
# it under the terms of the GNU General Public License version 2 as
5
 
# published by the Free Software Foundation
6
 
#
7
 
# This program is distributed in the hope that it will be useful,
8
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 
# GNU General Public License for more details.
11
 
#
12
 
# You should have received a copy of the GNU General Public License
13
 
# along with this program; if not, write to the Free Software
14
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15
 
 
16
 
################################################################
17
 
# get_bornloser_strips.py -- fetch strips of last N days
18
 
 
19
 
################################################################
20
 
# BEGIN configuration
21
 
 
22
 
number_of_days = 1
23
 
 
24
 
path_prefix = '/tmp/' # where do you want to save the files?
25
 
 
26
 
# --END configuration
27
 
################################################################
28
 
 
29
 
import sys
30
 
import urllib
31
 
import re
32
 
 
33
 
from string import join
34
 
from datetime import datetime, timedelta
35
 
 
36
 
if len(sys.argv) > 1:
37
 
    number_of_days = int(sys.argv[1])
38
 
 
39
 
pattern = re.compile('str_strip[0-9/]+\\.full\\.gif')
40
 
pattern2 = re.compile('str_strip[0-9/]+\\.full\\.jpg')
41
 
temp1 = 'http://comics.com/the_born_loser/%s/'
42
 
temp2 = 'http://assets.comics.com/dyn/%s'
43
 
 
44
 
date = datetime.today()
45
 
one_day = timedelta(1)
46
 
 
47
 
filename = None
48
 
 
49
 
for i in range(number_of_days):
50
 
    url = temp1 % (date.strftime('%Y%m%d'))
51
 
    #print '? %s' % (url)
52
 
    fil = urllib.urlopen(url)
53
 
    for line in fil:
54
 
        match = pattern.search(line)
55
 
        if match != None:
56
 
            filename = match.group()
57
 
            break
58
 
        else:
59
 
            match2 = pattern2.search(line)
60
 
            if match2 != None:
61
 
                filename = match2.group()
62
 
                break
63
 
    fil.close()
64
 
 
65
 
    if filename != None:
66
 
        url = temp2 % (filename)
67
 
        #print '+ %s' % (url)
68
 
        fil = urllib.urlopen(url)
69
 
        diskfile = file(path_prefix + 'dilbert.gif', 'w')
70
 
        diskfile.write(fil.read())
71
 
        fil.close()
72
 
        diskfile.close()
73
 
 
74
 
    date = date - one_day
75
 
    filename = None