Just List Albums 2.1 - Updated 17/03/2013

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

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

Just List Albums 2.1 - Updated 17/03/2013

Post by trixmoto »

Ok, I've basically stripped out a load of code from another script to make this nice simple one. You can download an installer from my website, or here is the code...

Code: Select all

'
' MediaMonkey Script
'
' NAME: JustListAlbums 2.1
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 17/03/2013
'
' 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 and CompMask variables can include fields... <Artist><Album><Year><Rating><Length><Tot><Max><Discs><Bitrate>
'         <Line><Genre><Comment><Day><Month><FullDate><Rating1><Rating2><Rating3>
'
'       TrackMask variable can include: <Track#><Artist><Title><Album><Album Artist><Genre><Year><Bitrate><BPM><Composer>
'         <Custom 1><Custom 2><Custom 3><Path><Length><Rating><Custom 4><Custom 5><Disc#><Comment><Line><Playcount>
'         <ISRC><Tempo><Mood><Occasion><Quality><Publisher><OrigArtist><OrigLyricist><OrigTitle><OrigYear><DiscStr><TrackStr>
'         <Grouping><VBR><StartTime><StopTime><SkipCount><TrackType><Series><Director><Producer><Actors><ParentalRating>
'         <EpisodeNumber><SeasonNumber><Filename><Folder><Extension><Day><Month><FullDate><Rating1><Rating2><Rating3>
'
' [JustListAlbums]
' FileName=JustListAlbums.vbs
' ProcName=JustListAlbums
' Order=1
' DisplayName=Just List Albums
' Description=Just List Albums
' Language=VBScript
' ScriptType=1
'
' FIXES: Fixed problems with year in FullDate mask field
'

Option Explicit

