[tracker] tests: Adapt generator to generate nmm:MusicAlbumDisc



commit 70b19e0f073922db96cf300eea2cf48576d7eebe
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Dec 2 14:33:50 2010 +0100

    tests: Adapt generator to generate nmm:MusicAlbumDisc
    
    This adaptation might influence other timings and numbers.

 tests/functional-tests/ttl/Makefile.am |    1 +
 utils/data-generators/cc/generate      |   10 ++++++++--
 utils/data-generators/cc/max.cfg       |    1 +
 utils/data-generators/cc/nmm.py        |   18 +++++++++++++++++-
 4 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/tests/functional-tests/ttl/Makefile.am b/tests/functional-tests/ttl/Makefile.am
index e72c8bb..f236258 100644
--- a/tests/functional-tests/ttl/Makefile.am
+++ b/tests/functional-tests/ttl/Makefile.am
@@ -32,6 +32,7 @@ ttl_DATA =                                             \
 	037-nmo_SMSMessage.ttl                         \
 	038-nmo_Call.ttl                               \
 	040-nmm_Artist.ttl                             \
+	040-nmm_MusicAlbumDisc.ttl                     \
 	041-nmm_MusicAlbum.ttl                         \
 	042-nmm_MusicPiece.ttl                         \
 	045-nmm_Photo.ttl                              \
diff --git a/utils/data-generators/cc/generate b/utils/data-generators/cc/generate
index af1d453..134d3b4 100755
--- a/utils/data-generators/cc/generate
+++ b/utils/data-generators/cc/generate
@@ -78,6 +78,7 @@ tools.addType( 'nmo#IMMessage', 36 )
 tools.addType( 'nmo#SMSMessage', 37 )
 tools.addType( 'nmo#Call', 38 )
 tools.addType( 'nmm#Artist', 40 )
+tools.addType( 'nmm#MusicAlbumDisc', 40)
 tools.addType( 'nmm#MusicAlbum', 41 )
 tools.addType( 'nmm#MusicPiece', 42 )
 tools.addType( 'nfo#Equipment', 44 )
@@ -182,14 +183,19 @@ print "Generating Music",
 count_artists = get_counter('counts','artists')
 count_albums = get_counter('counts','albums')
 count_songs = get_counter('counts','songs')
+count_discs = get_counter('counts','discs')
+song_index = 0
 for artist in xrange(1, count_artists+1):
   sys.stdout.write('.')
   sys.stdout.flush()
   nmm.generateArtist( artist*count_albums*count_songs )
   for album in xrange(1, count_albums+1):
     nmm.generateAlbum( artist*count_albums*count_songs+album )
-    for song in xrange(1, count_songs+1):
-      nmm.generateMusicPiece( artist*count_albums*count_songs+album*count_songs+song )
+    for disc in xrange(1, count_discs+1):
+       discUri = nmm.generateMusicAlbumDisc( artist*count_albums*count_songs+album+disc )
+       for song in xrange(1, count_songs+1):
+          nmm.generateMusicPiece( song_index, discUri )
+          song_index = song_index + 1
 print "Done"
 
 print "Generate Equipment",
diff --git a/utils/data-generators/cc/max.cfg b/utils/data-generators/cc/max.cfg
index 8c35b6b..5dbadbe 100644
--- a/utils/data-generators/cc/max.cfg
+++ b/utils/data-generators/cc/max.cfg
@@ -43,6 +43,7 @@ volumes  : 5
 artists  : 50
 albums   : 20
 songs    : 10
+discs    : 2
 
 # Images
 images   : 10000
diff --git a/utils/data-generators/cc/nmm.py b/utils/data-generators/cc/nmm.py
index 505d6a1..4f73b1d 100644
--- a/utils/data-generators/cc/nmm.py
+++ b/utils/data-generators/cc/nmm.py
@@ -109,6 +109,19 @@ def generateArtist(index):
   tools.addItem( me, artist_uri, nmm_Artist % locals() )
 
 ####################################################################################
+nmm_MusicAlbumDisc = '''
+<%(album_disc_uri)s> a nmm:MusicAlbumDisc .
+'''
+def generateMusicAlbumDisc(index):
+  me = 'nmm#MusicAlbumDisc'
+  album_disc_uri = 'urn:album-disk:%d' % index
+  album_disc_name = 'Album Disc %d' % (index % 1000)
+
+  tools.addItem( me, album_disc_uri, nmm_MusicAlbumDisc % locals() )
+
+  return album_disc_uri
+
+####################################################################################
 nmm_MusicAlbum = '''
 <%(album_uri)s> a nmm:MusicAlbum ;
     nie:title        "%(album_name)s" ;
@@ -121,6 +134,7 @@ def generateAlbum(index):
 
   tools.addItem( me, album_uri, nmm_MusicAlbum % locals() )
 
+
 ####################################################################################
 nmm_MusicPiece = '''
 <%(music_piece_uri)s> a nmm:MusicPiece, nfo:FileDataObject, nfo:Audio;
@@ -143,11 +157,12 @@ nmm_MusicPiece = '''
     nfo:channels               "%(music_piece_channels)s" ;
     nfo:sampleRate             "%(music_piece_sample_rate)s" ;
     nmm:musicAlbum             <%(music_piece_album)s> ;
+    nmm:musicAlbumDisc         <%(music_piece_album_disk)s> ;
     nmm:performer              <%(music_piece_artist)s> ;
     nfo:duration               "%(music_piece_length)s" ;
     nmm:trackNumber            "%(music_piece_track)s" .
 '''
-def generateMusicPiece(index):
+def generateMusicPiece(index, discUri):
   me = 'nmm#MusicPiece'
   music_piece_uri           = 'urn:music:%d' % index
   music_piece_title         = 'Song %d' % index
@@ -166,6 +181,7 @@ def generateMusicPiece(index):
   music_piece_sample_rate   = '44100.0'
   music_piece_album         = tools.getLastUri( 'nmm#MusicAlbum' )
   music_piece_artist        = tools.getLastUri( 'nmm#Artist' )
+  music_piece_album_disk    = discUri
   music_piece_length        = '%d' % (1 + (index % 1000))
   music_piece_track         = '%d' % (1 + (index % 100))
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]