This commit is contained in:
j 2021-05-31 17:03:47 +01:00
parent 4ccd6adb86
commit 49ba3b6c7c
3 changed files with 11 additions and 11 deletions

View file

@ -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)

View file

@ -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)

View file

@ -1,4 +1,4 @@
from __future__ import division
import re
import ox
import item.models