Editable Cells in AutoTag from Web

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

Editable Cells in AutoTag from Web

Postby crap_inhuman » Sat Oct 11, 2014 1:49 pm

tj_junk wrote:12) Allow user to edit data in the "files to update" grid. The Amazon Taggers allow the user to edit results before saving; however, the Discogs Tagger does not. You can type in the "files to update" grid, but it ignores anything that you type and immediately reverts to the Discogs text as soon as you exit the field.

crap_inhuman wrote:The grid is controlled by mm. I always thought, that it was not possible. But i would be happy, if someone know how to control the grid and allow the edits. Or the development team make it possible... If i can i would allow the edits. This would be a very useful function !

tj_junk wrote:To demonstrate, try using "Auto-Tag from Web" and select one of the Amazon sites from the Options menu. In the "files to update" grid, you can edit any cell and it will apply your changes when you press Auto-tag. The Discogs script doesn't allow that -- as soon as you exit the cell, your edits are lost. The Discogs script must be handling some kind of OnChange() event that prevents the user from editing cells in the grid.


I got this question in the discogs tagger thread. Is it possible to get the edited cells back to the script ?
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
crap_inhuman
 
Posts: 493
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: Editable Cells in AutoTag from Web

Postby crap_inhuman » Mon Oct 13, 2014 9:53 am

I just played with the grid and found some surprising "features". :wink:
I edit a cell in the lower grid of discogs tagger. As soon as i leave the cell, the old entry appears. The edit seems lost. But right-click on the song in the grid, choosing properties and investigate the tag show me the text i entered in the cell. If i close the script, open the properties of the song i see the updated tag.

So MM allow edit the tag in the grid but doesn't show it. It's a bug ?
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
crap_inhuman
 
Posts: 493
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: Editable Cells in AutoTag from Web

Postby Peke » Tue Oct 14, 2014 3:26 pm

Could be, can you try to make less complex script so that we can test it with?
Best regards,
Pavle
MM Core Developer and Admin of free MediaMonkey extensions Hosting
Image
Image
Peke
 
Posts: 10434
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia

Re: Editable Cells in AutoTag from Web

Postby crap_inhuman » Sat Oct 18, 2014 2:38 am

I just use the AMG Script from the Wiki.

Code: Select all
' Sample AMG Search script
'
' This script demonstrates how to plug-in into MediaMonkey Web Search dialog. You should save it to Scripts folder as
' SearchAMG.vbs. It has to be in Scripts.ini file, where entries can be as follows:
'
' [SearchAMG]
' FileName=SearchAMG.vbs
' ProcName=SearchAMG
' Order=10
' DisplayName=Search All Music Guide
' Language=VBScript
' ScriptType=3
 
Dim WB, WB2
Dim FoundLinks
Dim Tmr
 
' MediaMonkey calls this method whenever a search is started using this script
Sub StartSearch(Panel, SearchTerm, SearchArtist, SearchAlbum)
  Set UI = SDB.UI
 
  ' This is a web browser that we use to present results to the user
  Set WB = UI.NewActiveX(Panel, "Shell.Explorer")
  WB.Common.Align = 5      ' Fill whole client rectangle
  WB.Common.ControlName = "WB"
 
  ' This is a hidden browser that we use to find results (a better solution can be used, but this seems to be the easiest...)
  Set WB2 = UI.NewActiveX(Panel, "Shell.Explorer")
  WB2.Common.ControlName = "WB2"
 
  WB.Common.BringToFront
 
  ' The following HTML is taken from AMG web pages - so that we don't have to load the search page and can post the query directly
  ' The following line will probably need some better way of retrieving server name from AMG. Using www.allmusicguide.com doesn't work at this moment.
  html = "<form name=""search"" action=""http://wm08.allmusic.com/cg/amg.dll"" method=""post"">"
  html = html & "<input type=""hidden"" name=""P"" value=""amg"" />"
  html = html & "<p><input type=""text"" name=""sql"" id=""search_txt"" />"
  html = html & "<input type=""image"" src=""/i/pages/wide/go.gif"" id=""search_button"" /></p>"
  html = html & "<p><select name=""opt1"" id=""search_opt"">"
  html = html & "  <option value=""1"" selected=""selected"">Artist/Group</option>"
  html = html & "  <option value=""2"">Album</option>"
  html = html & "  <option value=""3"">Song</option>"
  html = html & "  <option value=""55"">Classical Work</option>"
  html = html & "</select></p>"
  html = html & "</form>"
 
  Set WB2Intf = WB2.Interf
  WB2Intf.Visible = false
 
  WB2.SetHTMLDocument html
 
  Set Doc2 = WB2Intf.Document
  Set SrchTxt = Doc2.getElementById("search_txt")
  If SearchAlbum <> "" Then
    SrchTxt.Value = SearchAlbum
  Else
    SrchTxt.Value = SearchTerm
  End If
 
  Set SrchType = Doc2.getElementById("search_opt")
  SrchType.selectedIndex = 1  ' Search for an album
 
  Set SrchButton = Doc2.getElementById("search_button")
  SrchButton.Click
 
  Set Tmr = SDB.CreateTimer(40)
  Script.RegisterEvent Tmr, "OnTimer", "ContinueSearch"
