本文整理汇总了Python中musicbrainz2.wsxml.MbXmlParser.getTrack方法的典型用法代码示例。如果您正苦于以下问题:Python MbXmlParser.getTrack方法的具体用法?Python MbXmlParser.getTrack怎么用?Python MbXmlParser.getTrack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类musicbrainz2.wsxml.MbXmlParser
的用法示例。
在下文中一共展示了MbXmlParser.getTrack方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testTrackFull
# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getTrack [as 别名]
def testTrackFull(self):
f = os.path.join(VALID_TRACK_DIR, 'Silent_All_These_Years_4.xml')
md = MbXmlParser().parse(f)
track = md.getTrack()
self.failIf( track is None )
self.assertEquals(track.getTitle(), 'Silent All These Years')
self.assertEquals(track.getDuration(), 253466)
artist = track.getArtist()
self.failIf( artist is None )
self.assertEquals(artist.getId(),
makeId('c0b2500e-0cef-4130-869d-732b23ed9df5', 'artist'))
self.assertEquals(artist.getType(), NS_MMD_1 + 'Person')
self.assertEquals(artist.getName(), 'Tori Amos')
self.assertEquals(artist.getSortName(), 'Amos, Tori')
puids = track.getPuids()
self.assertEquals(len(puids), 7)
self.assertEquals(puids[0], 'c2a2cee5-a8ca-4f89-a092-c3e1e65ab7e6')
self.assertEquals(puids[6], '42ab76ea-5d42-4259-85d7-e7f2c69e4485')
isrcs = track.isrcs
self.assertEquals(len(isrcs), 1)
self.assertEquals(isrcs[0], 'USPR37300012')
releases = track.getReleases()
self.assertEquals(len(releases), 1)
self.assertEquals(releases[0].getTitle(), 'Little Earthquakes')
self.assertEquals(releases[0].getTracksOffset(), 2)
示例2: testTrackBasic
# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getTrack [as 别名]
def testTrackBasic(self):
f = os.path.join(VALID_TRACK_DIR, 'Silent_All_These_Years_1.xml')
md = MbXmlParser().parse(f)
track = md.getTrack()
self.failIf( track is None )
self.assertEquals(track.getTitle(), 'Silent All These Years')
self.assertEquals(track.getDuration(), 253466)
示例3: testTrackRelations
# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getTrack [as 别名]
def testTrackRelations(self):
f = os.path.join(VALID_TRACK_DIR, 'Silent_All_These_Years_2.xml')
md = MbXmlParser().parse(f)
track = md.getTrack()
self.failIf( track is None )
self.assertEquals(track.getTitle(), 'Silent All These Years')
self.assertEquals(track.getDuration(), 253466)
trackRels = track.getRelations(Relation.TO_TRACK)
self.assertEquals(len(trackRels), 1)
rel1 = trackRels[0]
self.assertEquals(rel1.getType(), NS_REL_1 + 'Cover')
self.assertEquals(rel1.getDirection(), Relation.DIR_BACKWARD)
self.assertEquals(rel1.getTargetId(),
makeId('31e1c0c4-967f-435e-b09a-35ee079ee234', 'track'))
self.assert_( rel1.getBeginDate() is None )
self.assert_( rel1.getEndDate() is None )
self.failIf( rel1.getTarget() is None )
self.assertEquals(rel1.getTarget().getId(),
makeId('31e1c0c4-967f-435e-b09a-35ee079ee234'))
self.assertEquals(rel1.getTarget().getArtist().getId(),
makeId('5bcd4eaa-fae7-465f-9f03-d005b959ed02', 'artist'))