Just List Albums 2.1 - Updated 17/03/2013

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

dubmassacre
Posts: 13
Joined: Sat Apr 22, 2006 4:48 am

Post by dubmassacre » Mon Apr 28, 2008 8:20 am

Thank you for the update. Unfortunately I can't try the new option about the track comment . I get the following error:

Error #438"...
Object doesn't support this property or method: 'itm.AlbumArtistName'
...Line: 85 Column: 6

I upgraded from 1.2 version to 1.4
I have MM 2.5.5.998.

chriss

Album List

Post by chriss » Mon Apr 28, 2008 9:11 am

Hi,

I tried the mod to the album list script, to just give a list of artists and album names with no tracks, on version 1.4 but without success, can you advise if your previous instructions are still OK for 1.4?

Thanks
Chris

nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Post by nynaevelan » Mon Apr 28, 2008 9:19 am

Yes, those instructions are valid for 1.4, just finished running another report.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK
Contact:

Post by trixmoto » Mon Apr 28, 2008 2:48 pm

@dubmassacre - oops! Try replacing lines 85-86...

Code: Select all

      art = itm.AlbumArtistName
      alb = itm.AlbumName
...with...

Code: Select all

      If SDB.VersionHi > 2 Then
        art = itm.AlbumArtistName
        alb = itm.AlbumName
      Else
        art = itm.Artist.Name
        alb = itm.Name
      End If
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE

chriss
Posts: 3
Joined: Mon Apr 28, 2008 9:16 am

Script

Post by chriss » Tue Apr 29, 2008 9:34 pm

Hi,

I must be losing the plot :) , I can't get the modified script to work at all (I've got some idea as I used to program in VB but can't get this script working at all, must be time to retire!) Is there any chance that you could post a complete modified script so that I can work out where I've gone wrong?

Thanks for your help

Cheers
Chris

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK
Contact:

Post by trixmoto » Wed Apr 30, 2008 3:39 am

It's on my to do list! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE

dubmassacre
Posts: 13
Joined: Sat Apr 22, 2006 4:48 am

Post by dubmassacre » Wed Apr 30, 2008 10:26 am

trixmoto wrote:@dubmassacre - oops! Try replacing lines 85-86...

Code: Select all

      art = itm.AlbumArtistName
      alb = itm.AlbumName
...with...

Code: Select all

      If SDB.VersionHi > 2 Then
        art = itm.AlbumArtistName
        alb = itm.AlbumName
      Else
        art = itm.Artist.Name
        alb = itm.Name
      End If
Works perfect!. Thank you trixmoto! :)

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK
Contact:

Post by trixmoto » Sun May 25, 2008 4:24 pm

New version (1.5) is now available to download from my website. Changes include...

- Fixed TrackMask should be blank by default
- Fixed compatibility with MM2
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE

jedi1701a
Posts: 6
Joined: Thu Jun 05, 2008 12:23 pm

Post by jedi1701a » Thu Jun 05, 2008 12:31 pm

ok i am a noob when it comes to scripts i just added the just list albums to mm3 i would like it to add songs also for the album but it just does artiest and album name how would i fix that

thanks in advance

nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Post by nynaevelan » Thu Jun 05, 2008 12:51 pm

Change this line:

Code: Select all

Dim TrackMask : TrackMask = "" 'blank mask means no tracks are displayed
to this:

Code: Select all

Dim TrackMask : TrackMask = "<Track#>. <Title>" 'blank mask means no tracks are displayed
This text was taken from version 1.3.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files

jedi1701a
Posts: 6
Joined: Thu Jun 05, 2008 12:23 pm

Post by jedi1701a » Thu Jun 05, 2008 12:59 pm

thank you very much nynaevelan just as i found your post i found it in the scripts

but thanks for the help it was great

MTFBWY

chrisss

Re: Just List Albums 1.5 [MM2+3]

Post by chrisss » Mon Jun 23, 2008 8:20 am

Hi,

Haven't been on the forum for a month or so, just downloaded and tested Just List Albums 1.5, many thanks, this is exactly what I need, really appreciate your help.

Cheers
Chris

Eyal
Posts: 3104
Joined: Sun Jun 26, 2005 9:27 am
Location: Québec

Re: Just List Albums 1.5 [MM2+3]

Post by Eyal » Mon Jun 23, 2008 3:45 pm

