[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r173 - in gnue-cddb: . lib schema
From: |
johannes |
Subject: |
r173 - in gnue-cddb: . lib schema |
Date: |
Mon, 20 Dec 2004 14:03:28 -0600 (CST) |
Author: johannes
Date: 2004-12-20 14:03:27 -0600 (Mon, 20 Dec 2004)
New Revision: 173
Modified:
gnue-cddb/disc.gfd
gnue-cddb/lib/helper.py
gnue-cddb/schema/cddb.gcd
Log:
Disc and Track can have multiple artists
Modified: gnue-cddb/disc.gfd
===================================================================
--- gnue-cddb/disc.gfd 2004-12-16 16:21:23 UTC (rev 172)
+++ gnue-cddb/disc.gfd 2004-12-20 20:03:27 UTC (rev 173)
@@ -37,7 +37,9 @@
explicitfields="cddb_lastname,cddb_middlename,cddb_firstname,cddb_matchcode"
/>
<datasource connection="appserver" name="dtsTArtist" table="cddb_artist"
- order_by="cddb_name" prequery="True" cache="250" />
+ order_by="cddb_name" prequery="True" cache="250"
+
explicitfields="cddb_lastname,cddb_middlename,cddb_firstname,cddb_matchcode"
+ />
<datasource connection="appserver" name="dtsCategory" table="cddb_category"
order_by="cddb_name" prequery="True" cache="250" />
@@ -50,6 +52,14 @@
master="dtsDisc" masterlink="gnue_id" detaillink="cddb_disc"
order_by="cddb_track" />
+ <datasource connection="appserver" name="dtsDiscArtist"
+ table="cddb_discartist" master="dtsDisc" masterlink="gnue_id"
+ detaillink="cddb_disc" />
+
+ <datasource connection="appserver" name="dtsTrackArtist"
+ table="cddb_trackartist" master="dtsTrack" masterlink="gnue_id"
+ detaillink="cddb_track" />
+
<datasource connection="appserver" name="dtsSrcArtist" table="cddb_artist"
explicitfields="cddb_lastname,cddb_middlename,cddb_firstname,cddb_matchcode"
prequery="False" cache="250" />
@@ -62,9 +72,6 @@
<block name="blkDisc" datasource="dtsDisc">
<field name="title" field="cddb_title" maxLength="60" />
- <field name="artist" field="cddb_artist" fk_key="gnue_id"
- fk_description="cddb_name" fk_source="dtsDArtist" />
-
<field name="category" field="cddb_category" fk_key="gnue_id"
fk_description="cddb_name" fk_source="dtsCategory" />
@@ -76,12 +83,16 @@
<field name="comment" field="cddb_comment" maxLength="70" />
<field name="url" field="filedb_url" readonly="True" />
<field name="length" field="cddb_length" typecast="date" />
+ </block>
- <field name="gid" field="gnue_id" readonly="True" />
+
+ <block name="blkDiscArtist" datasource="dtsDiscArtist" rows="3">
+ <field name="artist" field="cddb_artist" fk_key="gnue_id"
+ fk_description="cddb_name" fk_source="dtsDArtist" />
</block>
- <block name="blkTrack" datasource="dtsTrack" rows="13" >
+ <block name="blkTrack" datasource="dtsTrack" rows="10" >
<field name="track" field="cddb_track" maxLength="2"
typecast="number" />
@@ -90,13 +101,14 @@
<field name="comment" field="cddb_comment" maxLength="70" />
<field name="length" field="cddb_length" typecast="date" />
- <field name="artist" field="cddb_artist" fk_key="gnue_id"
- fk_description="cddb_name" fk_source="dtsTArtist" />
-
<field name="ripped" field="filedb_ripdate" typecast="date" />
<field name="url" field="filedb_url" />
<field name="action" />
+ </block>
+ <block name="blkTrackArtist" datasource="dtsTrackArtist" rows="3" >
+ <field name="artist" field="cddb_artist" fk_key="gnue_id"
+ fk_description="cddb_name" fk_source="dtsTArtist" />
</block>
<block name="blkOptions" datasource="dtsOptions">
@@ -117,7 +129,7 @@
<!-- Layout (Main Form) -->
<!-- =================================================================== -->
- <layout xmlns:c="GNUe:Layout:Char" c:height="21" c:width="100" tabbed="none">
+ <layout xmlns:c="GNUe:Layout:Char" c:height="19" c:width="100" tabbed="none">
<page name="pgDisc" caption="Disc">
@@ -126,68 +138,60 @@
<!-- ================================================================ -->
<label c:x="1" c:y="1" c:width="9" text="Title:" />
- <label c:x="1" c:y="2" c:width="9" text="Artist:" />
- <label c:x="1" c:y="3" c:width="9" text="Category:" />
+ <label c:x="1" c:y="2" c:width="9" text="Category:" />
+ <label c:x="1" c:y="3" c:width="9" text="Basepath:" />
- <label c:x="50" c:y="1" c:width="8" text="Disc-Id:" />
- <label c:x="50" c:y="2" c:width="8" text="Year:" />
- <label c:x="50" c:y="3" c:width="10" text="Base path:" />
+ <label c:x="42" c:y="1" c:width="8" text="Disc-Id:" />
+ <label c:x="42" c:y="2" c:width="5" text="Year:" />
- <label c:x="71" c:y="1" c:width="8" text="Length:" />
<entry c:x="11" c:y="1" c:width="30" block="blkDisc" field="title"
focusorder="1" />
- <entry c:x="11" c:y="2" c:width="30" block="blkDisc" field="artist"
+ <entry c:x="11" c:y="2" c:width="30" block="blkDisc" field="category"
style="dropdown" />
- <button c:x="42" c:y="2" c:width="3" label="..." navigable="False">
+ <entry c:x="11" c:y="3" c:width="54" block="blkDisc" field="url" />
+
+ <button c:x="65" c:y="3" c:width="3" label="..." navigable="False">
<trigger type="ON-ACTION">
blkDisc.url.set (blkDisc.call ('filedb_defaultURL', None))
</trigger>
</button>
- <entry c:x="11" c:y="3" c:width="30" block="blkDisc" field="category"
- style="dropdown" />
- <entry c:x="60" c:y="1" c:width="10" block="blkDisc" field="discid" />
+ <entry c:x="50" c:y="1" c:width="10" block="blkDisc" field="discid" />
+ <entry c:x="50" c:y="2" c:width="6" block="blkDisc" field="year" />
- <entry c:x="60" c:y="2" c:width="10" block="blkDisc" field="year" />
- <entry c:x="60" c:y="3" c:width="39" block="blkDisc" field="url" />
-
- <entry c:x="79" c:y="1" c:width="10" block="blkDisc" field="length"
+ <entry c:x="58" c:y="2" c:width="10" block="blkDisc" field="length"
displaymask="%X" style="label" />
+ <entry c:x="69" c:y="1" c:width="30" block="blkDiscArtist" field="artist"
+ style="dropdown" />
<!-- ================================================================ -->
<!-- Button Row (Actions) -->
<!-- ================================================================ -->
- <button name="btnQuery" c:x="1" c:y="5" c:width="8" label="Query" >
+ <button c:x="45" c:y="16" c:width="18" label="Query" >
<trigger type="ON-ACTION" src="query_cd" />
</button>
- <button c:x="10" c:y="5" c:width="18" label="Audio Extraction" >
+ <button c:x="45" c:y="17" c:width="18" label="Audio Extraction" >
<trigger type="ON-ACTION" src="extract_audio" />
</button>
- <button c:x="29" c:y="5" c:width="12" label="Ogg-Encode" >
+ <button c:x="45" c:y="18" c:width="18" label="Ogg-Encode" >
<trigger type="ON-ACTION" src="ogg_encode" />
</button>
- <button c:x="42" c:y="5" c:width="8" label="Tag" >
+ <button c:x="64" c:y="16" c:width="12" label="Tag" >
<trigger type="ON-ACTION" src="tag_files" />
</button>
- <button c:x="51" c:y="5" c:width="8" label="Import" >
- <trigger type="ON-ACTION" >
- print "gonna ask now ..."
- res = blkOptions.call ('cddb_findArtist', {'name': 'foobar'})
- print "Res=", repr (res)
- </trigger>
- </button>
+ <button c:x="64" c:y="17" c:width="12" label="Import" />
- <button c:x="60" c:y="5" c:width="12" label="Toggle all" >
+ <button c:x="64" c:y="18" c:width="12" label="Toggle all" >
<trigger type="ON-ACTION" src="toggle_action" />
</button>
@@ -195,26 +199,23 @@
<!-- Detail-Record (Track) -->
<!-- ================================================================ -->
- <label c:x="1" c:y="7" c:width="3" text="Nr" />
- <label c:x="5" c:y="7" c:width="6" text="Title" />
- <label c:x="36" c:y="7" c:width="6" text="Length" />
- <label c:x="45" c:y="7" c:width="6" text="Artist" />
- <label c:x="61" c:y="7" c:width="6" text="Action" alignment="right" />
- <label c:x="69" c:y="7" c:width="6" text="URL" />
+ <label c:x="1" c:y="4" c:width="3" text="Nr" />
+ <label c:x="5" c:y="4" c:width="6" text="Title" />
+ <label c:x="36" c:y="4" c:width="6" text="Length" />
+ <label c:x="93" c:y="4" c:width="6" text="Action" alignment="right" />
- <entry c:x="1" c:y="8" c:width="3" block="blkTrack" field="track"/>
- <entry c:x="5" c:y="8" c:width="30" block="blkTrack" field="title"/>
+ <entry c:x="1" c:y="5" c:width="3" block="blkTrack" field="track"/>
+ <entry c:x="5" c:y="5" c:width="30" block="blkTrack" field="title"/>
- <entry c:x="36" c:y="8" c:width="8" block="blkTrack" field="length"
+ <entry c:x="36" c:y="5" c:width="8" block="blkTrack" field="length"
inputmask="%X" displaymask="%X" />
- <entry c:x="45" c:y="8" c:width="20" block="blkTrack" field="artist"
- style="dropdown" />
-
- <entry c:x="66" c:y="8" c:width="2" block="blkTrack" field="action"
+ <entry c:x="45" c:y="5" c:width="52" block="blkTrack" field="url" />
+ <entry c:x="97" c:y="5" c:width="2" block="blkTrack" field="action"
style="checkbox" />
- <entry c:x="69" c:y="8" c:width="30" block="blkTrack" field="url" />
+ <entry c:x="1" c:y="16" c:width="43" block="blkTrackArtist"
field="artist"
+ style="dropdown" />
</page>
</layout>
@@ -289,7 +290,7 @@
art = helper.findArtist (artist, artistMap, blkOptions.unknown.get ())
blkDisc.title.set (title)
blkDisc.category.set (match ['category'])
- blkDisc.artist.set (art)
+ blkDiscArtist.artist.set (art)
blkDisc.url.set (blkDisc.call ('filedb_defaultURL', None))
<!-- Download the selected match from the remote cd database -->
@@ -317,10 +318,10 @@
if title and '/' in title:
(title, artist) = helper.splitTitle (title)
art = helper.findArtist (artist, artistMap, blkOptions.unknown.get())
- blkTrack.artist.set (art)
+ blkTrackArtist.artist.set (art)
else:
- blkTrack.artist.set (blkDisc.artist.get ())
+ blkTrackArtist.artist.set (blkDiscArtist.artist.get ())
blkTrack.title.set (title)
blkTrack.length.set (length)
@@ -455,10 +456,13 @@
category = blkDisc.category.getFKDescription ()
filename = blkTrack.url.get ()
title = blkTrack.title.get ()
- artist = blkTrack.artist.getFKDescription ()
+ artists = []
+ for i in range (dtsTrackArtist.count ()):
+ blkTrackArtist.gotoRecord (i)
+ artists.append (blkTrackArtist.artist.getFKDescription ())
tracknum = blkTrack.track.get ()
- helper.tag_oggfile (filename, album, category, title, artist, tracknum)
+ helper.tag_oggfile (filename, album, category, title, artists,
tracknum)
setStatusText ("")
</trigger>
Modified: gnue-cddb/lib/helper.py
===================================================================
--- gnue-cddb/lib/helper.py 2004-12-16 16:21:23 UTC (rev 172)
+++ gnue-cddb/lib/helper.py 2004-12-20 20:03:27 UTC (rev 173)
@@ -29,6 +29,8 @@
import wave
import os.path
import ogg.vorbis
+import types
+
from gnue.common.apps import errors
CDDB.proto = 6
@@ -332,7 +334,7 @@
# Create a tag in the ogg/vorbis file
# -----------------------------------------------------------------------------
-def tag_oggfile (filename, album, category, title, artist, tracknum):
+def tag_oggfile (filename, album, category, title, artists, tracknum):
try:
oggfile = ogg.vorbis.VorbisFile (filename)
@@ -342,7 +344,7 @@
return
c = {'ALBUM' : album,
- 'ARTIST': artist,
+ 'ARTIST': artists,
'GENRE' : category,
'TITLE' : title,
'TRACKNUMBER': "%s" % tracknum}
@@ -350,7 +352,11 @@
comment = ogg.vorbis.VorbisComment ()
for (k, v) in c.items ():
if v is not None:
- comment [k] = v
+ if isinstance (v, types.ListType):
+ for p in v:
+ comment [k] = p
+ else:
+ comment [k] = v
comment.write_to (filename)
@@ -390,3 +396,5 @@
print "Encoding bar.wav"
res = ogg_encode ('bar.wav')
print "Res =", res
+
+ res = tag_oggfile ('bar.ogg', 'album', 'teh cat', 'a title', ['foo', 'bar',
'baz'], 1)
Modified: gnue-cddb/schema/cddb.gcd
===================================================================
--- gnue-cddb/schema/cddb.gcd 2004-12-16 16:21:23 UTC (rev 172)
+++ gnue-cddb/schema/cddb.gcd 2004-12-20 20:03:27 UTC (rev 173)
@@ -35,14 +35,23 @@
<property name="lastname" type="string(30)" nullable="False" />
<property name="name" type="string(100)">
- import re
- result = re.sub ('\s+', ' ', "%s %s %s" % \
- (self.lastname or '', self.middlename or '', self.firstname or ''))
- return result.strip ()
+ from string import join
+ parts = []
+ for i in [self.lastname, self.middlename, self.firstname]:
+ if i is not None and len (i.strip ()):
+ parts.append (i.strip ())
+
+ return join (parts, ', ')
</property>
<property name="matchcode" type="string(100)">
- return self.name.upper ()
+ from string import join
+ parts = []
+ for i in [self.lastname, self.middlename, self.firstname]:
+ if i is not None and len (i.strip ()):
+ parts.append (i.strip ().upper ())
+
+ return join (parts, ' ')
</property>
</class>
@@ -96,6 +105,11 @@
<!-- ############################################################## -->
<procedure name="OnDelete">
+ artists = session.find ('cddb_discartist',
+ {'cddb_disc': self.gnue_id}, [], [])
+ for item in artists:
+ item.delete ()
+
<!-- If a disc get's deleted, make sure to remove all tracks too -->
tracks = session.find ('cddb_track', {'cddb_disc': self.gnue_id}, [], [])
for item in tracks:
@@ -103,7 +117,16 @@
</procedure>
</class>
+ <!-- ================================================================= -->
+ <!-- cddb_discartist -->
+ <!-- ================================================================= -->
+ <class name="discartist" comment="Artists of a disc">
+ <property name="disc" type="cddb_disc" nullable="False" />
+ <property name="artist" type="cddb_artist" nullable="False" />
+ </class>
+
+
<!-- ================================================================= -->
<!-- cddb_track -->
<!-- ================================================================= -->
@@ -115,10 +138,26 @@
<property name="artist" type="cddb_artist" />
<property name="length" type="time" />
<property name="comment" type="string(28)" />
+
+ <procedure name="OnDelete">
+ artists = session.find ('cddb_trackartist',
+ {'cddb_track': self.gnue_id}, [], [])
+ for item in artists:
+ item.delete ()
+ </procedure>
</class>
<!-- ================================================================= -->
+ <!-- cddb_trackartist -->
+ <!-- ================================================================= -->
+
+ <class name="trackartist" comment="Artists of a track">
+ <property name="track" type="cddb_track" nullable="False" />
+ <property name="artist" type="cddb_artist" nullable="False" />
+ </class>
+
+ <!-- ================================================================= -->
<!-- cddb_options -->
<!-- ================================================================= -->
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r173 - in gnue-cddb: . lib schema,
johannes <=