INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Tagging from text files?  (Read 6830 times)

Fred1

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 491
  • Change this by choosing profile
Tagging from text files?
« on: March 06, 2013, 10:57:56 pm »

Is it possible to tag fields from fields in a text file?

Instead of "Fill properties from filename" i would like to fill my tags from a list which is located in a single text file where each line corresponds to one music file.

Let's say i have selected an album in MC and i have the tags for this album in a .txt file.
Can i apply that to my selected lines in the MC grid?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Tagging from text files?
« Reply #1 on: March 06, 2013, 11:41:53 pm »

Yes, if it is in the form of an mpl playlist.
Logged
The opinions I express represent my own folly.

Fred1

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 491
  • Change this by choosing profile
Re: Tagging from text files?
« Reply #2 on: March 06, 2013, 11:55:42 pm »

MrC,

thanks for the quick info!
Then i will see how to transform my flat text files to the mpl format.
Logged

yannis

  • World Citizen
  • ***
  • Posts: 229
Re: Tagging from text files?
« Reply #3 on: March 07, 2013, 12:02:10 am »

Yes, if it is in the form of an mpl playlist.

Would that rule out tagging video files? (I've never used an mpl list, it just looks like a good idea, if is possible.)
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Tagging from text files?
« Reply #4 on: March 07, 2013, 12:08:26 am »

Or you can create a sidecar for video when necessary.  They are straightforward XML files.  Tag a video and look at the sidecar produced, or export an audio file playlist and look at the mpl file.  Conversion should be just a couple of lines of code.  Ask if you need help.
Logged
The opinions I express represent my own folly.

Fred1

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 491
  • Change this by choosing profile
Re: Tagging from text files?
« Reply #5 on: March 07, 2013, 01:23:10 am »

Yes, if it is in the form of an mpl playlist.

I think playlists are not a solution for me because i only have Artist and Name fields in my flat text file like this:

1 - Tom Cat – Tom's Rag
2 - Werner Lämmerhirt – Transit Blues
3 - Davey Arthur – O'Carolan's Concerto
4 - Peter Bursch – House Carpenter
5 - Tom Paley – Wildwood Flower
6 - Manolo Lohnes – Ayer-Yesterday
7 - Klaus Weiland – Improvisation 2
8 - Howard Schultens – Lasses Dobro
.
.
.

There is no information where the file is located and what the filenames are.
So i can't import from a playlist.

Can i achieve the mapping otherwise?



Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Tagging from text files?
« Reply #6 on: March 07, 2013, 11:28:34 am »

Are your flat text files located in the same directory as the music?
Logged
The opinions I express represent my own folly.

Fred1

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 491
  • Change this by choosing profile
Re: Tagging from text files?
« Reply #7 on: March 07, 2013, 12:02:13 pm »

Yes, they come with the respective album.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Tagging from text files?
« Reply #8 on: March 07, 2013, 12:08:33 pm »

Please provide me with two samples of full paths to the directories containing the music, and also the listing of the music files themselves.  If the files can be easily matched, I'll provide you with a solution.

You'll have to download a free/easy scripting tool to accomplish the task (unless you have an system already that has the necessary software).
Logged
The opinions I express represent my own folly.

fitbrit

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4887
Re: Tagging from text files?
« Reply #9 on: March 07, 2013, 11:37:03 pm »

Please provide me with two samples of full paths to the directories containing the music, and also the listing of the music files themselves.  If the files can be easily matched, I'll provide you with a solution.

You'll have to download a free/easy scripting tool to accomplish the task (unless you have an system already that has the necessary software).

You're bloody amazing, MrC. Those steaks were well deserved!
Logged

Fred1

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 491
  • Change this by choosing profile
Re: Tagging from text files?
« Reply #10 on: March 08, 2013, 02:02:24 am »

MrC,

thanks for your offer!
I have thought again what would be the easiest way to tag my files.

The structure of  the directories where the files live varies very much.
There would be no easy rule to create.

But the only information that is really missing are the (title) Names within MC.
It would be easy to provide the titles on the clipboard, then selecting the first record, pushing F2 and filling the clipboard content one by one into the name fields.

Is there a chance to create a macro that fills the clipboard content to an MC field one by one?
Thanks for your help.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Tagging from text files?
« Reply #11 on: March 08, 2013, 02:40:08 am »

That's a lot of work.

MC has a copy / paste tags functionality, but it won't work from your text file.

Does MC's tracks numbers match the track numbers in your text file?  If so, it would be easy to rename the tracks based on the text file, and then ask grab the title using Fill properties from filename.
Logged
The opinions I express represent my own folly.

Fred1

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 491
  • Change this by choosing profile
Re: Tagging from text files?
« Reply #12 on: March 08, 2013, 03:24:10 am »

Quote
MC has a copy / paste tags functionality, but it won't work from your text file.
I suppose you can paste only one item at a time (not sequentially from the clipboard)?

Quote
Does MC's tracks numbers match the track numbers in your text file?
Yes, that's the case
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Tagging from text files?
« Reply #13 on: March 08, 2013, 03:37:04 am »

Ok, great.  See Reply 8.
Logged
The opinions I express represent my own folly.

Fred1

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 491
  • Change this by choosing profile
Re: Tagging from text files?
« Reply #14 on: March 08, 2013, 04:23:57 am »

The structure is as follows, as an example:

Content of C:\Music\Gary Moore\Blues For Jimi:

C:\Music\Gary Moore\Blues For Jimi\Gary Moore - Blues For Jimi - 01.mp3
C:\Music\Gary Moore\Blues For Jimi\Gary Moore - Blues For Jimi - 02.mp3
C:\Music\Gary Moore\Blues For Jimi\Gary Moore - Blues For Jimi - 03.mp3
C:\Music\Gary Moore\Blues For Jimi\Gary Moore - Blues For Jimi - 04.mp3
C:\Music\Gary Moore\Blues For Jimi\Gary Moore - Blues For Jimi - 05.mp3
C:\Music\Gary Moore\Blues For Jimi\Gary Moore - Blues For Jimi - 06.mp3
C:\Music\Gary Moore\Blues For Jimi\Gary Moore - Blues For Jimi - 07.mp3
C:\Music\Gary Moore\Blues For Jimi\Gary Moore - Blues For Jimi - 08.mp3
C:\Music\Gary Moore\Blues For Jimi\Gary Moore - Blues For Jimi - 09.mp3
C:\Music\Gary Moore\Blues For Jimi\Gary Moore - Blues For Jimi - 10.mp3
C:\Music\Gary Moore\Blues For Jimi\Gary Moore - Blues For Jimi - 11.mp3
C:\Music\Gary Moore\Blues For Jimi\Gary Moore - Blues For Jimi - 12.mp3
C:\Music\Gary Moore\Blues For Jimi\Titles.txt



Content of Titles.txt:

1 - Gary Moore – Purple Haze
2 - Gary Moore – Manic Depression
3 - Gary Moore – Foxy Lady
4 - Gary Moore – The Wind Cries Mary
5 - Gary Moore – I Don't Live Today
6 - Gary Moore – My Angel
7 - Gary Moore – Angel
8 - Gary Moore – Fire
9 - Gary Moore – Red House
10 - Gary Moore – Stone Free
11 - Gary Moore – Hey Joe
12 - Gary Moore – Voodoo Child (Slight Return)
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Tagging from text files?
« Reply #15 on: March 08, 2013, 10:37:00 am »

The script requires ActivePerl. Its free, safe, easy, and non-invasive to install. Get the 32- or 64- bit installer for your version of Windows.  Or you can use Cygwin tools.

This is a command line perl script.  It runs via a Windows command shell (cmd.exe) as follows:

   perl rename_from_titles.pl [-dv] path\to\Titles.txt

where the path to Titles.txt is replaced by the path to an album's folder where Titles.txt lives.

Use -d to see Debug output.  No action will be performed.
Use -v to see Verbose output.  Files will be renamed (unless -d), and the rename operation will show what it does.

Without options, the files will be renamed silently.

Code: [Select]
perl .\rename_from_titles.pl -v "Gary Moore\Blues For Jimi\titles.txt"
rename Gary Moore - Blues For Jimi - 01.mp3, 1 - Gary Moore û Purple Haze.mp3
rename Gary Moore - Blues For Jimi - 02.mp3, 2 - Gary Moore û Manic Depression.mp3
rename Gary Moore - Blues For Jimi - 03.mp3, 3 - Gary Moore û Foxy Lady.mp3
rename Gary Moore - Blues For Jimi - 04.mp3, 4 - Gary Moore û The Wind Cries Mary.mp3
rename Gary Moore - Blues For Jimi - 05.mp3, 5 - Gary Moore û I Don't Live Today.mp3
rename Gary Moore - Blues For Jimi - 06.mp3, 6 - Gary Moore û My Angel.mp3
rename Gary Moore - Blues For Jimi - 07.mp3, 7 - Gary Moore û Angel.mp3
rename Gary Moore - Blues For Jimi - 08.mp3, 8 - Gary Moore û Fire.mp3
rename Gary Moore - Blues For Jimi - 09.mp3, 9 - Gary Moore û Red House.mp3
rename Gary Moore - Blues For Jimi - 10.mp3, 10 - Gary Moore û Stone Free.mp3
rename Gary Moore - Blues For Jimi - 11.mp3, 11 - Gary Moore û Hey Joe.mp3
rename Gary Moore - Blues For Jimi - 12.mp3, 12 - Gary Moore û Voodoo Child (Slight Return).mp3

I've assumed mp3 files for now.  If you have other file types, or mixed file types in a folder, let me know and I'll update to make it work.

Once the files are renamed, MC will automatically pickup the new names and correct the broken file links, provided you have auto-import enabled for the folder and Fix broken links is enabled (these would be the defaults).  Once you see the new file paths in MC (look at the Filename column in a file list), you can now run Fill Properties from Filename with the appropriate template to grab the pieces from the file name.  Your example would use the file template:

   [track #] - [artist] – [name]

and folder template:

   [artist]\[album]

Note that the second "dash" in your example is really not an ASCII dash, so watch for that and be sure the template shows the correct data being pulled.

See attached screenshot.
Logged
The opinions I express represent my own folly.

Fred1

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 491
  • Change this by choosing profile
Re: Tagging from text files?
« Reply #16 on: March 08, 2013, 10:56:38 am »

MrC, you are great!

Thank you very, very much for your efforts.
I will try this and report back.

The only problem i have now: i can't find your perl script - did i miss it?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Tagging from text files?
« Reply #17 on: March 08, 2013, 11:00:51 am »

It is in the zip file attached.
Logged
The opinions I express represent my own folly.

Fred1

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 491
  • Change this by choosing profile
Re: Tagging from text files?
« Reply #18 on: March 08, 2013, 11:04:55 am »

Ok, i was overlooking this link - thanks for your hint.
Logged
Pages: [1]   Go Up