Page 6 of 17

Re: Just List Albums 1.5 [MM2+3]

Posted: Sat Jun 28, 2008 12:28 pm
by sommo
I would just like to say a thank you trixmoto, for this addon!
This is one of the reason why I use MediaMonkey!
It is really helpful and I do use it :)
Keep up the good work & Happy coding!

Re: Just List Albums 1.6 [MM2+3]

Posted: Sun Aug 17, 2008 3:30 pm
by trixmoto
New version (1.6) is now available to download from my website. This version includes a new album mask field to display the average album bitrate.

Re: Just List Albums 1.6 [MM2+3]

Posted: Thu Dec 04, 2008 7:54 pm
by sakurakessho
Maybe I'm a bit special or something but all this script does for me is list the artist and the album and the number of tracks. Nothing else. Used to work just fine before I did a clean install of MM3.

Re: Just List Albums 1.6 [MM2+3]

Posted: Thu Dec 04, 2008 8:03 pm
by MonkeyBone
hmm.. Isn't that what it's supposed to do? Does it have any other features?

Re: Just List Albums 1.6 [MM2+3]

Posted: Thu Dec 04, 2008 8:26 pm
by sakurakessho
Trixmoto has said that it would list the tracklist and now the average bitrate. But none of that shows up for me. So I don't know. And before I did my clean install the script was working like it was supposed to.

Re: Just List Albums 1.6 [MM2+3]

Posted: Fri Dec 05, 2008 6:04 am
by trixmoto
You have to edit the the mask variables at the top of the script by opening the .vbs file in a text editor. I added extra mask fields but did not change the default mask.

Re: Just List Albums 1.6 [MM2+3]

Posted: Fri Dec 05, 2008 7:32 am
by sakurakessho
Ooooh! Okay. Thanks Trixmoto, I see how that's done now.

Re: Just List Albums 1.6 [MM2+3]

Posted: Sat Jun 27, 2009 9:25 am
by kazadharri
Trixmoto:
On the <rating> field how can I change it to only have like 3 or 4 digit behind the decimal in the print out? I really don't need ten didgits?

Example.

10,000 Maniacs - Our Time in Eden - 2.74230769230769 (13/13)

So it would be like:
10,000 Maniacs - Our Time in Eden - 2.742 (13/13)

Thanks:
/Jeff

Re: Just List Albums 1.6 [MM2+3]

Posted: Sat Jun 27, 2009 12:34 pm
by trixmoto
Yeah, find line 79...

Code: Select all

rating = getval(iter,"vRat")/20
...and replace it with this...

Code: Select all

      Dim temp : temp = getval(iter,"vRat")
      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

Re: Just List Albums 1.6 [MM2+3]

Posted: Sat Jun 27, 2009 3:28 pm
by kazadharri
Thanks,
Jeff

Re: Just List Albums 1.6 [MM2+3]

Posted: Sat Jul 11, 2009 12:53 pm
by kazadharri
Trix,
Is there a way to get the report formated like this?

Aerosmith - Just Push Play (12/12)
01 - Beyond Beautiful - 3.5
02 - Just Push Play - 5.0
03 - Jaded - 4.0
04 - Fly Away from Here - 3.5
05 - Trip Hoppin' - 3.0
06 - Sunshine - 3.5
07 - Under My Skin - 2.5
08 - Luv Lies - 3.5
09 - Outta Your Head - 4.0
10 - Drop Dead Gorgeous - 3.5
11 - Light Inside - 3.0
12 - Avant Garden - 1.9

Aerosmith - Permanent Vacation (12/12)
01 - Heart's Done Time - 1.9
02 - Magic Touch - 1.5
03 - Rag Doll - 4.0
04 - Simoriah - 1.9

But with the Tracks being indented a few Spaces, and a line Space between albums? I use your advanced report but I use this version in MS WORD to solve tagging and other issues. Also can you display Playcounts.

Thnaks,
Jeff

Re: Just List Albums 1.6 [MM2+3]

Posted: Tue Jul 14, 2009 3:38 am
by trixmoto
Well it looks like you want something like...

Code: Select all

Dim Mask : Mask = "<Artist> - <Album> (<Tot>/<Max>)" 'mask for artist albums
Dim TrackMask : TrackMask = "   <Track#> - <Title> - <Rating>" 'blank mask means no tracks are displayed
There's no way to add the blank lines and at the moment the only way to display the playcount would be to copy it into a custom field.

Re: Just List Albums 1.6 [MM2+3]

Posted: Tue Aug 18, 2009 7:56 pm
by MMan
Trix -