Thank you Trixmoto.
I upgraded to MM 3.0 this week and this script from 1.2.
Great job, I noticed that you have implemented Compilation albums.

However, I prefer to have different tracks details for Single vs Various Artists albums.
The title don't need to be different since AlbumArtist and AlbumName are the same.

I made some changes to the script and added Average Bitrate field that can be added in the album mask. Now it's exactly what I need. Let me know what you think of it.

Here's the complete code:

Code: Select all

'
' MediaMonkey Script
'
' NAME: JustListAlbums 1.5 - Modified by Eyal on June 22, 2008.
' Nouvelle version (j'avais 1.2) compatible avec MM3 modifié le 22 juin 2008.
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 25/05/2008
'
' INSTALL: Copy to Scripts directory and add the following to Scripts.ini 
'          Don't forget to remove comments (') and set the order appropriately
'
' NOTE: Mask variable can include fields: <Artist><Album><Year><Rating><Length><Tot><Max><Discs><AvgBitrate>
'       TrackMask and CompMask variables can include:
'					 <Track#><Artist><Title><Album><Album Artist><Genre><Year><Bitrate><BPM><Composer>
'          <Custom 1><Custom 2><Custom 3><Filename><Length><Rating><Custom 4><Custom 5><Disc#><Comment>
'
' [JustListAlbums]
' FileName=JustListAlbums.vbs
' ProcName=JustListAlbums
' Order=1
' DisplayName=Just List Albums
' Description=Just List Albums
' Language=VBScript
' ScriptType=1
'
' FIXES: Fixed TrackMask should be blank by default
'        Fixed compatibility with MM2
'

Option Explicit

Dim Mask : Mask = "<Artist> - <Album> (<Year>)"+vbCrLf+"<Tot> tracks, [<Length>] ~<AvgBitrate>"+vbCrLf + String(60,"-")
Dim TrackMask : TrackMask = "<Track#>. <Title>  [<Length>]" '(*) blank mask means no tracks are displayed
Dim CompMask : CompMask = "<Track#>. <Artist> / <Title>  [<Length>]" 'mask for compilation albums
Dim FirstMask : FirstMask = "" 'mask for first track in an album
Dim Comp 'Déplacé en public par Eyal

Sub JustListAlbums 
  Dim list : Set list = SDB.CurrentSongList
  If list.Count = 0 Then
    Call SDB.MessageBox( SDB.Localize("Please select tracks to be exported."), mtError, Array(mbOk))
    Exit Sub
  End If
  If SDB.VersionHi < 3 Then
    Set list = list.Albums
  End If  
  
  Dim fso : Set fso = SDB.Tools.FileSystem
  Dim path : path = Script.ScriptPath&".txt"
  Dim fout : Set fout = fso.CreateTextFile(path,True) 
  Dim dic : Set dic = CreateObject("Scripting.Dictionary")
  Dim Progress : Set Progress = SDB.Progress 
  Progress.MaxValue = list.Count
  Progress.Text = SDB.Localize("Exporting...")

  ' Iterate through the list and export all songs
  Dim i,itm,iter,str,theyear,rating,length,tot,max,discs,sql,alb,art,itmID,avgbitrate 'avgbitrate ajouté par Eyal
  For i = 0 To list.Count-1 
    Set itm = list.Item(i) 
    If SDB.VersionHi > 2 Then
      itmID = itm.Album.ID
      If dic.Exists("#"&itmID) Then
        itmID = 0
      Else
        dic.Item("#"&itmID) = itm.AlbumName
      End If
    Else
      itmID = itm.ID
    End If
    
    If itmID > 0 Then
      'calculate field values
      If SDB.VersionHi > 2 Then
      	'Ajouté Avg(Bitrate) dans les 2 cas:
        sql = "SELECT Max(CAST(TrackNumber AS INTEGER)) AS vMax, Count(*) AS vTot, Sum(SongLength) AS vLen, " + _
        			"Avg(Year/10000) AS vYea, Avg(Rating) AS vRat, Avg(Bitrate) As vBit, " + _
        			"Max(CAST(DiscNumber AS INTEGER)) AS vDis, Count(DISTINCT CASE WHEN INSTR(Artist,';')>0 THEN " + _
        			"SUBSTR(Artist,1,INSTR(Artist,';')-1) WHEN INSTR(Artist,';')=0 THEN Artist END) AS vArt " + _
        			"FROM Songs WHERE IDAlbum="&itmID
      Else
        sql = "SELECT Max(SongOrder) AS vMax, Count(*) AS vTot, Sum(SongLength) AS vLen, Avg(Year) AS vYea, " + _
        			"Avg(Rating) AS vRat, Avg(Bitrate) As vBit FROM Songs WHERE IDAlbum="&itmID 
      End If
      Set iter = SDB.Database.OpenSQL(sql)
      theyear = getval(iter,"vYea")
      If theyear = "0" Then
        theyear = "????"
      End If
      rating = getval(iter,"vRat")/20
      length = gettime(getval(iter,"vLen")/1000)
      tot = getval(iter,"vTot")
      max = getval(iter,"vMax")
      avgbitrate = Int(iter.ValueByName("vBit") / 1000) & " Kbps"	'Ajouté par Eyal
      
      If SDB.VersionHi > 2 Then
        art = itm.AlbumArtistName
        alb = itm.AlbumName      
      Else
        art = itm.Artist.Name
        alb = itm.Name
      End If
      comp = False
      If SDB.VersionHi > 2 Then
        discs = getval(iter,"vDis")
        If discs = 0 Then
          discs = 1
        End If
        If getval(iter,"vArt") > 1 Then
          comp = True				'Album Various Artists
        End If
      Else
        max = max+1
        discs = 1
      End If
   
      'build string from mask
			Str = Mask
			
      str = Replace(str,"<Artist>",SDB.toAscii(art))
      str = Replace(str,"<Album>",SDB.toAscii(alb))
      str = Replace(str,"<Year>",theyear)
      str = Replace(str,"<Rating>",rating)
      str = Replace(str,"<Length>",length)
      str = Replace(str,"<Tot>",tot)      
      str = Replace(str,"<Max>",max)
      str = Replace(str,"<Discs>",discs)
      Str = Replace(Str,"<AvgBitrate>",avgbitrate)		'Ajouté par Eyal
      fout.WriteLine str
      
      'display album tracks
      If Not (TrackMask = "") Then
        If SDB.VersionHi > 2 Then
          str = "AND (Songs.IDAlbum="&itmID&") ORDER BY CAST(Songs.DiscNumber AS INTEGER), " + _
          			"CAST(Songs.TrackNumber AS INTEGER)"
        Else
          str = "AND (Songs.IDAlbum="&itmID&") ORDER BY Songs.SongOrder"
        End If
        Dim j : j = 0
        Set iter = SDB.Database.QuerySongs(str)
        Do While Not iter.EOF
          j = j + 1
          Call fout.WriteLine(gettrack(iter.Item,j))
          iter.Next
          If Progress.Terminate Then 
            Exit Do
          End If
        Loop 
        Call fout.WriteLine("")
      End If
    End If
    
    Progress.Increase
    SDB.ProcessMessages
    If Progress.Terminate Then 
      Exit For 
    End If 
  Next 

  fout.Close 
  If Not Progress.Terminate Then 
    Dim WShell : Set WShell = CreateObject("WScript.Shell")
    i = WShell.Run(Chr(34)&path&Chr(34),1,0)
  End If 
End Sub 

Function gettime(sec)
  Dim min : min = 0
  sec = Int(sec)
  Do While sec > 59 
    sec = sec - 60
    min = min + 1
  Loop
  If sec < 10 Then
    gettime = min&":0"&sec
  Else
    gettime = min&":"&sec
  End If
End Function

Function getval(iter,nam)
  Dim s : s = iter.StringByName(nam)
  If IsNumeric(s) Then
    getval = s*1
  Else
    getval = 0
  End If
End Function

Function gettrack(itm,i)
  Dim temp,track,title,artist,album,albumartist,genre,theyear
  Dim bitrate,bpm,composer,cust1,cust2,cust3,cust4,cust5,path,length,rating,disc,comment
  
  track = CStr(itm.TrackOrder)
  title = SDB.toAscii(itm.Title)
  artist = SDB.toAscii(itm.ArtistName)
  album = SDB.toAscii(itm.AlbumName)
  albumartist = SDB.toAscii(itm.AlbumArtistName)
  genre = SDB.toAscii(itm.Genre)
  theyear = itm.Year
  bitrate = Int(itm.Bitrate/1000) &" Kbps"
  bpm = itm.BPM
  composer = SDB.toAscii(itm.Author)
  cust1 = SDB.toAscii(itm.Custom1)
  cust2 = SDB.toAscii(itm.Custom2)
  cust3 = SDB.toAscii(itm.Custom3) 
	path = SDB.toAscii(itm.Path)
  length = gettime(itm.SongLength/1000)
  temp = itm.Rating
  If temp < 0 Then 
    rating = "?"
  Else
    temp = temp / 20
    If temp = Int(temp) Then
      rating = temp
    Else
      rating = FormatNumber(temp,1)
    End If
  End If  
  If SDB.VersionHi > 2 Then
    theyear = Left(itm.Year,4)
    disc = itm.DiscNumberStr
    track = itm.TrackOrderStr
    cust4 = SDB.toAscii(itm.Custom4)
    cust5 = SDB.toAscii(itm.Custom5)
  Else
    disc = "1"
  End If
  Do While Len(track)<2
    track = "0"&track
  Loop  
  If theyear = "0" Then
    theyear = "????"
  End If
  comment = itm.Comment
  
  If (i = 1) And Not (FirstMask = "") Then
    gettrack = FirstMask
  Else
  	If Comp Then
  		gettrack= CompMask
  	Else
    	gettrack = TrackMask
    End If
  End If
  gettrack = Replace(gettrack,"<Track#>",track)
  gettrack = Replace(gettrack,"<Artist>",artist)
  gettrack = Replace(gettrack,"<Title>",title)
  gettrack = Replace(gettrack,"<Album>",album)
  gettrack = Replace(gettrack,"<Album Artist>",albumartist)
  gettrack = Replace(gettrack,"<Genre>",genre)
  gettrack = Replace(gettrack,"<Year>",theyear)
  gettrack = Replace(gettrack,"<Bitrate>",bitrate)
  gettrack = Replace(gettrack,"<BPM>",bpm)
  gettrack = Replace(gettrack,"<Composer>",composer)
  gettrack = Replace(gettrack,"<Custom 1>",cust1)
  gettrack = Replace(gettrack,"<Custom 2>",cust2)
  gettrack = Replace(gettrack,"<Custom 3>",cust3)  
  gettrack = Replace(gettrack,"<Filename>",path)
  gettrack = Replace(gettrack,"<Length>",length)
  gettrack = Replace(gettrack,"<Rating>",rating)  
  If SDB.VersionHi > 2 Then
    gettrack = Replace(gettrack,"<Custom 4>",cust4)
    gettrack = Replace(gettrack,"<Custom 5>",cust5)    
    gettrack = Replace(gettrack,"<Disc#>",disc)    
  End If   
  gettrack = Replace(gettrack,"<Comment>",comment)
End Function

Sub Install()
  Dim inip : inip = SDB.ApplicationPath&"Scripts\Scripts.ini"
  Dim inif : Set inif = SDB.Tools.IniFileByPath(inip)
  If Not (inif Is Nothing) Then
    inif.StringValue("JustListAlbums","Filename") = "JustListAlbums.vbs"
    inif.StringValue("JustListAlbums","Procname") = "JustListAlbums"
    inif.StringValue("JustListAlbums","Order") = "1"
    inif.StringValue("JustListAlbums","DisplayName") = "Just List Albums"
    inif.StringValue("JustListAlbums","Description") = "Just List Albums"
    inif.StringValue("JustListAlbums","Language") = "VBScript"
    inif.StringValue("JustListAlbums","ScriptType") = "1"
    SDB.RefreshScriptItems
  End If
End Sub

Skins for MediaMonkey: Cafe, Carbon, Helium, Spotify, Zekton. [ Wiki Zone ].

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK
Contact:

Re: Just List Albums 1.5 [MM2+3]

Post by trixmoto » Tue Jun 24, 2008 7:13 am

I'm glad you like the update - I'll make sure my next version includes your average bitrate code as well so you don't have to modify it again! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE

Eyal
Posts: 3104
Joined: Sun Jun 26, 2005 9:27 am
Location: Québec

Re: Just List Albums 1.5 [MM2+3]

Post by Eyal » Tue Jun 24, 2008 10:53 am

Great!
Thanx again Trix
Skins for MediaMonkey: Cafe, Carbon, Helium, Spotify, Zekton. [ Wiki Zone ].

Post Reply