Dim Mask : Mask = "<Artist> - <Album> (<Tot>/<Max>)" 'mask for artist albums
Dim TrackMask : TrackMask = "" 'blank mask means no tracks are displayed
Dim CompMask : CompMask = "" 'mask for compilation albums
Dim FirstMask : FirstMask = "" 'mask for first track in an album
Dim LastMask : LastMask = "" 'mask for last track in an album
Dim UTF8 : UTF8 = True 'set to False to revert to original ASCII mode
Dim Delimiter : Delimiter = ", " 'delimiter used to separate values (eg. for genres)

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
  
  Dim ini : Set ini = SDB.IniFile
  If ini.ValueExists("JustListAlbums","AlbumMask") Then
    Mask = ini.StringValue("JustListAlbums","AlbumMask")
  End If
  If ini.ValueExists("JustListAlbums","TrackMask") Then
    TrackMask = ini.StringValue("JustListAlbums","TrackMask")
  End If
  If ini.ValueExists("JustListAlbums","CompMask") Then
    CompMask = ini.StringValue("JustListAlbums","CompMask")
  End If
  If ini.ValueExists("JustListAlbums","FirstMask") Then
    FirstMask = ini.StringValue("JustListAlbums","FirstMask")
  End If 
  If ini.ValueExists("JustListAlbums","LastMask") Then
    LastMask = ini.StringValue("JustListAlbums","LastMask")
  End If   
  If ini.ValueExists("JustListAlbums","UTF8") Then
    UTF8 = ini.BoolValue("JustListAlbums","UTF8")
  End If
  If ini.ValueExists("JustListAlbums","Delimiter") Then
    Delimiter = ini.StringValue("JustListAlbums","Delimiter")
  End If

  Dim ui : Set ui = SDB.UI
  Dim Form : Set Form = ui.NewForm 
  Form.Common.SetRect 100, 100, 600, 200
  Form.BorderStyle  = 4   ' Resizable 
  Form.FormPosition = 4   ' Screen Center 
  Form.SavePositionName = "Just List Albums" 
  Form.Caption = "Just List Albums"
      
  Dim Label1 : Set Label1 = ui.NewLabel(Form) 
  Label1.Caption = "Album mask:" 
  Label1.Common.Left = 5 
  Label1.Common.Top = 10
     
  Dim Edt1 : Set Edt1 = ui.NewEdit(Form) 
  Edt1.Common.Left = Label1.Common.Left + 100
  Edt1.Common.Top = Label1.Common.Top - 3 
  Edt1.Common.Width = Form.Common.Width - Edt1.Common.Left - 15
  Edt1.Common.ControlName = "Edit1" 
  Edt1.Common.Anchors = 1+2+4 'Left+Top+Right
  Edt1.Common.Hint = "Mask for artist albums"
  Edt1.Text = Mask
  
  Dim Label2 : Set Label2 = ui.NewLabel(Form) 
  Label2.Caption = "Compilation mask:" 
  Label2.Common.Left = 5 
  Label2.Common.Top = 35
     
  Dim Edt2 : Set Edt2 = ui.NewEdit(Form) 
  Edt2.Common.Left = Label2.Common.Left + 100
  Edt2.Common.Top = Label2.Common.Top - 3
  Edt2.Common.Width = Form.Common.Width - Edt2.Common.Left - 15 
  Edt2.Common.ControlName = "Edit2" 
  Edt2.Common.Anchors = 1+2+4 'Left+Top+Right
  Edt2.Common.Hint = "Mask for compilation albums with various artists - leave blank to use album mask"
  Edt2.Text = CompMask  

  Dim Label3 : Set Label3 = ui.NewLabel(Form) 
  Label3.Caption = "Track mask:" 
  Label3.Common.Left = 5 
  Label3.Common.Top = 60
     
  Dim Edt3 : Set Edt3 = ui.NewEdit(Form) 
  Edt3.Common.Left = Label3.Common.Left + 100
  Edt3.Common.Top = Label3.Common.Top - 3
  Edt3.Common.Width = Form.Common.Width - Edt3.Common.Left - 15
  Edt3.Common.ControlName = "Edit3" 
  Edt3.Common.Anchors = 1+2+4 'Left+Top+Right
  Edt3.Common.Hint = "Mask for tracks - leave blank to only output albums"
  Edt3.Text = TrackMask 
  
  Dim Label4 : Set Label4 = ui.NewLabel(Form) 
  Label4.Caption = "First track mask:" 
  Label4.Common.Left = 5 
  Label4.Common.Top = 85
     
  Dim Edt4 : Set Edt4 = ui.NewEdit(Form) 
  Edt4.Common.Left = Label4.Common.Left + 100 
  Edt4.Common.Top = Label4.Common.Top - 3 
  Edt4.Common.Width = Form.Common.Width - Edt4.Common.Left - 15
  Edt4.Common.ControlName = "Edit4" 
  Edt4.Common.Anchors = 1+2+4 'Left+Top+Right
  Edt4.Common.Hint = "Mask for first album track - leave blank to use track mask"
  Edt4.Text = FirstMask  
  
  Dim Label7 : Set Label7 = ui.NewLabel(Form) 
  Label7.Caption = "Last track mask:" 
  Label7.Common.Left = 5 
  Label7.Common.Top = 110
     
  Dim Edt7 : Set Edt7 = ui.NewEdit(Form) 
  Edt7.Common.Left = Label7.Common.Left + 100 
  Edt7.Common.Top = Label7.Common.Top - 3 
  Edt7.Common.Width = Form.Common.Width - Edt7.Common.Left - 15
  Edt7.Common.ControlName = "Edit7" 
  Edt7.Common.Anchors = 1+2+4 'Left+Top+Right
  Edt7.Common.Hint = "Mask for last album track - leave blank to use track mask"
  Edt7.Text = LastMask
  
  Dim Label5 : Set Label5 = ui.NewLabel(Form) 
  Label5.Caption = "Delimiter:" 
  Label5.Common.Left = 5 
  Label5.Common.Top = 135
     
  Dim Edt5 : Set Edt5 = ui.NewEdit(Form) 
  Edt5.Common.Left = Label5.Common.Left + 100
  Edt5.Common.Top = Label5.Common.Top - 3
  Edt5.Common.Width = 100
  Edt5.Common.ControlName = "Edit5" 
  Edt5.Common.Anchors = 1+2+4 'Left+Top+Right
  Edt5.Common.Hint = "Used to separate values (eg. Genres)"
  Edt5.Text = Delimiter
  
  Dim Edt6 : Set Edt6 = ui.NewCheckbox(Form) 
  Edt6.Common.Left = 250
  Edt6.Common.Top = Label5.Common.Top
  Edt6.Common.Width = 200
  Edt6.Common.ControlName = "Edit6" 
  Edt6.Common.Anchors = 1+2+4 'Left+Top+Right
  Edt6.Caption = "Support unicode?"
  Edt6.Checked = UTF8   
  
  Dim BtnOk : Set BtnOk = ui.NewButton(Form) 
  BtnOk.Caption = "OK"
  BtnOk.Common.Top = Edt7.Common.Top + Edt7.Common.Height + 10 
  BtnOk.Common.Hint = "OK"
  BtnOk.Common.Anchors = 4   ' Right 
  BtnOk.UseScript = Script.ScriptPath 
  BtnOk.Default = True
  BtnOk.ModalResult = 1 
    
  Dim BtnCancel : Set BtnCancel = ui.NewButton(Form) 
  BtnCancel.Caption = "Cancel"
  BtnCancel.Common.Left = Form.Common.Width - BtnCancel.Common.Width - 15 
  BtnOK.Common.Left = BtnCancel.Common.Left - BtnOK.Common.Width - 10 
  BtnCancel.Common.Top = BtnOK.Common.Top 
  BtnCancel.Common.Hint = "Cancel"
  BtnCancel.Common.Anchors = 4   ' Right 
  BtnCancel.UseScript = Script.ScriptPath 
  BtnCancel.Cancel = True
  BtnCancel.ModalResult = 2 
       
  If Form.showModal <> 1 Then
    Exit Sub
  End If    
  
  Mask = Edt1.Text
  ini.StringValue("JustListAlbums","AlbumMask") = Mask
  CompMask = Edt2.Text
  ini.StringValue("JustListAlbums","CompMask") = CompMask
  TrackMask = Edt3.Text
  ini.StringValue("JustListAlbums","TrackMask") = TrackMask
  FirstMask = Edt4.Text
  ini.StringValue("JustListAlbums","FirstMask") = FirstMask
  LastMask = Edt7.Text
  ini.StringValue("JustListAlbums","LastMask") = LastMask  
  Delimiter = Edt5.Text
  ini.StringValue("JustListAlbums","Delimiter") = Delimiter  
  UTF8 = Edt6.Checked
  ini.BoolValue("JustListAlbums","UTF8") = UTF8
  
  Dim fso : Set fso = SDB.Tools.FileSystem
  Dim path : path = Script.ScriptPath&".txt"
  Dim dic : Set dic = CreateObject("Scripting.Dictionary")
  Dim Progress : Set Progress = SDB.Progress 
  Progress.MaxValue = list.Count
  Progress.Text = SDB.Localize("Exporting...")
  
  If UTF8 Then
    Dim ado : Set ado = CreateObject("Adodb.Stream")
    ado.CharSet = "UTF-8"
    ado.Type = 2
    Call ado.Open()
  Else
    Dim fout : Set fout = fso.CreateTextFile(path,True)
  End If

  Dim i,itm,iter,str,theyear,rating,length,tot,max,discs,sql,alb,art,comp,itmID,bitrate
  Dim rating1,rating2,rating3,thedate,themonth,theday
  For i = 0 To list.Count-1 
    Set itm = list.Item(i) 
    itmID = itm.Album.ID 
    If dic.Exists("#"&itmID) Then
      itmID = 0
    Else
      dic.Item("#"&itmID) = itm.AlbumName
    End If
    
    If itmID > 0 Then
      'calculate field values
      sql = "SELECT Max(CAST(TrackNumber AS INTEGER)) AS vMax, Count(*) AS vTot, Sum(SongLength) AS vLen, Avg(Year) AS vYea, Avg(Rating) AS vRat, 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, Avg(Bitrate) AS vBit FROM Songs WHERE IDAlbum="&itmID
      Set iter = SDB.Database.OpenSQL(sql)
      Dim temp : temp = getval(iter,"vYea")
      thedate = "????"
      theyear = "????"
      themonth = "??"
      theday = "??"
      If temp > 0 Then
        theyear = Left(CStr(temp),4)
        If Int(Right(temp,4)) > 0 Then
          themonth = Mid(CStr(temp),5,2)
          If Int(Right(temp,2)) > 0 Then
            theday = Mid(CStr(temp),7,2)
            thedate = theday&"/"&themonth&"/"&theyear
          Else
            thedate = themonth&"/"&theyear
          End If
        Else
          thedate = theyear
        End If
      End If
      temp = getval(iter,"vRat")
      If temp < 0 Then 
        rating = "?"
        rating1 = "?"
        rating2 = "?"
        rating3 = "?"
      Else
        temp = temp / 20
        If temp = Int(temp) Then
          rating = temp
        Else
          rating = FormatNumber(temp,1)
        End If
        rating1 = FormatNumber(temp,1)
        rating2 = FormatNumber(temp,2)
        rating3 = FormatNumber(temp,3)
      End If
      length = gettime(getval(iter,"vLen")/1000)
      tot = getval(iter,"vTot")
      max = getval(iter,"vMax")
      art = itm.AlbumArtistName
      alb = itm.AlbumName      
      comp = False
      discs = getval(iter,"vDis")
      If discs = 0 Then
        discs = 1
      End If
      If getval(iter,"vArt") > 1 Then
        comp = True
      End If
      bitrate = getval(iter,"vBit")/1000
   
      'build string from mask
      If comp Then
        If CompMask = "" Then
          str = Mask
        Else
          str = CompMask
        End If
      Else
        str = Mask
      End If
      If UTF8 Then
        str = Replace(str,"<Artist>",art)
        str = Replace(str,"<Album>",alb)
      Else
        str = Replace(str,"<Artist>",SDB.toAscii(art))
        str = Replace(str,"<Album>",SDB.toAscii(alb))
      End If
      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,"<Bitrate>",bitrate)
      str = Replace(str,"<Line>",VbCrLf)
      If InStr(str,"<Genre>") > 0 Then
        Dim genre : genre = ""
        sql = "SELECT DISTINCT Genres.GenreName FROM Genres,Songs,GenresSongs WHERE GenresSongs.IDSong=Songs.ID AND GenresSongs.IDGenre=Genres.IDGenre AND Songs.IDAlbum="&itmID&" ORDER BY Genres.GenreName"            
        Set iter = SDB.Database.OpenSQL(sql)
        If Not iter.EOF Then
          genre = iter.StringByName("GenreName")
          iter.Next
          While Not iter.EOF
            genre = genre&Delimiter&iter.StringByName("GenreName")
            iter.Next
          WEnd
        End If
        str = Replace(str,"<Genre>",genre)
      End If
      If InStr(str,"<Comment>") > 0 Then
        Dim comment : comment = ""
        sql = "SELECT Comment FROM Albums WHERE ID="&itmID
        Set iter = SDB.Database.OpenSQL(sql)
        If Not iter.EOF Then
          comment = iter.StringByIndex(0)
        End If     
        str = Replace(str,"<Comment>",comment)
      End If
      str = Replace(str,"<Day>",theday) 
      str = Replace(str,"<Month>",themonth) 
      str = Replace(str,"<FullDate>",thedate) 
      str = Replace(str,"<Rating1>",rating1) 
      str = Replace(str,"<Rating2>",rating2) 
      str = Replace(str,"<Rating3>",rating3) 
  
      If UTF8 Then
        Call ado.WriteText(str,1)
      Else
        Call fout.WriteLine(str)
      End If
      
      'display album tracks
      If Not (TrackMask = "") Then
        str = "AND (Songs.IDAlbum="&itmID&") ORDER BY CAST(Songs.DiscNumber AS INTEGER), CAST(Songs.TrackNumber AS INTEGER)"
        Dim j : j = 0
        Dim l : l = False
        Set iter = SDB.Database.QuerySongs(str)
        Do While Not iter.EOF
          j = j + 1
          Dim sng : Set sng = iter.Item
          iter.Next
          If iter.EOF Then
            l = True
          Else
            l = False
          End If
          str = gettrack(sng,j,l)
          If UTF8 Then
            Call ado.WriteText(str,1)
          Else
            Call fout.WriteLine(str)
          End If
          If Progress.Terminate Then 
            Exit Do
          End If
        Loop 
        If UTF8 Then
          Call ado.WriteText("",1)
        Else
          Call fout.WriteLine("")
        End If        
      End If
    End If
    
    Progress.Increase
    SDB.ProcessMessages
    If Progress.Terminate Then 
      Exit For 
    End If 
  Next 

  If UTF8 Then
    Call ado.SaveToFile(path,2)
    Call ado.Close()
  Else
    Call fout.Close()
  End If
  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,lst)
  Dim temp,track,title,artist,album,albumartist,genre,theyear
  Dim bitrate,bpm,composer,cust1,cust2,cust3,cust4,cust5,path
  Dim length,rating,disc,comment,plays,isrc,tempo,mood,occasion
  Dim quality,publisher,origart,origlyr,origttl,origyear
  Dim discstr,trackstr,playlists,grouping,vbr,starttime,stoptime
  Dim skipcount,tracktype,series,director,producer,actors
  Dim parental,episode,season,filename,folder,extension
  Dim theday,themonth,fulldate,rating1,rating2,rating3
  
  track = CStr(itm.TrackOrder)
  If UTF8 Then
    title = itm.Title
    artist = itm.ArtistName
    album = itm.AlbumName
    albumartist = itm.AlbumArtistName
    genre = itm.Genre
    composer = itm.Author
    cust1 = itm.Custom1
    cust2 = itm.Custom2
    cust3 = itm.Custom3 
    cust4 = itm.Custom4
    cust5 = itm.Custom5    
    path = itm.Path
    isrc = itm.ISRC
    tempo = itm.Tempo
    mood = itm.Mood
    occasion = itm.Occasion
    quality = itm.Quality
    publisher = itm.Publisher
    origart = itm.OriginalArtist
    origlyr = itm.OriginalLyricist
    origttl = itm.OriginalTitle
    origyear = itm.OriginalYear
    discstr = itm.DiscNumberStr
    trackstr = itm.TrackOrderStr
    grouping = itm.Grouping
    series = itm.Series
    director = itm.Director
    producer = itm.Producer
    actors = itm.Actors
    parental = itm.ParentalRating
    episode = itm.EpisodeNumber
    season = itm.SeasonNumber
  Else
    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)
    composer = SDB.toAscii(itm.Author)
    cust1 = SDB.toAscii(itm.Custom1)
    cust2 = SDB.toAscii(itm.Custom2)
    cust3 = SDB.toAscii(itm.Custom3) 
    cust4 = SDB.toAscii(itm.Custom4)
    cust5 = SDB.toAscii(itm.Custom5)    
    path = SDB.toAscii(itm.Path)
    isrc = SDB.toAscii(itm.ISRC)
    tempo = SDB.toAscii(itm.Tempo)
    mood = SDB.toAscii(itm.Mood)
    occasion = SDB.toAscii(itm.Occasion)
    quality = SDB.toAscii(itm.Quality)
    publisher = SDB.toAscii(itm.Publisher)
    origart = SDB.toAscii(itm.OriginalArtist)
    origlyr = SDB.toAscii(itm.OriginalLyricist)
    origttl = SDB.toAscii(itm.OriginalTitle)
    origyear = SDB.toAscii(itm.OriginalYear)
    discstr = SDB.toAscii(itm.DiscNumberStr)
    trackstr = SDB.toAscii(itm.TrackOrderStr)
    grouping = SDB.toAscii(itm.Grouping)
    series = SDB.toAscii(itm.Series)
    director = SDB.toAscii(itm.Director)
    producer = SDB.toAscii(itm.Producer)
    actors = SDB.toAscii(itm.Actors)
    parental = SDB.toAscii(itm.ParentalRating)
    episode = SDB.toAscii(itm.EpisodeNumber)
    season = SDB.toAscii(itm.SeasonNumber)    
  End If  
  bitrate = Int(itm.Bitrate/1000)&"kbps"
  bpm = itm.BPM
  length = gettime(itm.SongLength/1000)
  temp = itm.Rating
  If temp < 0 Then 
    rating = "?"
    rating1 = "?"
    rating2 = "?"
    rating3 = "?"    
  Else
    temp = temp / 20
    If temp = Int(temp) Then
      rating = temp
    Else
      rating = FormatNumber(temp,1)
    End If
    rating1 = FormatNumber(temp,1)
    rating2 = FormatNumber(temp,2)
    rating3 = FormatNumber(temp,3)    
  End If  
  theyear = Left(itm.Year,4)
  If theyear = "0" Then
    theyear = "????"
  End If  
  disc = itm.DiscNumberStr
  track = itm.TrackOrderStr
  Do While Len(track)<2
    track = "0"&track
  Loop  
  comment = itm.Comment
  plays = itm.PlayCounter
  If itm.VBR Then
    vbr = "VBR"  
  Else
    vbr = "CBR"
  End If
  starttime = gettime(itm.StartTime)
  stoptime = gettime(itm.StopTime)
  skipcount = itm.SkipCount
  tracktype = itm.TrackType
  theday = itm.Day
  If theday = "0" Then
    theday = "??"
  ElseIf Len(theday) = 1 Then
    theday = "0"&theday
  End If
  themonth = itm.Month
  If themonth = "0" Then
    themonth = "??"
  ElseIf Len(themonth) = 1 Then
    themonth = "0"&themonth
  End If  
  fulldate = theday&"/"&themonth&"/"&theyear
  
  If (i = 1) And Not (FirstMask = "") Then
    gettrack = FirstMask
  ElseIf (lst) And Not (LastMask = "") Then
    gettrack = LastMask
  Else
    gettrack = TrackMask
  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,"<Path>",path)
  gettrack = Replace(gettrack,"<Length>",length)
  gettrack = Replace(gettrack,"<Rating>",rating)  
  gettrack = Replace(gettrack,"<Custom 4>",cust4)
  gettrack = Replace(gettrack,"<Custom 5>",cust5)    
  gettrack = Replace(gettrack,"<Disc#>",disc)       
  gettrack = Replace(gettrack,"<Comment>",comment)
  gettrack = Replace(gettrack,"<Playcount>",plays)
  gettrack = Replace(gettrack,"<Line>",VbCrLf)
  gettrack = Replace(gettrack,"<ISRC>",isrc)
  gettrack = Replace(gettrack,"<Tempo>",tempo)
  gettrack = Replace(gettrack,"<Mood>",mood)
  gettrack = Replace(gettrack,"<Occasion>",occasion)
  gettrack = Replace(gettrack,"<Quality>",quality)
  gettrack = Replace(gettrack,"<Publisher>",publisher)
  gettrack = Replace(gettrack,"<OrigArtist>",origart)
  gettrack = Replace(gettrack,"<OrigLyricist>",origlyr)
  gettrack = Replace(gettrack,"<OrigTitle>",origttl)
  gettrack = Replace(gettrack,"<OrigYear>",origyear)
  gettrack = Replace(gettrack,"<DiscStr>",discstr)
  gettrack = Replace(gettrack,"<TrackStr>",trackstr)
  gettrack = Replace(gettrack,"<Grouping>",grouping)
  gettrack = Replace(gettrack,"<VBR>",vbr)
  gettrack = Replace(gettrack,"<StartTime>",starttime)
  gettrack = Replace(gettrack,"<StopTime>",stoptime)
  gettrack = Replace(gettrack,"<SkipCount>",skipcount)
  gettrack = Replace(gettrack,"<TrackType>",tracktype)
  gettrack = Replace(gettrack,"<Series>",series)
  gettrack = Replace(gettrack,"<Director>",director)
  gettrack = Replace(gettrack,"<Producer>",producer)
  gettrack = Replace(gettrack,"<Actors>",actors)
  gettrack = Replace(gettrack,"<ParentalRating>",parental)
  gettrack = Replace(gettrack,"<EpisodeNumber>",episode)
  gettrack = Replace(gettrack,"<SeasonNumber>",season)
  gettrack = Replace(gettrack,"<Folder>",GetPart(1,path)) 
  gettrack = Replace(gettrack,"<Filename>",GetPart(2,path)) 
  gettrack = Replace(gettrack,"<Extension>",GetPart(3,path)) 
  gettrack = Replace(gettrack,"<Day>",theday)
  gettrack = Replace(gettrack,"<Month>",themonth)
  gettrack = Replace(gettrack,"<FullDate>",fulldate)
  gettrack = Replace(gettrack,"<Rating1>",rating1) 
  gettrack = Replace(gettrack,"<Rating2>",rating2) 
  gettrack = Replace(gettrack,"<Rating3>",rating3) 
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