First, love your work! Thanks for making Monkey great. I didn't even know that you had written the Just Albums report script until I saw this post. I tried Loading it and I'm getting the samew error message. See Post below. Any thoughts? Thanks again for the great work and in advance for any help getting this working.

http://www.mediamonkey.com/forum/viewto ... 09#p217896

Re: Just List Albums 1.6 [MM2+3]

Posted: Wed Aug 19, 2009 3:26 am
by trixmoto
Well that's strange, looks like the entry in "Scripts.ini" is pointing to ".vbs.txt" when it should be pointing to ".vbs" - try modifying this using a text editor.

Re: Just List Albums 1.6 [MM2+3]

Posted: Wed Aug 19, 2009 6:37 am
by MMan
Here's what the scripts.ini looks like. It seems that it is pointing to .vbs I've also attached what's in the script itself. ANy thoughts?

[Statistics]
FileName=Stats.vbs
ProcName=ShowStats
Order=1
DisplayName=&Statistics
Description=Library Statistics Report
Language=VBScript
ScriptType=1

[ExportHTML]
FileName=Export.vbs
ProcName=ExportHTML
Order=2
DisplayName=Track List (&HTML)
Description=Exports selected tracks to a .htm file
Language=VBScript
ScriptType=1

[ExportXML]
FileName=Export.vbs
ProcName=ExportXML
Order=3
DisplayName=Track List (&XML)
Description=Exports selected tracks to an .xml file
Language=VBScript
ScriptType=1

[ExportCSV]
FileName=Export.vbs
ProcName=ExportCSV
Order=4
DisplayName=Track List (CS&V)
Description=Exports selected tracks to a .csv file
Language=VBScript
ScriptType=1

[ExportXLS]
FileName=Export.vbs
ProcName=ExportXLS
Order=5
DisplayName=Track List (&Excel)
Description=Exports selected tracks to a .xls file
Language=VBScript
ScriptType=1

[AutoIncTrackN]
FileName=AutoIncTrackN.vbs
ProcName=AutoIncTrackNumbers
Order=10
DisplayName=Auto-&increment Track #s...
Description=Sequentially numbers Tracks
Language=VBScript
ScriptType=0

[SwapArtistTitle]
FileName=SwapArtistTitle.vbs
ProcName=SwapArtistTitle
Order=20
DisplayName=&Swap Artist and Title
Description=Swaps Artist and Title fields
Language=VBScript
ScriptType=0

[Case]
FileName=Case.vbs
ProcName=TitleCase
Order=30
DisplayName=Case Checker...
Description=Checks for correct capitalization
Language=VBScript
ScriptType=0

[ExportM3Us]
FileName=ExportM3Us.vbs
ProcName=ExportM3Us
Order=40
DisplayName=Export all Playlists...
Description=Exports all Playlists to .m3u
Language=VBScript
ScriptType=0

[CustomReport]
Filename=CustomReport.vbs
Procname=CustomReport
Order=50
DisplayName=Custom Report
Description=Custom Report
Language=VBScript
ScriptType=1

[CustomReportAuto]
Filename=CustomReport.vbs
Procname=CustomReportAuto
Order=51
DisplayName=Custom Report Auto
Description=Custom Report with previous options
Language=VBScript
ScriptType=1

[ExportOPML]
FileName=ExportOPML.vbs
ProcName=ExportOPML
Order=50
DisplayName=Export subscribed Podcasts...
Description=Exports subscribed Podcasts to .opml file
Language=VBScript
ScriptType=0

[JustListAlbums]
Filename=JustListAlbums.vbs
Procname=JustListAlbums
Order=1
DisplayName=Just List Albums
Description=Just List Albums
Language=VBScript
ScriptType=1

***************************** Here's the script that wqas loaded by your intsaller: ************************************************

'
' MediaMonkey Script
'
' NAME: JustListAlbums 1.6
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 17/08/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 and CompMask variables can include fields: <Artist><Album><Year><Rating><Length><Tot><Max><Discs><Bitrate>
' TrackMask variable 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: Added average album bitrate
'

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 = "<Artist> - <Album> (<Tot>/<Max>)" 'mask for compilation albums
Dim FirstMask : FirstMask = "" 'mask for first track in an album

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...")

Dim i,itm,iter,str,theyear,rating,length,tot,max,discs,sql,alb,art,comp,itmID,bitrate
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
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, 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
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")
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
End If
Else
max = max+1
discs = 1
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
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,"<Bitrate>",bitrate)
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
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,"<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