End Sub
 
' We use this procedure as a callback using Timer, so that we can present results as soon as they are downloaded
Sub ContinueSearch(Timer)
  Script.UnregisterEvents Tmr
  Set Tmr = Nothing
 
  Set WB2Intf = WB2.Interf
 
  If Len(WB2Intf.LocationURL) < 10 Then        ' A trick - wait until navigation to the search results page starts
    Set Tmr = SDB.CreateTimer(40)
    Script.RegisterEvent Tmr, "OnTimer", "ContinueSearch"
    Exit Sub
  End If
 
  If WB2Intf.ReadyState = 1 Or WB2Intf.Busy Then
    Set Tmr = SDB.CreateTimer(40)
    Script.RegisterEvent Tmr, "OnTimer", "ContinueSearch"
    Exit Sub
  End If
 
  Set Doc2 = WB2Intf.Document
 
  Set DivResults = Doc2.body
 
  Set Results = SDB.NewStringList
  Set FoundLinks = SDB.NewStringList
  If IsObject(DivResults) And Not IsNull(DivResults) Then
    Set AColl = DivResults.getElementsByTagName("A")
    For Each itm In AColl
      Set Imgs = itm.getElementsByTagName("img")
      pos = InStr(CStr(itm.href), ".com/")
      If pos > 0 Then
        href = Mid(itm.href, pos)
        If Left(href,Len(".com/cg/amg.dll?p=amg&sql=10:")) = ".com/cg/amg.dll?p=amg&sql=10:" And Imgs.length = 0 Then
          Results.Add itm.innerText
          FoundLinks.Add itm.href
        End If
      End If
    Next
 
    SDB.Tools.WebSearch.SetSearchResults Results
    If Results.Count > 0 Then
      SDB.Tools.WebSearch.ResultIndex = 0
    End If
  Else
    WB.SetHTMLDocument = Doc2.documentElement.innerHTML
  End If
End Sub
 
' This procedure is called by MediaMonkey when user selects some of search results
Sub ShowResult(ResultID)
  If ResultID >= 0 And ResultID < FoundLinks.Count Then
    SDB.Tools.WebSearch.ClearTracksData   ' Tell MM to disregard any previously set tracks' data
    WB.SetHTMLDocument ""                 ' To prevent usage of this data
    WB.Interf.Navigate FoundLinks.Item(ResultID)
 
    Set Tmr = SDB.CreateTimer(500)
    Script.RegisterEvent Tmr, "OnTimer", "ResultFullyLoaded"
  End If
End Sub
 
' This is a callback handled by a timer, so that we can respond as soon as album results are loaded
Sub ResultFullyLoaded(Timer)
  Script.UnregisterEvents Tmr
  Set Tmr = Nothing
 
  Set Tracks = SDB.NewStringList
 
  Set Doc = WB.Interf.Document
 
  If IsObject(Doc) Then
    ' Get track titles
    Set AColl = Doc.getElementsByTagName("A")
    For Each itm In AColl
      Set Imgs = itm.getElementsByTagName("img")
      pos = InStr(CStr(itm.href), ".com/")
      If pos > 0 Then
        href = Mid(itm.href, pos)
        If Left(href,Len(".com/cg/amg.dll?p=amg&sql=33:")) = ".com/cg/amg.dll?p=amg&sql=33:" And Imgs.length = 0 Then
          Tracks.Add itm.innerText
        End If
      End If
      If itm.className = "subtitle" Then
        ArtistTitle = itm.innerText
      End If
    Next
 
    ' Get album title
    Set SpanColl = Doc.getElementsByTagName("Span")
    For Each itm in SpanColl
      If itm.className = "title" Then
        AlbumTitle = itm.innerText
      End If
    Next
 
    ' Get Album art URL
    Set ImgColl = Doc.getElementsByTagName("Img")
    For Each itm in ImgColl
      If Left(itm.src,Len("http://image.allmusic.com/")) = "http://image.allmusic.com/" Then
        SDB.Tools.WebSearch.AlbumArtURL = itm.src
      End If
    Next
 
    ' Get release year
    Set SpanColl = Doc.getElementsByTagName("span")
    For Each itm In SpanColl
      pos = InStr(itm.innerText, "Release Date")
      If pos > 0 Then
        Set Parnt = itm.parentNode.parentNode.parentNode.parentNode
        Set TDColl = Parnt.getElementsByTagName("td")
        For Each itm2 In TDColl
          If itm2.className = "sub-text" Then
            ReleaseYear = Right(itm2.innerText, 4)
            Exit For
          End If
        Next
        Exit For
      End If
    Next
 
    ' Get genres/styles/moods/themes
    ListCnt = 0
    Set DivColl = Doc.getElementsByTagName("div")
    For Each itm In DivColl
      pos = InStr(itm.id, "left-sidebar-list")
      If pos > 0 Then
        Set AColl = itm.getElementsByTagName("a")
        MyList = ""
        For Each itm2 In AColl
          If MyList <> "" Then MyList = MyList & ";"
          MyList = MyList & itm2.innerText
        Next
        ListCnt = ListCnt + 1
        Select Case ListCnt
          Case 1
            Genres = MyList
          Case 2
            Styles = MyList
          Case 3
            Moods = MyList
          Case 4
            Themes = MyList
        End Select
      End If
    Next
  End If
 
  If Tracks.Count = 0 Then
    ' Nothing found yet, wait some more time
    Set Tmr = SDB.CreateTimer(500)
    Script.RegisterEvent Tmr, "OnTimer", "ResultFullyLoaded"
  Else
    ' Some results were found, notify MediaMonkey
    SDB.Tools.WebSearch.SmartUpdateTracks Tracks
    For i = 0 To SDB.Tools.WebSearch.NewTracks.Count - 1
      SDB.Tools.WebSearch.NewTracks.Item(i).ArtistName = ArtistTitle
      SDB.Tools.WebSearch.NewTracks.Item(i).AlbumName = AlbumTitle
      SDB.Tools.WebSearch.NewTracks.Item(i).Year = ReleaseYear
      SDB.Tools.WebSearch.NewTracks.Item(i).Genre = Genres
      SDB.Tools.WebSearch.NewTracks.Item(i).Custom1 = Styles
      SDB.Tools.WebSearch.NewTracks.Item(i).Custom2 = Moods
      SDB.Tools.WebSearch.NewTracks.Item(i).Custom3 = Themes
    Next
    SDB.Tools.WebSearch.RefreshViews   ' Tell MM that we have made some changes
  End If
End Sub
 
' This does the final clean up, so that our script doesn't leave any unwanted traces
Sub FinishSearch(Panel)
  ' Correctly terminate all the actions we have started
  WB.Common.DestroyControl      ' Destroy the external control
  WB2.Common.DestroyControl     '    "     "     "        "
  Set WB = Nothing              ' Release global variable
  Set WB2 = Nothing             '    "      "        "
  Set FoundLinks = Nothing      '    "      "        "
  If IsObject(Tmr) Then
    Script.UnregisterEvents Tmr ' Unregister timer events
    Set Tmr = Nothing           ' Release global variable
  End If
End Sub
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
crap_inhuman
 
Posts: 493
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: Editable Cells in AutoTag from Web

Postby crap_inhuman » Thu Feb 12, 2015 1:28 am

I posted a script for testing about 3 month ago. Could you test it in the meantime?
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
crap_inhuman
 
Posts: 493
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: Editable Cells in AutoTag from Web

Postby crap_inhuman » Mon Nov 16, 2015 9:49 pm

More than a year has passed and no answer for my question...
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
crap_inhuman
 
Posts: 493
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany


Return to MediaMonkey 4 Addons developer forum

Who is online

Users browsing this forum: No registered users and 7 guests