Function GetPart(mode,path)
  GetPart = ""
  Dim p2 : p2 = InStrRev(path,"\")
  If p2 = 0 Then
    Exit Function
  End If
  If mode = 1 Then 'Folder
    Dim p1 : p1 = InStr(path,"\")
    If p1 < p2 Then
      GetPart = Mid(path,p1+1,p2-p1-1)
    End If
    Exit Function
  End If   
  Dim p3 : p3 = InStrRev(path,".")
  If mode = 2 Then 'Filename
    If p3 > p2 Then
      GetPart = Mid(path,p2+1,p3-p2-1)
    End If
    Exit Function
  End If
  If mode = 3 Then 'Extension
    If p3 > p2 Then
      GetPart = Mid(path,p3+1)
    End If
    Exit Function
  End If
End Function
Last edited by trixmoto on Sun May 25, 2008 4:23 pm, edited 5 times in total.
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.
J Kaufman
Posts: 7
Joined: Sun Jul 16, 2006 12:18 pm

Post by J Kaufman »

Didn't mean for you to do all that work on my behalf, but many thanks again. I must impose on you once again: how do I install it?
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

My advice would be to download the installer from my website - click the image in my signature.

However, to manually install it you need to paste the above code into a text editor and save it as "{MM}\Scripts\JustListAlbums.vbs". Then you need to open "{MM}\Scripts\Scripts.ini" in a text editor, and add this entry...

Code: Select all

[JustListAlbums]
FileName=JustListAlbums.vbs
ProcName=JustListAlbums
Order=1
DisplayName=Just List Albums
Description=Just List Albums
Language=VBScript
ScriptType=1
Then start MM, sort and select the tracks you want included, and select "File, Create Report, Just List Albums".
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.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

New version (1.1) is now available from my website. There is a Mask which allows you to display more information in the list, depending on your requirements.
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.
teemac
Posts: 30
Joined: Sun Apr 02, 2006 1:09 am

Post by teemac »

Thanks trix - been looking for a simple .txt printout for a long time.

Would it be possible to add a tracks listing option also to produce something like:

Mike Oldfield - Discovery (41:21)
# 01. To France - 4:37
# 02. Poison Arrows - 3:57
# 03. Crystal Gazing - 3:02
# 04. Tricks Of The Light - 3:52
# 05. Discovery - 4:35
# 06. Talk About Your Life - 4:24
# 07. Saved By A Bell - 4:39
# 08. The Lake - 12:10

Mike Oldfield - Earth Moving (41:23)
# 01. Holy - 4:37
# 02. Hostage - 4:09
# 03. Far Country - 4:24
# 04. Innocent - 3:30
# 05. Runaway Son - 4:07
# 06. See The Light - 3:59
# 07. Earth Moving - 4:04
# 08. Blue Night - 3:48
# 09. Nothing But / Bridge to Paradise - 8:40

Also maybe a TAB before each track to indent them a bit to seperate them from the Artist/Album Name/Total Time line.

I often have friends who need to check out what tracks and times are in certain albums. Currently I copy and paste a lot of stuff.

Your script is very close to what I need.

Many thanks if you can help.

teemac (Australia)
MM Gold User for life.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Yeah, this won't be a hard option to add. I'm catching up after getting back from a long weekend away but I'll get it done some time this week for you. :)
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.
teemac
Posts: 30
Joined: Sun Apr 02, 2006 1:09 am

Post by teemac »

Thanks Trix - I'll be waiting.

Hope you enjoyed your holiday.

I haven't had one for about 12 years - except when I go to sleep, I travel all over the world and it doesn't cost me a penny :D
teemac
Posts: 30
Joined: Sun Apr 02, 2006 1:09 am

Post by teemac »

Trixmoto - just a very little bump of this topic.

No pressure - just thought it may have slipped your mind - I know you are very busy writing all these great scripts.

My request is not extremely important - just wanted to keep it active.

Thanks for your help in the past and I'm sure more in the future.

teemac (Gold User) Australia
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Sorry for the delay, it is on my list. Next after my current project in fact! :)
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.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

New version (1.2) is now available from my website. It allows you to add a track mask as well to display the tracks within the albums.
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.
teemac
Posts: 30
Joined: Sun Apr 02, 2006 1:09 am

Post by teemac »

Trixmoto - Thank you very much for v1.2 - Works perfectly.

You're worth more money.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

More money? I don't get any money! I script for fun (although donations are always welcome!) :)
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.
Jock
Posts: 12
Joined: Fri Feb 02, 2007 4:02 pm

Post by Jock »

I'd love to use this feature, but, it's way above my capabilities :oops:
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

In what way is above your capabilities?
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.
Jock
Posts: 12
Joined: Fri Feb 02, 2007 4:02 pm

Post by Jock »

trixmoto wrote:In what way is above your capabilities?
When it comes to altering the programme I just panic in case I f*** everything up :oops:
Post Reply