# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+from __future__ import print_function
+
import re
import sys
import os
name, title = name.split('|', 2)
except ValueError:
# XXX
- print 'error splitting', repr(name)
+ print('error splitting', repr(name))
name, title = oTitle, 'XXX'
if not name:
name = oTitle
try:
url = re.findall('href=(.*?)>', self.getVar('group'), re.DOTALL)[0]
except IndexError:
- print 'XXX', self.getVar('group')
+ print('XXX', self.getVar('group'))
except KeyError:
- print 'XXX'
+ print('XXX')
self.pullState()
return self.formatter.link(formattedText, url)
if __name__ == '__main__':
if os.path.exists(sys.argv[1]):
- print makeHtmlFromSpip(unicode(file(sys.argv[1]).read(), 'utf-8'))
+ print(makeHtmlFromSpip(unicode(file(sys.argv[1]).read(), 'utf-8')))
else:
- print makeHtmlFromSpip(unicode(sys.argv[1], 'utf-8'))
+ print(makeHtmlFromSpip(unicode(sys.argv[1], 'utf-8')))
+from __future__ import print_function
+
import base64
import mutagen
import mutagen.mp3
cmd.append(file_path)
if self.verbose:
- print 'creating', file_path
- print ' ', ' '.join(cmd)
+ print('creating', file_path)
+ print(' ', ' '.join(cmd))
else:
cmd[1:1] = ['-loglevel', 'quiet']
+from __future__ import print_function
+
from datetime import datetime
from django.core.management.base import BaseCommand, CommandError
year, month, day = date.split('-')
date = datetime(int(year), int(month), int(day))
for entry in day_program(date):
- print entry.datetime, entry
+ print(entry.datetime, entry)
# -*- coding: utf-8 -*-
+from __future__ import print_function
+
from datetime import datetime
import time
import gzip
with open(filename) as fd:
if self.verbose:
- print 'Reading SPIP dump file'
+ print('Reading SPIP dump file')
content = fd.read()
# the spip_courriers parts of the spip export are not properly
# encoded, we manually remove them here so the XML file can be
self.root = ET.fromstring(content)
if self.verbose:
- print 'Loading objects from dump'
+ print('Loading objects from dump')
self.load_keyword_groups()
self.load_keywords()
self.load_rubrics()
self.breves = {}
if not self.article_ids:
if self.verbose:
- print ' breves...'
+ print(' breves...')
self.load_breves()
if self.verbose:
- print ' articles...'
+ print(' articles...')
self.load_articles(emission_rubric_ids)
self.set_urls()
self.process_episode_keywords()
self.process_newsitem_keywords()
- print 'Creating emissions'
+ print('Creating emissions')
for emission_id in straight_emission_rubric_ids:
rubric = self.rubrics[emission_id]
emission = self.get_or_create_emission(rubric)
- print ' ', emission.title
+ print(' ', emission.title)
if rewritemap_file:
self.add_rewritemap_entries(rubric, emission)
self.set_sound_files(article, episode)
- print 'Creating newsitems'
+ print('Creating newsitems')
for breve in self.breves.values():
if breve.titre.startswith('Cette semaine sur Panik'):
continue
else:
has_sound = '-'
base_spip_edit_url = 'http://www.radiopanik.org/spip/ecrire/?exec=articles_edit&id_article='
- print >> self.stats_skipped_file, unicode('%s\t%s\t%s\t%s%s' % (
+ self.stats_skipped_file.write(unicode('%s\t%s\t%s\t%s%s' % (
emission.title, article.titre, has_sound,
- base_spip_edit_url, article.id_article)).encode('utf-8')
+ base_spip_edit_url, article.id_article)).encode('utf-8'))
return None
possible_slugs = [article.url.lower()]
return
if self.verbose:
- print ' set portfolio on', object
+ print(' set portfolio on', object)
# get filename, eventually to properly sized images
for i, attached_file in enumerate(attached_files):
def write_rewritemap(self, rewritemap_file):
fd = file(rewritemap_file, 'w')
for src, dst in self.rewritemap:
- print >> fd, src, dst
+ fd.write('%s %s\n' % (src, dst))
fd.close()
+from __future__ import print_function
+
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
try:
episode = Episode.objects.get(slug=episode_slug)
except Episode.DoesNotExist:
- print 'missing episode:', episode
+ print('missing episode:', episode)
episode.emission = emission
episode.save()
+from __future__ import print_function
+
from datetime import datetime, timedelta
from django.core.management.base import BaseCommand, CommandError
week, '%W')
date = datetime(*date.timetuple()[:3])
for entry in period_program(date, date+timedelta(days=7)):
- print entry.datetime, entry
+ print(entry.datetime, entry)
+from __future__ import print_function
+
from django.core.management.base import BaseCommand, CommandError
from ...utils import whatsonair
class Command(BaseCommand):
def handle(self, *args, **options):
onair = whatsonair()
- print 'found episode:', onair.get('episode')
- print 'found emission:', onair.get('emission')
- print 'found nonstop:', onair.get('nonstop')
+ print('found episode:', onair.get('episode'))
+ print('found emission:', onair.get('emission'))
+ print('found nonstop:', onair.get('nonstop'))