Welcome Guest

Pages: 1 2
Request: import titles from text file
ratmicePostMay 31, 2015, 08:44
Newbie
Posts: 21
Registered:
December 23, 2014, 21:35
Hot topicRequest: import titles from text file

So, Im new to YATE and like it very much. My main use is for tagging a large collection of live recordings. These recordings do not typically come with properly named files, or properly tagged. They do , however, usually come with a text file that contains the set list.

If there were a feature that would allow importing of filenames from a text file this would certainly make the tagging process tons easier. I have used software previously that had this capability. It would import titles, one line at a time, from a list (a text entry box that was temporarily saved). With a little cut/paste and editing, you could rename files in a flash. This would be a great help. Maybe, some kind of "import titles from selection could be used too.

2MR2PostMay 31, 2015, 10:18
Administrator
Posts: 1680
Registered:
August 23, 2012, 19:27
Hot topicRe: Request: import titles from text file

Yate can read, write and parse any text file.

I've taken you literally and posted an action here:

http://2manyrobots.com/actions/ImportTitlesFromTextFile.zip

It's a little overkill but what the heck. Unzip the file and drag the 'Import Titles from Test File.plist' file to Yate's main window file list area. You should then have an action named: Import Titles from Test File

The action prompts for a text file, removes all blank lines from the content and applies the titles to the selected files (in the order listed in the main window). The action validates that the number of contained titles is the same as the number of selected files. I'm assuming that the file selection lists the files in the correct order. You can always drag and drop them to change the order. Note that the action does not save the files so you're not committed. You can always revert the changes if you're not happy.

If you want something more visual, the upcoming v3.7 will support prompting/editing of multi-line text as opposed to a single line. This will enable the changing of the action to present the list of titles which you could then rearrange.

ratmicePostMay 31, 2015, 11:43
Newbie
Posts: 21
Registered:
December 23, 2014, 21:35
Hot topicRe: Request: import titles from text file

Wow. Thanks so much. I will definitely give it a try. The new version sounds great, too. As a new user, I have yet to dig into rolling my own actions, but I guess there's no time like the present.

-a humble new YATE user

ratmicePostMay 31, 2015, 12:29
Newbie
Posts: 21
Registered:
December 23, 2014, 21:35
Hot topicRe: Request: import titles from text file

For those other new users out there that may want to use this. I had to go into the Actions Menu and access the action manager and tick the 'All Files' box to get the initial file selection dialog to appear.

It works as advertised. Thanks again.

rocklobsterPostJune 20, 2015, 18:23
Beginner
Posts: 25
Registered:
May 29, 2015, 09:15
Hot topicRe: Request: import titles from text file

Very useful. (I used to do the same with A Better Finder Rename and then used Media Rage to process file names to tags.)

But it is limited to each line containing a title. How would you handle a text file that contained, for instance:

01. title1
02. title2

or :

01 title1
02 title2

these are common scenarios.

I wonder if and how the extract titles inline action could be more general. is there any way to past the text through a file to tag template, specifically?

2MR2PostJune 20, 2015, 21:38
Administrator
Posts: 1680
Registered:
August 23, 2012, 19:27
Hot topicRe: Request: import titles from text file

You can't pass arbitrary text though an FTT template.... although I have toyed with the idea. However, the Scanner statement offers a larger degree of programmability so that you could easily write a single extraction to handle both the above scenarios.

For example, assuming the field was in Variable 1, the following code snippet would handle both cases. If there is no leading number, it assumes that only a title is present.

Scan integer in field Variable 1 (ignore SP), result to Variable 2 remainder to Variable 1. Set state
if true
Copy the Variable 2 field to the Track field
Scan string "." in field Variable 1, result to Variable 2 remainder to Variable 1. Set state
endif
Trim Variable 1 (SP) [Leading] [Trailing]
Copy the Variable 1 field to the Title field

I've seen actions where successive lines contain multiple fields:

title
artist
album
title
artist
album
...

I've even seen an action which reads the fields where they're tagged:

title=....
artist=....
album=.....
----
artist=...
album=...
title=...

The desire to implement the above scenario led to the introduction of the Indirect option on the Run statement a few versions back.

rocklobsterPostJune 21, 2015, 01:26
Beginner
Posts: 25
Registered:
May 29, 2015, 09:15
Hot topicRe: Request: import titles from text file

However, the Scanner statement offers a larger degree of programmability so that you could easily write a single extraction to handle both the above scenarios.

Yes, it does, and you could. Perfect! Implementing that handles all three of the above scenarios: lines with only title, lines with "number title" ("number<space>title") and lines with "number. title" ("number<period><space>title"). Thanks again.

FYI I made two variants with this addition, one with the prompt for file at the top as you had it, and a second without the prompt for file, but just uses "read file" to load a text file at a static path, such as: /PATH/TO/fl-temp.txt. That way you skip the file dialog, and just copy and paste the title lines into that static text file as needed for each album you need to process this way.

(Super convenient… I'm well on my way to reducing the apps I use to manage audio files significantly, as Yate cuts out one outlying scenario that required fiddling in multiple apps after another… Now if there were a way to do the same with text on the clipboard, that could avoid loading files altogether… hmm… I'll be stunned if there isn't…)

2MR2PostJune 21, 2015, 06:19
Administrator
Posts: 1680
Registered:
August 23, 2012, 19:27
Hot topicRe: Request: import titles from text file

I've run into this on myself, wishing that files did not have to be loaded to run an action. However, the entire action mechanism always assumes that it is working on a 'current' file. Far too much would break by eliminating the requirement.

rocklobsterPostJune 21, 2015, 07:07
Beginner
Posts: 25
Registered:
May 29, 2015, 09:15
Hot topicRe: Request: import titles from text file

damn, do neither of us ever sleep? 😉

puzzled by this response tho. the actions operate on a current file, meaning the audio file and it's metadata. but what about a text source? the import action you give says:

Read Text File "\v1" into named variable 'contents'

I changed this to:

Text from Clipboard to named variable 'contents' (all)

Seems to work just as expected. That saves a step, as typically the workflow for this would be to copy and paste the track info data from some kind info file to a temp file. Now I can just copy the data and run the action. No intermediate file needed.

2MR2PostJune 21, 2015, 07:12
Administrator
Posts: 1680
Registered:
August 23, 2012, 19:27
Hot topicRe: Request: import titles from text file

I misunderstood what you meant.... not enough sleep 🙂

You can read and write text from the system clipboard. I thought you wanted to process clipboard text without using any audio files. The action mechanism has become so powerful that I sometimes find I'm using it to do stuff I would do elsewhere.

Pages: 1 2
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.149 seconds.