Page 1 of 2
Feature request: Artist & Title Index
Posted: Thu Dec 31, 2009 7:26 pm
by cgeorgakopoulos
Hi, can you add an artist index option like twonky media server? The full artist list is not convenient with a large db.
Eg:
Artist Index ->
A B C D E F ...... ->
Celine Dion - Coolio - Cyborg .... ->
Gangsters Paradise - ...
Re: Feature request: Artist & Title Index
Posted: Fri Jan 01, 2010 12:16 pm
by Eugene
cgeorgakopoulos wrote:Hi, can you add an artist index option like twonky media server? The full artist list is not convenient with a large db.
Eg:
Artist Index ->
A B C D E F ...... ->
Celine Dion - Coolio - Cyborg .... ->
Gangsters Paradise - ...
May be in future versions.
Now you can create Artist Index folder Playlists:
1. Settings - Processing - Add
2. Name: Artist Index
3. Language: PascalScript
4. Expression
Code: Select all
function GetProperty(aItem: TWmsScriptMediaItem; aPropertyID: Integer): string;
begin
Result := VarToStr(aItem.Properties[aPropertyID]);
if Result = '' then
Result := 'Unknown'
end;
procedure ProcessItem(aItem: TWmsScriptMediaItem);
var
i: Integer;
sCollectionPath, sDirectory: string;
begin
sCollectionPath := 'Artist Index\' + Copy(GetProperty(aItem, mpiAuthor), 1, 1) + '\' +
GetProperty(aItem, mpiAuthor) + '\' + GetProperty(aItem, mpiAlbum);
WmsDatabaseAddLink(mfAudioPlaylistsItemID, sCollectionPath, aItem);
end;
var
i: Integer;
MediaItemList: TWmsScriptMediaItemList;
begin
MediaItemList := WmsCurrentMediaListItems;
try
if MediaItemList.Count > 0 then begin
WmsShowProgress('Create Artist Index...');
try
for i := 0 to MediaItemList.Count - 1 do begin
if WmsCancelPressed then
Break
else begin
ProcessItem(MediaItemList[i]);
WmsSetProgress(Round(((i + 1) / MediaItemList.Count) * 100))
end
end
finally
WmsHideProgress
end;
if WmsCancelPressed then
MessageDlg('Create Artist Index interrupted by the user.', mtError, mbOK, 0)
else
MessageDlg('Create Artist Index was successful.', mtInformation, mbOK, 0)
end else
MessageDlg('No files to process.', mtError, mbOK, 0)
finally
MediaItemList.Free
end;
WmsDatabaseAutoSave;
ProcessMediaResult := True
end.
5. Check "Button on the main form"
6. OK-OK-OK
7. Activate folder "All music"
8. Press button "Artist Index"
9. In folder "Playlists" must create Artist Index.
Re: Feature request: Artist & Title Index
Posted: Fri Jan 01, 2010 12:51 pm
by cgeorgakopoulos
I love you!
I need to modified a little bit, I'll post when I'm done.
Happy new year!
Re: Feature request: Artist & Title Index
Posted: Fri Jan 01, 2010 1:33 pm
by cgeorgakopoulos
I made a song index too (in basicScript, I'm a VB guy):
Code: Select all
Function GetProperty(Item As TWmsScriptMediaItem, PropertyID As Integer) As String
Dim PropertyValue As String = VarToStr(Item.Properties(PropertyID))
If PropertyValue = "" Then
PropertyValue = "Unknown"
End If
Return PropertyValue
End function
Sub ProcessItem(Item as TWmsScriptMediaItem)
Dim SongName As String = GetProperty(Item, mpiTitle)
Dim CollectionPath as String = "Song Index\" & Copy(SongName, 1, 1)
WmsDatabaseAddLink(mfAudioPlaylistsItemID, CollectionPath, Item)
End Sub
Dim MediaItemList as TWmsScriptMediaItemList = WmsCurrentMediaListItems
Dim ItemIndex As Integer
try
For ItemIndex = 0 To MediaItemList.Count - 1
ProcessItem(MediaItemList[ItemIndex])
Next
finally
MediaItemList.Free
End Try
WmsDatabaseAutoSave
ProcessMediaResult = True
Re: Feature request: Artist & Title Index
Posted: Fri Jan 01, 2010 1:41 pm
by Eugene
Perfectly, successes, good luck in New year

Re: Feature request: Artist & Title Index
Posted: Wed Jan 06, 2010 10:40 am
by LouisXIV
Tried these scripts ....
Artist Index created a playlist with index, but I got several errors (see attachment) so I think I have to check my MP3 tags, do a rescan of the Media files and try again
Song Index does nothing here .... no new playlist created
Since I am no programmer I just executed what I copied here, no idea where to look for errors

Re: Feature request: Artist & Title Index
Posted: Wed Jan 06, 2010 10:48 am
by LouisXIV
Oops ... too quick
Song Index DID do something, I now have a new playlist, but ..... not what I thought it would do. It created a songlist based on the filename I think, see for yourself in the attachment.
How can I correct this script?
Re: Feature request: Artist & Title Index
Posted: Wed Jan 06, 2010 11:10 am
by Eugene
LouisXIV wrote:Oops ... too quick
Song Index DID do something, I now have a new playlist, but ..... not what I thought it would do. It created a songlist based on the filename I think, see for yourself in the attachment.
How can I correct this script?
There is a problem reading UNICODE-tags when scanning media resources, will be fixed in next version.
In what direction do you want to change the scripts?
Re: Feature request: Artist & Title Index
Posted: Wed Jan 06, 2010 11:20 am
by LouisXIV
The UNICODE problem will be the problem with the "Artist index" script I guess, so there is indeed nothing for me to do than check my tags and wait for the next release.
The "Song index" script however seems to index my songs based on the filename (Eagles - Desperado - 01 - Doolin-Dalton.mp3 -> shows up under the E) instead of the trackname, in this case Doolin-Dalton should show up under the D
Re: Feature request: Artist & Title Index
Posted: Wed Jan 06, 2010 2:38 pm
by Eugene
LouisXIV wrote:The UNICODE problem will be the problem with the "Artist index" script I guess, so there is indeed nothing for me to do than check my tags and wait for the next release.
The "Song index" script however seems to index my songs based on the filename (Eagles - Desperado - 01 - Doolin-Dalton.mp3 -> shows up under the E) instead of the trackname, in this case Doolin-Dalton should show up under the D
Try changing ProcessItem
Code: Select all
Sub ProcessItem(Item as TWmsScriptMediaItem)
Dim SongName As String = GetProperty(Item, mpiTitle)
Dim DelimPos = EndPos(SongName, " - ")
If DelimPos > 0 Then
SongName = Copy(SongName, DelimPos + 3, 2000)
End If
Dim CollectionPath as String = "Song Index\" & Copy(SongName, 1, 1)
WmsDatabaseAddLink(mfAudioPlaylistsItemID, CollectionPath, Item)
End Sub