Skip to content

Commit

Permalink
Make print a function for Python 3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
macfreek committed Mar 10, 2012
1 parent 29ca170 commit 3346e04
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions tv_grab_nl_py
Original file line number Diff line number Diff line change
Expand Up @@ -343,31 +343,31 @@ class ProgramCache:


def usage():
print 'tv_grab_nl_py: A grabber that grabs tvguide data from tvgids.nl\n'
print 'and stores it in XMLTV-combatible format.\n'
print 'Usage:'
print '--help, -h = print this info'
print '--configure = create configfile (overwrites existing file)'
print '--config-file = name of the configuration file (default = ~/.xmltv/tv_grab_py.conf'
print '--capabilities = xmltv required option'
print '--desc-length = maximum allowed length of programme descriptions in bytes.'
print '--description = prints a short description of the grabber'
print '--output = file where to put the output'
print '--days = # number of days to grab'
print '--preferredmethod = returns the preferred method to be called'
print '--fast = do not grab descriptions of programming'
print '--slow = grab descriptions of programming'
print '--quiet = suppress all output'
print '--compat = append tvgids.nl to the xmltv id (use this if you were using tv_grab_nl)'
print '--logos 0/1 = insert urls to channel icons (mythfilldatabase will then use these)'
print '--nocattrans = do not translate the grabbed genres into MythTV-genres'
print '--cache = cache descriptions and use the file to store'
print '--clean_cache = clean the cache file before fetching'
print '--clear_cache = empties the cache file before fetching data'
print '--slowdays = grab slowdays initial days and the rest in fast mode'
print '--max_overlap = maximum length of overlap between programming to correct [minutes]'
print '--overlap_strategy = what strategy to use to correct overlaps (check top of source code)'

print('tv_grab_nl_py: A grabber that grabs tvguide data from tvgids.nl\n')
print('and stores it in XMLTV-combatible format.\n')
print('Usage:')
print('--help, -h = print this info')
print('--configure = create configfile (overwrites existing file)')
print('--config-file = name of the configuration file (default = ~/.xmltv/tv_grab_py.conf')
print('--capabilities = xmltv required option')
print('--desc-length = maximum allowed length of programme descriptions in bytes.')
print('--description = prints a short description of the grabber')
print('--output = file where to put the output')
print('--days = # number of days to grab')
print('--preferredmethod = returns the preferred method to be called')
print('--fast = do not grab descriptions of programming')
print('--slow = grab descriptions of programming')
print('--quiet = suppress all output')
print('--compat = append tvgids.nl to the xmltv id (use this if you were using tv_grab_nl)')
print('--logos 0/1 = insert urls to channel icons (mythfilldatabase will then use these)')
print('--nocattrans = do not translate the grabbed genres into MythTV-genres')
print('--cache = cache descriptions and use the file to store')
print('--clean_cache = clean the cache file before fetching')
print('--clear_cache = empties the cache file before fetching data')
print('--slowdays = grab slowdays initial days and the rest in fast mode')
print('--max_overlap = maximum length of overlap between programming to correct [minutes]')
print('--overlap_strategy = what strategy to use to correct overlaps (check top of source code)'
)

def filter_line_identity(m, defs=htmlentitydefs.entitydefs):
# callback: translate one entity to its ISO Latin value
Expand Down Expand Up @@ -1039,8 +1039,8 @@ def xmlefy_programs(programs, channel, desc_len, compat=0, nocattrans=0):
if program.has_key('clumpidx'):
clumpidx = 'clumpidx="'+program['clumpidx']+'"'
except LookupError:
print program

print(program
)
output.append(u' <programme start="%s" stop="%s" channel="%s%s" %s> \n' % \
(format_timezone(program['start-time']), format_timezone(program['stop-time']),\
channel, compat and '.tvgids.nl' or '', clumpidx))
Expand Down Expand Up @@ -1216,18 +1216,18 @@ def main():
quiet = 1;

if o == "--description":
print "The Netherlands (tv_grab_nl_py $Rev: 106 $)"
print("The Netherlands (tv_grab_nl_py $Rev: 106 $)")
return(0)

if o == "--capabilities":
print "baseline"
print "cache"
print "manualconfig"
print "preferredmethod"
print("baseline")
print("cache")
print("manualconfig")
print("preferredmethod")
return(0)

if o == '--preferredmethod':
print 'allatonce'
print('allatonce')
return(0)

if o == '--desc-length':
Expand Down Expand Up @@ -1349,20 +1349,20 @@ def main():

# print header stuff
encoding = 'UTF-8'
print '<?xml version="1.0" encoding="%s"?>' % encoding
print '<!DOCTYPE tv SYSTEM "xmltv.dtd">'
print '<tv generator-info-name="tv_grab_nl_py $Rev$">'
print('<?xml version="1.0" encoding="%s"?>' % encoding)
print('<!DOCTYPE tv SYSTEM "xmltv.dtd">')
print('<tv generator-info-name="tv_grab_nl_py $Rev$">')

# first do the channel info
for key in channels.keys():
print ' <channel id="%s%s">' % (key, compat and '.tvgids.nl' or '')
print ' <display-name lang="nl">%s</display-name>' % channels[key].encode(encoding)
print(' <channel id="%s%s">' % (key, compat and '.tvgids.nl' or ''))
print(' <display-name lang="nl">%s</display-name>' % channels[key].encode(encoding))
if (logos):
ikey = int(key)
if logo_names.has_key(ikey):
full_logo_url = logo_provider[logo_names[ikey][0]]+logo_names[ikey][1]+'.gif'
print ' <icon src="%s" />' % full_logo_url
print ' </channel>'
print(' <icon src="%s" />' % full_logo_url)
print(' </channel>')

num_chans = len(channels.keys())
channel_cnt = 0
Expand Down Expand Up @@ -1391,7 +1391,7 @@ def main():
for program in programs:
title_split(program)

print xmlefy_programs(programs, id, desc_len, compat, nocattrans).encode(xmlencoding)
print(xmlefy_programs(programs, id, desc_len, compat, nocattrans).encode(xmlencoding))

# save the cache after each channel fetch
if program_cache != None:
Expand All @@ -1403,7 +1403,7 @@ def main():
program_cache.dump(program_cache_file)

# print footer stuff
print "</tv>"
print("</tv>")

# close the outputfile if necessary
if output != None:
Expand Down

0 comments on commit 3346e04

Please sign in to comment.