Find small albums (or singles/EPs)

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

Moderators: Peke, Gurus

some1
Posts: 91
Joined: Tue Jul 03, 2007 3:10 am

Find small albums (or singles/EPs)

Post by some1 »

Is there a way (or scrpit (or one which could be modded)) to find "short albums" say less than 4/5 tracks on the album/single/ep?

because I have alot of little incomplete small albums (say just track 4 ,7 9 ,13) and I would rare they be called "singles" and have no track numbers, that have alot of missing tracks for that album!

Any ideas/Help?
emalvick
Posts: 265
Joined: Tue May 15, 2007 9:44 am

Post by emalvick »

Look into the Magic Nodes script. I believe there are example nodes that are used to find albums with more than a few tracks (i.e. full albums as opposed to EP's or Singles). You could modify that example to fit your needs (i.e. a less than instead of greater than).

Erik
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky »

You could try this magic node

One Hit Wonders\<artist|max tracks:5>

That may not be exactly what you want tho.

I duno, perhaps this might work (havent tested it)

Small Albums\<album|max tracks:5>
some1
Posts: 91
Joined: Tue Jul 03, 2007 3:10 am

Post by some1 »

Thanks, but I dont use MagicNode (tbh, not sure why...Will download it, after posting this!)


Anyway, I did a scrpit for it, (which Ive rush, and I dont believe I will ever update it!), anyway, here it is....

Code: Select all

'                                                     _ _
'                                                     (_) |
'                                            __      ___| |___  ___  _ __
'                                            \ \ /\ / / | / __|/ _ \| '_ \
'                                             \ V  V /| | \__ \ (_) | | | |
'                                              \_/\_/ |_|_|___/\___/|_| |_|
'
' *************************************************
' * Program : [MediaMonkey v2.5] FindTheSmallAlbum *
' * Ver     : 0.1                                 *
' * Date    : 17/07/2007                          *
' * Author  : Wilson                              *
' * Purpose : Script for MM to find missing track *
' *************************************************
'//////////////////////////////////////////////////////////////////////////////////////////////////////////////'
'Install from scrpit:
' 1) Find the "Auto" Folder  ("Mediamonkey\Scripts\Auto") . Right click --> create a new/blank text file.
' 2) Name it FindTheSmallAlbum.vbs
'      Make sure its a VBS file, i.e. the file isn't named FindTheMissing.vbs.txt. If this was done correctly, then the icon should of changed
'     If it did NOT then, To always display all filenames with extension in explorer, do this:
'	       1.). In explorer, go to Tools->Folder Options->View Tab
'	       2.) Uncheck "hide file extensions for known file types"
' 3) Copy all this code into the file and save it.
' 4) (Re)start MediaMonkey
'//////////////////////////////////////////////////////////////////////////////////////////////////////////////'
'Version History/Change Log:
'	v0.1 (17/07/07)
'	* Had the Idea.
'	* First Release to public (MM forumss).
'//////////////////////////////////////////////////////////////////////////////////////////////////////////////'
'ToDos:
'	 * List all albums (but it then cant read Node.CustomData)
'//////////////////////////////////////////////////////////////////////////////////////////////////////////////'
'WishList:
'	* Rename this, and add in [FindTheMissing] Songs, to [FindThe]Missing Songs,  [FindThe] ShortAlbums
'	* Do other album functions (tho its been done before in "Tagging Inconsistencies")
'//////////////////////////////////////////////////////////////////////////////////////////////////////////////'
' Authors Notes:
'	* Should it be "albums with 4 tracks" or "albums with 4 tracks OR LESS"?
'//////////////////////////////////////////////////////////////////////////////////////////////////////////////'
' Global Variables and Declarations
'//////////////////////////////////////////////////////////////////////////////////////////////////////////////'
Function albumCaption(artist, album)
   albumCaption = album & " - " & artist
'<---Different sorting methods ---- >
'   albumCaption = artist & " - " & album  
'   albumCaption = album & " - " & artist
'   albumCaption = album   
End Function

'//////////////////////////////////////////////////////////////////////////////////////////////////////////////'
' Startup Function (when the first is first run, when MM starts)
'//////////////////////////////////////////////////////////////////////////////////////////////////////////////'

Sub onStartUp
   Dim Tree, Iter
   Dim sql

   Dim Node
   Set Node= SDB.MainTree.createNode
   Node.Caption = "[FindThe] ShortAlbums"
   Node.IconIndex = 40
   Node.UseScript = Script.ScriptPath
   Script.RegisterEvent node, "OnFillChildren", "ListAlbums"
   SDB.MainTree.AddNode SDB.MainTree.Node_FilesToEdit, Node, 2
   Node.hasChildren = True 
End Sub

Sub ListAlbums(Node) 
  Dim Tree : Set Tree = SDB.MainTree
  
  Dim Subnode1 : Set Subnode1 = Tree.CreateNode
  Subnode1.Caption = "1 track in the album"
  Subnode1.IconIndex = 49
  Subnode1.CustomNodeID = 1
  SubNode1.UseScript = Script.ScriptPath
  Script.RegisterEvent Subnode1, "OnFillChildren", "showalbums"
  Script.RegisterEvent Subnode1, "OnFillTracks", "showalbums"
  Tree.AddNode Node, Subnode1, 3
  Subnode1.HasChildren = True
  
  Dim Subnode2 : Set Subnode2 = Tree.CreateNode
  Subnode2.Caption = "2 tracks in the album"
  Subnode2.IconIndex = 49
  Subnode2.CustomNodeID = 2
  SubNode2.UseScript = Script.ScriptPath
  Script.RegisterEvent Subnode2, "OnFillChildren", "showalbums"
  Script.RegisterEvent Subnode2, "OnFillTracks", "showalbums"
  Tree.AddNode Node, Subnode2, 3
  Subnode2.HasChildren = True
  
  Dim Subnode3 : Set Subnode3 = Tree.CreateNode
  Subnode3.Caption = "3 tracks in the album"
  Subnode3.IconIndex = 49
  Subnode3.CustomNodeID = 3
  SubNode3.UseScript = Script.ScriptPath
  Script.RegisterEvent Subnode3, "OnFillChildren", "showalbums"
  Script.RegisterEvent Subnode3, "OnFillTracks", "showalbums"
  Tree.AddNode Node, Subnode3, 3
  Subnode3.HasChildren = True
  
  Dim Subnode4 : Set Subnode4 = Tree.CreateNode
  Subnode4.Caption = "4 tracks in the album"
  Subnode4.IconIndex = 49
  Subnode4.CustomNodeID = 4
  SubNode4.UseScript = Script.ScriptPath
  Script.RegisterEvent Subnode4, "OnFillChildren", "showalbums"
  Script.RegisterEvent Subnode4, "OnFillTracks", "showalbums"
  Tree.AddNode Node, Subnode4, 3
  Subnode4.HasChildren = True
  
  Dim Subnode5 : Set Subnode5 = Tree.CreateNode
  Subnode5.Caption = "5 tracks in the album"
  Subnode5.IconIndex = 49
  Subnode5.CustomNodeID = 5
  SubNode5.UseScript = Script.ScriptPath
  Script.RegisterEvent Subnode5, "OnFillChildren", "showalbums"
  Script.RegisterEvent Subnode5, "OnFillTracks", "showalbums"
  Tree.AddNode Node, Subnode5, 3
  Subnode5.HasChildren = True
End Sub

sub showalbums(node)
	dim x : x = Node.CustomNodeID
	Dim sql, Iter, subroot, albumId
	Node.hasChildren = False
	
   sql = "SELECT album, albums.id, artist, COUNT(*) AS NumTracks, MAX(songs.songorder)+1 AS MaxTracks "&_
     "FROM songs, albums, artists "&_
     "WHERE songs.IDAlbum = albums.id AND artists.id = albums.idartist "&_
     "GROUP BY artist, album, albums.id "&_
     "HAVING COUNT(*) <= "& x &"  AND "&_
       "COUNT(*) >=  "& x &" AND "&_
       "album <> '' AND "&_
       "MAX(songs.songorder)+1 <> " & x & " "&_
	   "ORDER BY album, artist"
	   '<---Different sorting methods ---- >
	    '"ORDER BY (MAX(songs.songorder)-COUNT(*))" 
		'"ORDER BY artist, album"
		'"ORDER BY album,artist"
		'<--- unsure mod to code --->
		'"MAX(songs.songorder)+1 <> " & x & " "&_
		'"MAX(songs.songorder)  < " & x & " "&_

   Dim captionTable, caption
   Set captionTable = CreateObject("Scripting.Dictionary")
   Set Iter = SDB.Database.OpenSQL(sql)

   Do Until Iter.EOF
      Dim customData
      customData = Iter.StringByIndex(0)&"@@"&Iter.StringByIndex(1)
      caption = albumCaption(Iter.StringByIndex(2),Iter.StringByIndex(0))&_
        " ("&Iter.StringByIndex(3)&"/"&Iter.StringByIndex(4)&")"
      captionTable.add caption, customData

      Set subRoot = SDB.MainTree.createNode
      subRoot.Caption = caption
      subRoot.IconIndex = 16
      subRoot.UseScript = Script.ScriptPath
      subRoot.OnFillTracksFunct = "showTracks"
      subRoot.customData = customData
      subRoot.sortCriteria = 0
      subRoot.sortGroup = 0
      subRoot.hasChildren = False
      SDB.MainTree.AddNode Node, subRoot, 3

      Iter.Next
   Loop

End Sub

'//////////////////////////////////////////////////////////////////////////////////////////////////////////////'
' Gets the tracks from the albums
'//////////////////////////////////////////////////////////////////////////////////////////////////////////////'
Sub showTracks(Node)
	Dim sql, songlist, SplitCustomData, name, albumId
	SplitCustomData = Split(Node.CustomData,"@@")
	name = SplitCustomData(0)
	albumId = SplitCustomData(1)
	sql = "SELECT Songs.Id, Songs.SongOrder FROM Songs "&_
	      "WHERE songs.idAlbum = "&albumId&" "&_
	      "ORDER BY Songs.SongOrder"

   Dim Iter, id, track, song, songTable, Tracks
   Set songTable = CreateObject("Scripting.Dictionary")
   Set Iter = SDB.Database.OpenSQL(sql)
   Set Tracks = SDB.MainTracksWindow
   
   Dim bDuplicates
   bDuplicates = false
   Do Until Iter.EOF
      id = Iter.StringByIndex(0)
      track = Iter.StringByIndex(1) + 1
      If songTable.Exists(track) Then
         bDuplicates = true
      End If

      'songTable.add track, id <<< ??? what does this do?
      Tracks.AddTracksFromQuery("AND Songs.ID = "&id)

      Iter.Next
   Loop
      
   If bDuplicates Then ' <<< does this work!?
      SDB.MessageBox "Duplicate track numbers exist for this album. Please correct.", mtWarning, Array(mbOk)
   End If
   Tracks.FinishAdding
 End Sub
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

I'll add that possibility to my "Tagging inconsistencies" script since it's pretty easy! :D

In the meantime here's a magic node mask which does what you want:

Code: Select all

Incomplete Albums|SQL filter: IDAlbum IN (SELECT IDAlbum FROM Songs GROUP BY IDAlbum, IIf(SongOrder+1>99,Left(SongOrder+1,1),0) HAVING (Max(Val(Right(SongOrder+1,2)))<>Count(*)) and Count(*)<5)|show tracks:no\<Album Artist>\<Album>
Where the last part, Count(*)<5, means albums with less than 5 tracks. Just change it to whatever is right for you.
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
some1
Posts: 91
Joined: Tue Jul 03, 2007 3:10 am

Post by some1 »

yep, a simple mod to "FindTheMissing", just changed the limits for what tracks numbers to look for! (from "everything" to "x" (which the user picks))

What HASN'T Tagging inconsistencies got covered :P
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

There are a few things that will be implemented later in MM3 when it's stabilized... :wink:
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
Mizery_Made
Posts: 2283
Joined: Tue Aug 29, 2006 1:09 pm
Location: Kansas City, Missouri, United States

Post by Mizery_Made »

some1 wrote:What HASN'T Tagging inconsistencies got covered :P
Some kind of OK-List feature, atleast for some of the more obvious (No Album Art for instance) :P

*Shrugs* Still a very impressive script, can only imagine the ground Bex could cover with it after the MM3 release. *Waits patiently, for both the MM3 Release, and the Script Update :)*
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

Thanks!
Actually, an OK-List is already on my todo list. The problem here is exactly as in the dupe script's "custom dupe search". What to do if the tags get changed after the track/album is OK'ed? I have some ideas I haven't tested yet so we'll see what I come up with.
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
Mizery_Made
Posts: 2283
Joined: Tue Aug 29, 2006 1:09 pm
Location: Kansas City, Missouri, United States

Post by Mizery_Made »

Yeah, I just like giving you a hard time about it Bex. :P Most of the nodes are OK without an OK-List, the only one that really bothers me is ones like "No Album Art" since I have some 'Internet Releases' and such that don't actually have any. No real biggie though.
Post Reply