Txt Importer 1.1 [MM2+3]

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Txt Importer 1.1 [MM2+3]

Postby trixmoto » Wed Feb 21, 2007 6:03 am

This is a new script, as requested here.

It imports tags from a .txt file matching the track filename. The .txt file should contain tags in this format...
Code: Select all
Title=New Title
Comment=This is my comment

The installer for this script can be downloaded from my website.

Code: Select all
'
' MediaMonkey Script
'
' NAME: TxtImporter 1.1
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 27/02/2007
'
' INSTALL: Copy to Scripts directory and add the following to Scripts.ini
'          Don't forget to remove comments (') and set the order appropriately
'
' FIXES: Added possibility of multiline tags
'
' [TxtImporter]
' FileName=TxtImporter.vbs
' ProcName=TxtImporter
' Order=30
' DisplayName=TxtImporter
' Description=Import tags from txt file
' Language=VBScript
' ScriptType=0
'

Option Explicit

Sub TxtImporter
  'get list
  Dim i : i = 0
  Dim list : Set list = SDB.SelectedSongList
  If list.Count = 0 Then
    Set list = SDB.AllVisibleSongList
  End If
  If list.Count = 0 Then
    Call SDB.MessageBox("Select tracks to be tagged.", mtError, Array(mbOk))
    Exit Sub
  Else
    i = SDB.MessageBox("Import tags for "&list.Count&" tracks?", mtConfirmation, Array(mbYes,mbCancel)) 
    If Not (i = mrYes) Then
      Exit Sub
    End If
  End If

  'progress bar
  Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
  Dim bar : Set bar = SDB.Progress
  bar.MaxValue = list.Count
  bar.Text = "TxtImporter: Initialising..."
 
  'tag each track
  For i = 0 To list.Count-1
    'progress bar
    bar.Text = "TxtImporter: Tagging track "&(i+1)&" of "&(list.Count)&"..."
    bar.Increase
    SDB.ProcessMessages
   
    'get path of txt
    Dim itm : Set itm = list.Item(i)
    Dim path : path = Left(itm.Path,InStrRev(itm.Path,"."))&"txt"
    If fso.FileExists(path) Then
      'read file
      Dim txt : Set txt = fso.OpenTextFile(path,1,False)
      Dim pre,val,tag,str,pos
      Do While Not txt.AtEndOfStream
        str = Trim(txt.ReadLine)
        pos = InStr(str,"=")
        If pos > 0 Then
          tag = Left(str,pos-1)
          val = Mid(str,pos+1)
          On Error Resume Next
          Execute("itm."&tag&" = """&val&"""")
          Err.Clear
          On Error Goto 0
        Else
          If Not (tag = "") Then
            On Error Resume Next
            Execute("itm."&tag&" = itm."&tag&"&Chr(13)&"""&str&"""") '!
            Err.Clear
            On Error Goto 0           
          End If
        End If
      Loop
      txt.close
    Else
    End If
    If bar.Terminate Then Exit Sub
  Next
 
  'finish off
  bar.Text = "TxtImporter: Finalising..."
  SDB.ProcessMessages
  list.UpdateAll
End Sub
Last edited by trixmoto on Mon Jul 09, 2007 3:43 am, edited 3 times in total.
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby trixmoto » Tue Feb 27, 2007 10:20 am

New version (1.1) is now available from my website. It allows the possibility of having multiline tags, like this...
Code: Select all
Title=Title
Comment=Line1
Line2
Artist=Test

Please note: The first equals (=) character in any line must be directly after the field name. For multiline tags, the additional lines cannot contain an equals (=) character at all.
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Anyway to do this with an excel file

Postby Guest » Fri Jul 06, 2007 4:00 pm

This is great but I was wondering if there was anyway to convert that script so instead of an individual txt file it would use an excel file were column A would contain the filename, then columns B, C, .... Etc would contain the fields?

this way one could update a lot of their files at once?

Thanks
Guest
 

Postby trixmoto » Mon Jul 09, 2007 3:41 am

I think a script like that could be written, but it would certainly be a different script. It's on my to do list! :)
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby trixmoto » Fri Oct 26, 2007 5:25 am

There is now an MM3 installation package available from my website for this script. :)
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby mhendu » Thu Nov 01, 2007 2:46 am

Hi Trixmoto,

Did you ever create the script allowing for import of tags from a tab-separated text file? I found on this forum a script that does it right now but it's based on columns and not on filenames, so it will overwrite the tags for the wrong files if you're not careful. Would be much better if the script could read the filename from the first column, match it with the file in the database and then import the tags from the remaining columns. My primary use for this would be to import BPM ratings from MixMeister. The only other issue I can see is that MixMeister exports BPM to the 2nd decimal point (e.g., 122.45) and MediaMonkey will only allow integers to be imported, so currently I have to use Excel to round the results. Anyhow, thanks for all your great scripts, I use quite a few of them!
mhendu
 
Posts: 69
Joined: Thu Jan 12, 2006 11:18 am

Postby trixmoto » Sun Nov 04, 2007 12:28 pm

Well this script assumes a single text file for each track. I don't know if there is one which takes the filenames out of a single file. Could be written though! :)
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby pictureman22 » Fri Dec 07, 2007 3:08 am

So I'm kind of new at this. I've downloaded the script. I can't figure out how to get to the txt file, I believe it should just find it. So I'm not sure where to save the txt file along with the name of the file.

Thanks in advance
pictureman22
 
Posts: 5
Joined: Fri Dec 07, 2007 3:04 am

Postby trixmoto » Fri Dec 07, 2007 9:31 am

This script tries to find textfiles with the same name as the music files. So, if your music file is...

F:\Music\The Beatles\1\Love Me Do.mp3

...then the textfile should be...

F:\Music\The Beatles\1\Love Me Do.txt
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby estebanrey » Sun Mar 02, 2008 4:18 pm

Hi I'm having some trouble, I'm creating the text file but only some of the fields are updating. For example I have a file called "01 - Bounce.mp3" and I have created "01 - Bounce.txt" the same directory. The text file has these lines:

Artist=Justin Timberlake featuring Timbaland, Missy Elliott & Dr. Dre
Title=Bounce
Album=Recrimination
Date=2008
Genre=R&B/Hip Hop

Now when I run the scipt only Genre and Title update, everything else stays the same. What am I doing wrong? Apart from listening to Justin Timberlake :oops:
estebanrey
 
Posts: 4
Joined: Wed Feb 20, 2008 12:57 pm

Postby trixmoto » Fri Mar 07, 2008 7:30 am

Very strange, I'm not sure. Which version of MM?
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Re: Txt Importer 1.1 [MM2+3]

Postby estebanrey » Sun Aug 17, 2008 12:04 pm

Media Monkey 3.0.3

I just don't unerstand why some of the fields update and some don't. I tried copying your example text and still no joy :(
estebanrey
 
Posts: 4
Joined: Wed Feb 20, 2008 12:57 pm

Re: Txt Importer 1.1 [MM2+3]

Postby trixmoto » Sun Aug 17, 2008 1:05 pm

You need to use the scripting name for the field, which might be different. Check out the wiki for the full list of fields.
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Re: Txt Importer 1.1 [MM2+3]

Postby estebanrey » Tue Aug 19, 2008 3:45 pm

Thanks for your help trix, sorry to be a pain but where is the wiki? Again appreciate your help, this should be an awesome tool for me in combinataion with your custom excel reports and Automate software to write txt files from the fields almost instantly.

If I can get this to work I'll be able to get my entire collection right very quickly! Great work, keep it up.
estebanrey
 
Posts: 4
Joined: Wed Feb 20, 2008 12:57 pm

Re: Txt Importer 1.1 [MM2+3]

Postby Bex » Tue Aug 19, 2008 3:54 pm

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
Bex
 
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Next

Return to Need Help with Addons?

Who is online

Users browsing this forum: No registered users and 16 guests