PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/libgmbox/libgmbox/utility.py

http://gmbox.googlecode.com/
Python | 53 lines | 50 code | 1 blank | 2 comment | 0 complexity | 6007cc20d2e9405c07318327e3c05a6d MD5 | raw file
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. __doc__ = '''打印调试函数'''
  4. def print_song(song):
  5. '''打印Song类实例信息
  6. 注意
  7. 在测试Songlist或者Directory类时
  8. 你可以注释
  9. song.load_detail()
  10. song.load_streaming()
  11. 以免发出过多的http请求
  12. '''
  13. song.load_detail()
  14. song.load_streaming()
  15. for key, value in song.gmattrs.iteritems():
  16. print "%s: %s" % (key , value)
  17. print
  18. def print_songlist(songlist):
  19. '''打印Songlist类实例信息
  20. 注意
  21. 在测试Songlist或者Directory类时
  22. 你可以注释
  23. print_song(song)
  24. 以免发出过多的http请求
  25. '''
  26. for key, value in songlist.gmattrs.iteritems():
  27. print "%s: %s" % (key , value)
  28. for song in songlist.songs:
  29. print_song(song)
  30. print
  31. def print_directory(directory):
  32. '''打印Directory类实例信息
  33. 注意
  34. 在测试Songlist或者Directory类时
  35. 你可以注释
  36. songlist.load_songs()
  37. 以免发出过多的http请求
  38. '''
  39. for songlist in directory.songlists:
  40. songlist.load_songs()
  41. print_songlist(songlist)