luoto Registered: 02/16/09
Posts: 9
|
|
| |
Reply with quote | #1 | Hi. For a cataloguing system I am manually needing to get some data from various CDs stored within ITUNES.
(The workflow generally is rather messy
I have cut and paste the data from Itunes into Numbers and have a formula to add a track number and to add the duration at the end (not found a cleaner way yet:
i.e.
16.Shoreside Atmosphere, With Lapping Water, Passing Boats, Distant Voices And Traffic Skyline -04.51
17.Ferry Boarded (Gatala Bridge To Uskudar), Voices And Clattering Boarding Ramps -01.28
18.Ferry Starts Into Constant Run, Exterior Acoustic With Occasional Ship's Siren, Arrives Uskudar, Ramps Lowered -07.37
Now I can see the cleanup rules which are nice but I need to get ALL this track information in turn into one cell.
I cannot see how to remove the ONE carriage return between each track and I would like to also insert a space so my shopping list is (looking at the example text given)
ADD a / before the track number (16, 17, 18 in other words start of line).
ADD a space after the time (I could amend Numbers but not for old data)
Delete the carriage return.
So I would end up with:
/16.Shoreside Atmosphere, With Lapping Water, Passing Boats, Distant Voices And Traffic Skyline -04.51 /17.Ferry Boarded (Gatala Bridge To Uskudar), Voices And Clattering Boarding Ramps -01.28 /18.Ferry Starts Into Constant Run, Exterior Acoustic With Occasional Ship's Siren, Arrives Uskudar, Ramps Lowered -07.37
Could someone kindly give me some pointers, as a textsoap newbie, to this aim please So far my trails have not been favourable.
Darren |
| Loading... | | |
GeorgetheFlea

Registered: 03/12/07
Posts: 54
|
|
| |
Reply with quote | #2 | If you can get your data into some text-only format (tab or comma separated values, for instance) then it'll be a lot easier to handle with Textsoap.
I would do this particular task with a custom cleaner and a regex find/replace rule (you'll probably only need one rule for the main logic, although you might want to run some of the packaged cleaners to make sure everything is formatted nicely).
If you'd like specific help on the regex, please attach a text file with a small sample of the comma-separated values (or whatever you use to get the Numbers data into straight text). __________________ George the Flea
Tagamac :: One Crayon :: Beckism.com |
| Loading... | | |
unmarked

Moderator
Registered: 01/15/07
Posts: 278
| |
luoto Registered: 02/16/09
Posts: 9
|
|
| |
Reply with quote | #4 | Firstly, thank you for the various responses and my apologies due a delayed response (due to wife's illness).
I could not get the suggested option to work.
Maybe it helps if I explain the "work flow" first.
1. Insert CD
2. Itunes finds track information via Gracenote (OR manually select disk information from archive).
3. Select desired records. COPY
4. Paste into empty Numbers document.
5. Cut columns with track name and duration.
6. Paste into other Numbers document in fields (document has other fields for track number and to automate the merging of track number to track title and duration.
So it is here where I get the data (col D). Plan was then select the composite cell with the information in, take to text soap and get the desired extract:
/1. Title name -xx.xx /2. Title name -xx.xx (ALL on one line).
But I am not having any luck. Could not even see how to just delete on CR :;(
Any help welcomed as I have several thousand CDs to catalogue for a reference work!
Darren
(two files in zip. One "Numbers" format and the same in "Excel 08" export format from numbers
http://www.unmarked.com/forum_archive_files/Archive02.zip |
| Loading... | | |
GeorgetheFlea

Registered: 03/12/07
Posts: 54
|
|
| |
Reply with quote | #5 | Hey Darren,
Attached is a cleaner that uses a more specific regex than the one Mark provided based on your example Numbers file. To use it, you'll need to merge all your cells in column D into a single cell (I don't know of any way to have TextSoap parse a table). Then you should be able to run the cleaner to convert the track list into a single line formatted the way you listed.
You may need to tweak the regex if something unexpected crops up. It handled the unicode characters just fine for me, but if a track had an apostrophe or something in it the cleaner might stumble.
Good luck! Drop a line if you need more help or aren't sure how to tweak the regex.
http://www.unmarked.com/forum_archive_files/iTunes_track_cleanup.tscleaner.zip __________________ George the Flea
Tagamac :: One Crayon :: Beckism.com |
| Loading... | | |
luoto Registered: 02/16/09
Posts: 9
|
|
| |
Reply with quote | #6 | Thanks. I hope to check shortly (wife been quite ill so things are delaying everything). I will revert but thank you kindly for your help- |
| Loading... | | |
luoto Registered: 02/16/09
Posts: 9
|
|
| |
Reply with quote | #7 | Hi there. I could not get this to do the job.
Might it be easier to take this to email ? If you are happy with that would you like to give me an address or drop me a line: darren at ingram dot fi
Many thanks for your kind help Darren |
| Loading... | | |
unmarked

Moderator
Registered: 01/15/07
Posts: 278
|
|
| |
Reply with quote | #8 | The purpose in using the forums is to allow others to benefit from the discussion and to allow other ideas to come in (like how GeorgetheFlea expanded on my solution).
Quote: I could not get this to do the job.
Could you be more specific? We need to know how it is failing.
Is it failing on some cases or all cases?
What ARE the results you're seeing?
|
| Loading... | | |
luoto Registered: 02/16/09
Posts: 9
|
|
| |
Reply with quote | #9 | Thank you for the response. No discourtesy was intended (I was thinking that my request(s) were getting too out of focus or specialist for the forum). I am more than happy to answer here.
Firstly, and separately, I will not pretend that I understand this programming lark and it is clear I am looking for a "point, click" type solution so I am grateful that those with greater "programmer heads" than I are willing to help.
I would have a few different work flow type things to make my forthcoming work easier (I am partially sighted so anything that makes my work a bit easier is needed so should there be someone willing to help write a few bits / hold my hand a bit for a "modest fee" that would be appreciated as I don't want to overstay my welcome with only "Can someone do X" for me requests with no realistic ability to contribute back (other than, maybe, finding more fiendish programming challenges !!?!)
Anyway, back first to this query. I had someone take another look with me and it became a lot clearer. I did not see the merge cells option first
To use the example dataset (numbers version) once the merged cell is there I needed to copy it to a plain text Textedit window first otherwise there's an embedded table inside the clipboard version (anyway to remove that step, trying the remove text from html option didn't help in Textsoap).
Once I had true plain text inside Textedit (and Textsoap) for some reason there is a quote ( " ) mark at the start and end of the file. Is there a way to get rid of that? (I think they come from the sum of cols. B and C to get the time information next to track but cannot be sure.
Since there's a spreadsheet formula to calculate this unused fields also have formulas that generate (each line) the following text in ASCII afterwards ". -" Would it be possible to get rid of these unused ones in the clean up process?
Then running the kindly provided Textsoap script this all kindly works (subject to the foregoing). Would it be possible to change the code that instead of applying one slash (/) it applies two slashes (//). ie //1. //2. ) I am thinking that in the future if this is then imported into another program it is safer to rename two slashes to say a carriage return or other formatting character instead of killing a track called "Rock/Beats" 
So thank you all for the kind help so far, and hopefully for that in the future. And if anyone has thought to the "other assistance" as required I'd greatly appreciate it.
Thanks, Darren
|
| Loading... | | |
GeorgetheFlea

Registered: 03/12/07
Posts: 54
|
|
| |
Reply with quote | #10 | Hey Darren,
Adding a second slash is easy. You can do this yourself, actually:
1) In TextSoap, choose Window => Custom Cleaner Editor
2) Select your iTunes cleaner from the list (might be the only one)
3) In the middle area, there should be one custom action. Ignore the "Find:" box, and in the "Replace With:" box change the first backslash to two so that you end up with this:
That should do it for the double backslash.
For the other issues, can you upload a file that has the quotes at the beginning and end with extra '.-'? It'd be easier to construct the cleaner with an example to test it on, and the original example didn't appear to have these problems. __________________ George the Flea
Tagamac :: One Crayon :: Beckism.com |
| Loading... | | |
luoto Registered: 02/16/09
Posts: 9
|
|
| |
Reply with quote | #11 | Hi again.
I rewrote the spreadsheet, updated to the latest version of textsoap and tried again (albeit with a different cd, so unless it is character specific....) and the problem is away. Also now got the double quotes.
Is there a command to strip all formattng (the ones I tried did not seem to work) as if I paste a series of cells OR a merged cell into textedit in rich text (or into textsoap) it keeps table formatting. So I need to so far go to textedit in plain text to remove it and then copy and paste into textsoap...
But for some reason I am getting "corruption" on the time element now.
(Here is what I get when pasted PRE textsoap from Numbers and into Textedit:
1. Cliffhanger (Main Title/Rabbit Hole/End Ttitle) -05.54
2. Bear Island (Main Title) -03.44
3. Flight Of The Intruder (Finale) -02.12
etc ...
and when pasted into textsoap and the script run:
1. Cliffhanger (Main Title/Rabbit Hole/End Ttitle) -//05. 54 //2. Bear Island (Main Title) -03.44 //3. Flight Of The Intruder (Finale) -02.12
(i.e. see the end of track 1 which adds two slashes before the -05. but it does not do this for track 2 etc.
Attached is the numbers spreadsheet it was copied from and the text edit file. Many thanks ! Darren
http://www.unmarked.com/forum_archive_files/Archive.zip |
| Loading... | | |
luoto Registered: 02/16/09
Posts: 9
|
|
| |
Reply with quote | #12 | Has anyone any thoughts how to fix this?
And also are there any persons who do a small bit of textsoap "programming" for some beer or other tokens ?
The piles of CDs are frowning at me 
|
| Loading... | | |
unmarked

Moderator
Registered: 01/15/07
Posts: 278
|
|
| |
Reply with quote | #13 | I've tried to understand the problem you were working with better. While it may be easiest to just put it in context of TextSoap, I really felt like the path you might be taking is more complicated than it needs to be.
I wrote up a script for you. It takes the current selection in of iTunes and builds the playlist as you described it. It doesn't require any use of TextSoap at all. It simply takes the name and duration, calcs the track # and then spits it out in one string, copying it to the clipboard.
This might work as a more streamlined solution for you.
http://www.unmarked.com/forum_archive_files/Build_Play_List.scpt.zip |
| Loading... | | |
luoto Registered: 02/16/09
Posts: 9
|
|
| |
Reply with quote | #14 | Hi there.
That looks perfect! A large thank you.
What may I do to repay you for your kind assistance ?
And whilst I have the begging bowl out this time, would it be possible to tell me how it is done (or kindly give me a version that has the artist name as well (i.e. track name followed by a slash and then the artist name) and then the same as you've done with the duration (so I can have the best of both worlds dependent on the need when there is a compilation of different artists)?
1. In Dulci Jubilo/Mike Oldfield -03:51 // 2. Wonderful Land/Artist is Here -03:51 // 3. Portsmouth/Another Artist -02:02 // 4. Vivaldi Concerto In C/Last Artist -04:53
I wish I could program
BW Darren |
| Loading... | | |
unmarked

Moderator
Registered: 01/15/07
Posts: 278
|
|
| |
Reply with quote | #15 | Sounds like I should start up a consulting arm of the company. 
I've attached a modified version of the script. The script can be opened with the /Applications/AppleScript/Script Editor if you want to look at the steps. If you think about the discrete steps you would do manually to mimic the script, it should read in an almost natural way.
You can create variations of the script by making a copy of the script fie, opening it in the Script Editor and then:
Change:
set showArtist to true
to
set showArtist to false
to not include the artist name.
Change:
set showDuration to true
to
set showDuration to false
to not include the duration.
http://www.unmarked.com/forum_archive_files/Build_Play_List_2.scpt.zip |
| Loading... | | |
luoto Registered: 02/16/09
Posts: 9
|
|
| |
Reply with quote | #16 | Thank you I have ordered a book about Applescript also to try and see if I can understand this. It looks very powerful. Many thanks once again for your very kind help.
!Darren |
| Loading... | | |
unmarked

Moderator
Registered: 01/15/07
Posts: 278
|
|
| |
Reply with quote | #17 | Glad to help. And remember, you can take also advantage of TextSoap within an AppleScript as well. Starting with TextSoap 6.1, you can just do something like:
Code: set TextSample to "My Text"
tell application "textsoapAgent"
set ResultText to cleanText TextSample with "Convert to Uppercase"
end tell
Where TextSample represents the text you want to clean and you provide the full English cleaner name as seen in the palette.
Also check out http://macscripter.net -- it's a great place for additional AppleScript info.
|
| Loading... | | |