From 49ba3b6c7c6021215a4fcea340e91e527229f76e Mon Sep 17 00:00:00 2001 From: j Date: Mon, 31 May 2021 17:03:47 +0100 Subject: [PATCH] python3 --- data.py | 8 ++++---- get_data.py | 12 ++++++------ notes.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/data.py b/data.py index c8846a7..3897118 100644 --- a/data.py +++ b/data.py @@ -36,7 +36,7 @@ def update_item(d, add_only=False): if 'year' in info: if isinstance(info['year'], list): info['year'] = info['year'][0] - if isinstance(info['year'], basestring): + if isinstance(info['year'], str): info['year'] = info['year'][:4] extra = [] for key in ('director', 'publisher', 'creator', 'sponsor'): @@ -83,7 +83,7 @@ def update_item(d, add_only=False): i, created = get_item(info['archive']) if add_only and not created: return - print info['archive'], info.get('title', 'Untitled') + print(info['archive'], info.get('title', 'Untitled')) for k in info: i.data[k] = info[k] i.level = 0 @@ -117,7 +117,7 @@ def update_stream(i): return False oshash = ox.net.oshash(stream_url) if oshash == 'IOError': - print 'invalid url', stream_url + print('invalid url', stream_url) return False f, created = archive.models.File.objects.get_or_create(oshash=oshash) f.item = i @@ -140,6 +140,6 @@ def update_streams(): import itemlist.models l = itemlist.models.List.get('j:with Video') for i in item.models.Item.objects.all(): - print i + print(i) if update_item_stream(i): l.add(i) diff --git a/get_data.py b/get_data.py index 8e44f9b..8abe5f7 100644 --- a/get_data.py +++ b/get_data.py @@ -11,10 +11,10 @@ for e in internetarchive.search.Search('collection:prelinger'): if files: break if files: - print item.metadata['title'] - print 'https://archive.org/details/%s' % item.identifier + print(item.metadata['title']) + print('https://archive.org/details/%s' % item.identifier) url = 'https://archive.org/download/%s/%s' % (item.identifier, files[0]['name']) - print url + print(url) data[item.identifier] = { 'id': item.identifier, 'mp4': url, @@ -36,8 +36,8 @@ for e in internetarchive.search.Search('collection:prelinger'): else: formats = sorted({f['format']:1 for f in item.files}.keys()) if formats: - print item.identifier, item.files - print formats + print(item.identifier, item.files) + print(formats) with open('prelinger.json', 'w') as f: - json.dump(data.values(), f, indent=2) + json.dump(list(data.values()), f, indent=2) diff --git a/notes.py b/notes.py index ae1c5b1..22a75fa 100644 --- a/notes.py +++ b/notes.py @@ -1,4 +1,4 @@ -from __future__ import division + import re import ox import item.models