Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def load_meta_data(video_id):
- dane = None
- # load meta informations about video_id
- pickle_file = '{}{}/{}.p'.format(input, video_id, video_id)
- with open(pickle_file, 'rb') as f:
- dane = pickle.load(f)
- title = str(dane.name)
- leng = str(dane.duration)
- #print video_id, title
- _ = myCache.setdefault(video_id, {})
- _['title'] = title
- _['duration' ] = leng
- #print _
- def load_sim_data(video_id):
- cosim_alles = None
- # load similar videos for video_id using method alles
- compare_file = '{}{}/compare_ddc.p'.format(input, video_id)
- with open(compare_file, 'rb') as f:
- cosim_alles = pickle.load(f)
- for i in cosim_alles[0:10]: # max 10 vorschlaege
- _ = myData.setdefault(video_id, {})
- print _
- _ = _.setdefault('alles', OrderedDict())
- _id = i[1].split('/', 1)[1]
- if '.txt' in _id:
- _id = _id.rstrip('.txt')
- _id = int(_id)
- _ = _.setdefault(_id, {'title': get_cache_data(_id)['title'], 'duration': get_cache_data(_id)['duration'], 'sim': i[2]})
- #print get_cache_data(_id)['title']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement