Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. <releases>
  2. <release id="1" status="Accepted">
  3. <images>
  4. <image height="600" type="primary" uri="" uri150="" width="600"/>
  5. <image height="600" type="secondary" uri="" uri150="" width="600"/>
  6. <image height="600" type="secondary" uri="" uri150="" width="600"/>
  7. <image height="600" type="secondary" uri="" uri150="" width="600"/>
  8. </images>
  9. <artists>
  10. <artist>
  11. <id>1</id>
  12. <name>Artists name</name>
  13. <anv/>
  14. <join>,</join>
  15. <role/>
  16. <tracks/>
  17. </artist>
  18. </artists>
  19. <title>Release Title</title>
  20. <labels>
  21. <label catno="catno01" name="name"/>
  22. </labels>
  23. <extraartists>
  24. <artist>
  25. <id>25235</id>
  26. <name>Artist Name</name>
  27. <anv/>
  28. <join/>
  29. <role>Artist Role</role>
  30. <tracks/>
  31. </artist>
  32. </extraartists>
  33. <genres>
  34. <genre>Genre1</genre>
  35. </genres>
  36. <styles>
  37. <style>style1</style>
  38. </styles>
  39. <styles>
  40. <style>style2</style>
  41. </styles>
  42. <styles>
  43. <style>style3</style>
  44. </styles>
  45. <country>Country</country>
  46. <released>1999-03-00</released>
  47. <notes>blah blah blah
  48. </notes>
  49. <data_quality>Correct</data_quality>
  50. <tracklist>
  51. <track>
  52. <position>A</position>
  53. <title>Title1</title>
  54. <duration>4:45</duration>
  55. </track>
  56. <track>
  57. <position>B1</position>
  58. <title>Title2</title>
  59. <duration>6:11</duration>
  60. </track>
  61. <track>
  62. <position>B2</position>
  63. <title>title3</title>
  64. <duration>2:49</duration>
  65. </track>
  66. <track>
  67. <position>C1</position>
  68. <title>title4</title>
  69. <duration>5:38</duration>
  70. </track>
  71. <track>
  72. <position>C2</position>
  73. <title>title5</title>
  74. <duration>4:52</duration>
  75. </track>
  76. <track>
  77. <position>D</position>
  78. <title>title6</title>
  79. <duration>5:16</duration>
  80. </track>
  81. </tracklist>
  82. <companies>
  83. <company>
  84. <id>32463246</id>
  85. <name>Company1</name>
  86. <catno/>
  87. <entity_type>23</entity_type>
  88. <entity_type_name>Recorded At</entity_type_name>
  89. <resource_url>http://someurl.com</resource_url>
  90. </company>
  91. <company>
  92. <id>2323523</id>
  93. <name>company2</name>
  94. <catno/>
  95. <entity_type>17</entity_type>
  96. <entity_type_name>blah blah</entity_type_name>
  97. <resource_url>http://someotherurl.com</resource_url>
  98. </company>
  99. </companies>
  100. </release>
  101. </releases>
  102.  
  103. def release = new File('release.txt')
  104. def track = new File('tracks.txt')
  105.  
  106. releases = new XmlSlurper().parse("../data/disk1a.xml")
  107. releases.release.each
  108. {
  109. def releaseid = ${it.@id}
  110. println("$releaseid")
  111. release.append ("Release,${it.@id},${it.title},${it.artists.artist.name},${it.genres.genre},${it.country}, ${it.released}n")
  112. //println ("${it.@id} id ${it.title} album ${it.artists.artist.name} artist ${it.genres.genre} genre ${it.released} release date")
  113. it.styles.each
  114. {
  115.  
  116. release.append("style,${it.style}n")
  117. }
  118. it.tracklist.track.each
  119. {
  120. //track.append("${it.@id} ${it.title} ${it.duration}n")
  121. //println("${it.@id} ${it.title} ${it.duration}")
  122. release.append("tracks,${it.@id}, ${it.title},${it.duration}n")
  123. }
  124.  
  125. it.companies.company.each
  126. {
  127. release.append("company,${it.id},${it.name},${it.resource_url}n")
  128. }
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement