Feature request: Artist & Title Index

cgeorgakopoulos
Posts: 4
Joined: Sun Dec 13, 2009 5:46 pm

Feature request: Artist & Title Index

Post 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 - ...
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Feature request: Artist & Title Index

Post 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.
cgeorgakopoulos
Posts: 4
Joined: Sun Dec 13, 2009 5:46 pm

Re: Feature request: Artist & Title Index

Post by cgeorgakopoulos »

I love you!

I need to modified a little bit, I'll post when I'm done.

Happy new year!
cgeorgakopoulos
Posts: 4
Joined: Sun Dec 13, 2009 5:46 pm

Re: Feature request: Artist & Title Index

Post 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
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Feature request: Artist & Title Index

Post by Eugene »

Perfectly, successes, good luck in New year :)
LouisXIV
Posts: 37
Joined: Tue Jan 05, 2010 7:27 am
Location: the Netherlands

Re: Feature request: Artist & Title Index

Post 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 8-)
Attachments
wms.JPG
wms.JPG (124.96 KiB) Viewed 10130 times
LouisXIV
Posts: 37
Joined: Tue Jan 05, 2010 7:27 am
Location: the Netherlands

Re: Feature request: Artist & Title Index

Post by LouisXIV »

Oops ... too quick :oops:

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?
Attachments
wms2.JPG
wms2.JPG (245.35 KiB) Viewed 10128 times
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Feature request: Artist & Title Index

Post by Eugene »

LouisXIV wrote:Oops ... too quick :oops:

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?
LouisXIV
Posts: 37
Joined: Tue Jan 05, 2010 7:27 am
Location: the Netherlands

Re: Feature request: Artist & Title Index

Post 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
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Feature request: Artist & Title Index

Post 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
Post Reply