Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. def load_meta_data(video_id):
  2. dane = None
  3. # load meta informations about video_id
  4. pickle_file = '{}{}/{}.p'.format(input, video_id, video_id)
  5. with open(pickle_file, 'rb') as f:
  6. dane = pickle.load(f)
  7.  
  8. title = str(dane.name)
  9. leng = str(dane.duration)
  10. #print video_id, title
  11. _ = myCache.setdefault(video_id, {})
  12. _['title'] = title
  13. _['duration' ] = leng
  14. #print _
  15.  
  16.  
  17. def load_sim_data(video_id):
  18. cosim_alles = None
  19.  
  20. # load similar videos for video_id using method alles
  21. compare_file = '{}{}/compare_ddc.p'.format(input, video_id)
  22. with open(compare_file, 'rb') as f:
  23. cosim_alles = pickle.load(f)
  24. for i in cosim_alles[0:10]: # max 10 vorschlaege
  25. _ = myData.setdefault(video_id, {})
  26. print _
  27. _ = _.setdefault('alles', OrderedDict())
  28. _id = i[1].split('/', 1)[1]
  29. if '.txt' in _id:
  30. _id = _id.rstrip('.txt')
  31. _id = int(_id)
  32. _ = _.setdefault(_id, {'title': get_cache_data(_id)['title'], 'duration': get_cache_data(_id)['duration'], 'sim': i[2]})
  33. #print get_cache_data(_id)['title']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement