Find Protected 1.0 [MM2+3]

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Find Protected 1.0 [MM2+3]

Postby trixmoto » Thu Nov 29, 2007 7:47 am

This script, as requested here, runs through the entire library finding tracks which are protected with DRM. Like a few of my scripts, there is a report to run which populates the node in the background, then you can click on the node to few the results.

The installers are available to download from my website, as always! :)

Code: Select all
'
' MediaMonkey Script
'
' NAME: FindProtected 1.0
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 29/11/2007
'
' INSTALL: Copy to Scripts\Auto directory and add the following to Scripts.ini
'          Don't forget to remove comments (') and set the order appropriately'         
'
' [FindProtected]
' FileName=Auto\FindProtected.vbs
' ProcName=FindProtected
' Order=10
' DisplayName=Find Protected
' Description=Populates Find Protected node
' Language=VBScript
' ScriptType=1
'

Option Explicit

Sub onStartUp
  'create node and add to tree
  Dim node : Set node = SDB.Objects("FindProtectedNode")
  If node Is Nothing Then
    Dim tree : Set tree = SDB.MainTree
    Set node = tree.CreateNode
    node.Caption = "Find Protected"
    node.IconIndex = 32
    node.UseScript = Script.ScriptPath
    node.OnFillTracksFunct = "ShowProtected"
    node.SortCriteria = 2
    tree.AddNode tree.Node_FilestoEdit,node,3
    Set SDB.Objects("FindProtectedNode") = node
  End If
End Sub

Sub ShowProtected(node)
  'check for list
  Dim list : Set list = SDB.Objects("FindProtectedList")
  If list Is Nothing Then
    'warn node not yet populated
    Call SDB.MessageBox("FindProtected: You need to select 'File|Create Reports|Find Protected' from the menu before this node will be populated.",mtInformation,Array(mbOk))
  Else
    'add list to main window
    Dim trax : Set trax = SDB.MainTracksWindow
    Dim i : i = 0
    For i = 0 To list.Count-1
      Call trax.AddTrack(list.Item(i))
      SDB.ProcessMessages
    Next
    'finish off
    trax.FinishAdding
  End If
End Sub

Sub FindProtected
  'reset list
  Set SDB.Objects("FindProtectedList") = Nothing
  Dim list : Set list = SDB.NewSongList
  Dim fso : Set fso = SDB.Tools.FileSystem
 
  'create progress bar
  Dim prog : Set prog = SDB.Progress
  prog.Value = 0
  Dim iter : Set iter = SDB.Database.OpenSQL("SELECT Count(1) AS SongCount FROM Songs")
  prog.MaxValue = iter.ValueByName("SongCount")
  prog.Text = "FindProtected: Initialising..."
 
  'get protected column
  Dim app : Set app = CreateObject("Shell.Application") 
  Dim fol : Set fol = app.Namespace(SDB.ApplicationPath)
  Dim i : i = 0
  For i = 0 To 34
    If fol.GetDetailsOf(fol.Items,i) = "Protected" Then
      Exit For
    End If
  Next
  If i = 35 Then
    Call SDB.MessageBox("FindProtected: Cannot find protected column!",mtError,Array(mbOk))
    Exit Sub
  End If     

  'loop through tracks
  Set fol = Nothing
  Dim loc : loc = ""
  Set iter = SDB.Database.QuerySongs("")
  Do While Not iter.EOF
    'update progress bar
    prog.Increase
    prog.Text = "FindProtected: Checking track "&prog.Value&"/"&prog.MaxValue&" (found: "&list.Count&")..."
    SDB.ProcessMessages
   
    'check details
    Dim pat : pat = iter.Item.Path
    Dim pos : pos = InStrRev(pat,"\")
    If Not (loc = Left(pat,pos-1)) Then
      loc = Left(pat,pos-1)
      Set fol = app.Namespace(loc)
    End If
    If Not (fol Is Nothing) Then
      Dim fil : Set fil = fol.ParseName(Mid(pat,pos+1))
      If Not (fil Is Nothing) Then
        If fol.GetDetailsOf(fil,i) = "Yes" Then
          list.Add(iter.Item)
        End If   
      End If
    End If
   
    'check next track
    If prog.Terminate Then
      Exit Sub
    Else
      iter.Next
    End If
  Loop
 
  'finish off
  Set SDB.Objects("FindProtectedList") = list
  If list.Count = 0 Then
    Call SDB.MessageBox("FindProtected: You have no protected files!",mtInformation,Array(mbOk))
    Exit Sub
  End If
 
  'show results
  i = SDB.MessageBox("FindProtected: Do you want to see the "&list.Count&" results now?",mtConfirmation,Array(mbYes,mbNo))
  If i = mrYes Then
    Dim tree : Set tree = SDB.MainTree
    Dim node : Set node = SDB.Objects("FindProtectedNode")
    tree.CurrentNode = tree.Node_Library
    tree.Node_Library.Expanded = True
    tree.CurrentNode = tree.Node_FilestoEdit
    tree.Node_FilestoEdit.Expanded = True
    tree.CurrentNode = node
  End If
End Sub

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("FindProtected","Filename") = "FindProtected.vbs"
    inif.StringValue("FindProtected","Procname") = "FindProtected"
    inif.StringValue("FindProtected","Order") = "10"
    inif.StringValue("FindProtected","DisplayName") = "Find Protected"
    inif.StringValue("FindProtected","Description") = "Populates Find Protected node"
    inif.StringValue("FindProtected","Language") = "VBScript"
    inif.StringValue("FindProtected","ScriptType") = "1"
    SDB.RefreshScriptItems
  End If
  Call onStartUp()
End Sub
Download my scripts at trixmoto.net. If you're interested, check out my Uniface blog.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Image Image
trixmoto
 
Posts: 9948
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK

Postby Guest » Sun Dec 02, 2007 3:54 am

Hi,
Great Idea and thanks for a script.
I have an issue: after installing and clicking on create report option I am getting error message: FindProtected: Cannot find protected column!
It this meant I dont have protected mp3's or theres an error with the script?

Best regards,
Piotr
Guest
 

Postby Guest » Sun Dec 02, 2007 4:15 am

Just want to add I have Vista 64 and it seems other scripts have also problem with working properly. Its something with admin rights or something in vista64.
I am running mediamonkey as an admin.
best regards,
Piotr
Guest
 

Postby trixmoto » Sun Dec 02, 2007 6:41 pm

Strange, I've tested this on Vista and it worked for me. It means that it cannot work out where in the file the protected header is. I've seen it be different values on different operating systems, but I've not seen it not there. Although maybe it could be a language thing - is your Vista using a language other than english?
Download my scripts at trixmoto.net. If you're interested, check out my Uniface blog.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Image Image
trixmoto
 
Posts: 9948
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK

Postby gapcnet » Mon Dec 17, 2007 9:46 pm

A really DUMB question .... I used your auto-installer. Now how do I make us if it?

Duuhhh

:oops:
Guy Austrian
gapcnet
 
Posts: 3
Joined: Mon Nov 26, 2007 6:15 pm

Postby trixmoto » Tue Dec 18, 2007 4:01 am

File > Create Report > Find Sync Dups
Download my scripts at trixmoto.net. If you're interested, check out my Uniface blog.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Image Image
trixmoto
 
Posts: 9948
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK

Postby Killjoy12 » Tue Jan 15, 2008 8:42 pm

I love this script, but it only works for me the first time after install.


The installation script does not put it in the Scripts\Auto folder. Could this be the issue I am seeing?

Thanks
Killjoy12
 
Posts: 100
Joined: Mon Jun 11, 2007 11:33 pm

Postby trixmoto » Wed Jan 16, 2008 6:45 am

Yes, you are right, sorry! I have rebuilt the installer so if you download it again it should work. :)
Download my scripts at trixmoto.net. If you're interested, check out my Uniface blog.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Image Image
trixmoto
 
Posts: 9948
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK

Postby Killjoy12 » Wed Jan 16, 2008 10:29 am

Awesome! Thanks
Killjoy12
 
Posts: 100
Joined: Mon Jun 11, 2007 11:33 pm

Weird Error

Postby martialartsguy » Sat Feb 23, 2008 2:00 pm

Getting the following error after downloading and running:

Image
MM 4.1.3.1708
martialartsguy
 
Posts: 234
Joined: Mon Apr 03, 2006 9:11 am
Location: Denver, CO

Postby trixmoto » Sun Feb 24, 2008 10:06 am

Does the file exist where the message says it should? If no then the installation must have failed, if yes then something (maybe an anti virus program) must be blocking the script from running.
Download my scripts at trixmoto.net. If you're interested, check out my Uniface blog.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Image Image
trixmoto
 
Posts: 9948
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK

Postby martialartsguy » Sun Feb 24, 2008 1:25 pm

Trix-

Looks like the installation failed. I moved the file to the proper place and all is well.
MM 4.1.3.1708
martialartsguy
 
Posts: 234
Joined: Mon Apr 03, 2006 9:11 am
Location: Denver, CO

Postby Guest » Mon Feb 25, 2008 3:42 pm

also got the "FindProtected: Cannot find protected column!" problem...
but i work with a german version of winxp on my pc
Guest
 

Postby trixmoto » Tue Feb 26, 2008 4:03 am

In this case you might need to change line 77 which is...
Code: Select all
If fol.GetDetailsOf(fol.Items,i) = "Protected" Then

I'm not sure what this column would be called in German, but translating it should fix the problem.
Download my scripts at trixmoto.net. If you're interested, check out my Uniface blog.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Image Image
trixmoto
 
Posts: 9948
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK

Postby nabuhonodozor » Fri Mar 07, 2008 8:05 am

Hi Trix, first of all thanks for great contributions!
As for find protected - I also have same error.
Changing line 77 didnt solve it. Ive change it to actually reflect a nod-name , an autoinstaller created during installation. New node is: Library/Files to Edit/Find Protected. So Ive change line 77 of vbs script from "Protected" to "Find Protected" but issue persists.
I have polish vista64 and english MM runs with administrator rights.
Best regards,
Piotr
nabuhonodozor
 
Posts: 5
Joined: Fri Mar 07, 2008 3:28 am
Location: warsaw, poland

Next

Return to Need Help with Addons?

Who is online

Users browsing this forum: Yahoo [Bot] and 12 guests