A Python UPnP Media Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.4 KiB

  1. #!/usr/bin/env python
  2. import pydvdread
  3. import sys
  4. def bcdtoint(bcd):
  5. base = 1
  6. ret = 0
  7. while bcd:
  8. assert bcd % 16 < 10, 'invalid bcd digit in: %#x' % bcd
  9. ret += bcd % 16 * base
  10. base *= 10
  11. bcd /= 16
  12. return ret
  13. def strdvdtime(tobj):
  14. return '%x:%02x:%02x.%02x' % (tobj.hour, tobj.minute, tobj.second,
  15. tobj.frame_u & 0x3f)
  16. def dumppgc(j):
  17. print 'nr_of_progs:', j.nr_of_programs
  18. print 'nr_of_cells:', j.nr_of_cells
  19. print 'time:', strdvdtime(j.playback_time)
  20. for k in range(j.nr_of_programs):
  21. print 'program_map[%d]:' % k, pydvdread.uchar_getitem(
  22. j.program_map, k)
  23. for k in range(j.nr_of_cells):
  24. l = pydvdread.cell_playback_getitem(j.cell_playback, k)
  25. print 'cell_playback[%d]:' % k, '%d-%d' % (l.first_sector,
  26. l.last_sector), strdvdtime(l.playback_time)
  27. try:
  28. dvd = pydvdread.DVD('/dev/null')
  29. except ValueError:
  30. pass
  31. except:
  32. assert 0, 'Failed to fail.'
  33. dvd = pydvdread.DVD('/dev/rdisk1')
  34. print dvd, ', '.join(map(repr, dvd))
  35. try:
  36. print `dvd[(5, 5)]`
  37. except IndexError:
  38. pass
  39. except:
  40. assert 0, 'Failed to fail.'
  41. print 'vmg'
  42. ifo = dvd.getifo(0)
  43. assert ifo.txtdt_mgi is None
  44. print 'ifo:', `ifo`
  45. print '# vts:', ifo.vmgi_mat.vmg_nr_of_title_sets
  46. print 'provider:', `ifo.vmgi_mat.provider_identifier`
  47. print 'nr_of_srpts:', ifo.tt_srpt.nr_of_srpts
  48. for i in range(ifo.tt_srpt.nr_of_srpts):
  49. print `ifo.tt_srpt.title`
  50. j = pydvdread.title_info_getitem(ifo.tt_srpt.title, i)
  51. print 'playbacktype:', j.pb_ty.multi_or_random_pgc_title, j.pb_ty.jlc_exists_in_cell_cmd, j.pb_ty.jlc_exists_in_prepost_cmd, j.pb_ty.jlc_exists_in_button_cmd, j.pb_ty.jlc_exists_in_tt_dom, j.pb_ty.chapter_search_or_play, j.pb_ty.title_or_time_play
  52. print '# angles:', j.nr_of_angles
  53. print '# ptts:', j.nr_of_ptts
  54. print 'parental id:', j.parental_id
  55. print 'title set #:', j.title_set_nr
  56. print 'vts ttn:', j.vts_ttn
  57. for ifonum in range(ifo.vmgi_mat.vmg_nr_of_title_sets):
  58. print 'vts'
  59. ifo = dvd.getifo(1 + ifonum)
  60. print 'ifo:', `ifo`
  61. print dir(ifo)
  62. print '# of srpts:', ifo.vts_ptt_srpt.nr_of_srpts
  63. for i in range(ifo.vts_ptt_srpt.nr_of_srpts):
  64. print 'title #:', i
  65. j = pydvdread.ttu_getitem(ifo.vts_ptt_srpt.title, i)
  66. print '# of ptts:', j.nr_of_ptts
  67. for i in range(j.nr_of_ptts):
  68. k = pydvdread.ptt_info_getitem(j.ptt, i)
  69. print 'pgcn:', k.pgcn
  70. print 'pgn:', k.pgn
  71. print 'pgc:', `ifo.vts_pgcit.nr_of_pgci_srp`
  72. for i in range(ifo.vts_pgcit.nr_of_pgci_srp):
  73. dumppgc(pydvdread.pgci_srp_getitem(ifo.vts_pgcit.pgci_srp, i).pgc)