*For a full understanding of what I'm trying to do there is a post here also by me http://www.sevenforu...tml#post1903073
Originally I had 3 txt documents titled: GospelCountry, LatestAdditions & Bluegrass
I've copied all the songs into one document called 0Songs2Organize.txt.
This file has 1535 songs.....
As it stands I have 103 Artist .txt files (i.e. Alabama etc. etc.)
I need a simpler/faster way to go through 0Songs2Organize.txt, get the artist name & song because as of this moment I'm having to sit and read/search for the artist, song, copy & paste to the corresponding Artist.txt file then remove the "By "Artist"", turn everything to lowercase and remove all the spacing....manually . Using Notepad++ makes some of this easier but heh...not enough..
I've also tried grouping the songs by artist in the 0Songs2Organize.txt and then copying & pasting to the appropriate Artist.txt but again it's time consuming to cut 'n paste scrolling up and down 1500+ lines grouping by artist
Is there any way to ...for the lack of a better term "parse" the 0Songs2Organize.txt file so that it groups by the artist then I could just copy & paste to the correct Artist.txt file?
Any solution would probably be a better one than the way I'm currently having to do this so any feedback or help is appreciated.
-Note-
Uploaded 0Songs2Organize.txt & artist.zip (contains all current artist.txt files created) for examples (format example).[attachment=24:0Songs2Organize.txt]
[attachment=25:Artist.zip]
Help Needed w\ Semi Complex Script
Started by
Gunslinger2
, Apr 30 2012 07:17 PM
2 replies to this topic
#1
Posted 30 April 2012 - 07:17 PM
#2
Posted 30 April 2012 - 07:43 PM
The big problem with your file is that the artists are not easy to sort out. The number of words in the artist name aren't consistent and they are sometimes preceded by "by". The artist names may be something you'll have to find a way to sort out on your own, but once that's done it should be fairly easy. Take David Ball from your text file for example:
artist=david ball Loop, read, [color=#800000]<< file path to 0Songs2Organize.txt here >>[/color] [color=#00BF00]; loop through the text file[/color] if RegExMatch(A_LoopReadLine,"i)" artist "$") [color=#00BF00]; if the line ends with the artist name[/color] res .= RegExReplace(A_LoopReadLine,"i)(?: by)? " artist "$") "`n" [color=#00BF00]; add the song to a list with the artist designation removed[/color] MsgBox % RegExReplace(res,"\v+$") [color=#00BF00]; display the list of songs[/color]
#3
Posted 30 April 2012 - 08:32 PM
A little more testing with this code, which would pull out all artists who could be sorted by the preceding "by" on the line (requires AHK_L):
Reveals that it would get about 340 of the artists and their songs, but I say "about" because:
[*:1twgdl81]The script cannot discern a line with multiple artists.
[*:1twgdl81]The script cannot discern an alternate spelling or misspelling for an artist.
For example:
If being able to fix those kinds of errors manually is tolerable the above will cut a good chunk out of your list.
Loop, read, [color=#800000]<< file path to 0Songs2Organize.txt >>[/color]
if RegExMatch(A_LoopReadLine,"\bby\b")
artists .= RegExReplace(A_LoopReadLine,"^.*\bby\b ") "`n"
artists := Trim(artists)
Sort, artists, U
Loop, parse, artists, `n
{
songList := A_LoopField "`n"
Loop, read, [color=#800000]<< file path to 0Songs2Organize.txt >>[/color]
if RegExMatch(A_LoopReadLine,"i)" A_LoopField "$")
songList .= "`n" RegExReplace(A_LoopReadLine,"i)(?: by)? " A_LoopField "$")
MsgBox % songList
}Reveals that it would get about 340 of the artists and their songs, but I say "about" because:
[*:1twgdl81]The script cannot discern a line with multiple artists.
[*:1twgdl81]The script cannot discern an alternate spelling or misspelling for an artist.
For example:
alan jackson
murder on music row by george strait &
you've been lonesome too
turn your eyes upon jesus
when we all get to heaven
anita carter
tulsa county
in the highways
anita cater
the kentuckian song
b j thomas
somebody done somebody wrong
b.j. thomas
hooked on a feeling
i just can't help believing
most of all
new looks from an old lover
raindrops keep falling on my head
whatever happened to old fashion love
If being able to fix those kinds of errors manually is tolerable the above will cut a good chunk out of your list.




