|
MilesAhead
|
 |
« on: December 07, 2010, 07:39:39 PM » |
|
I'm looking for an easy way to total the track times of albums listed on AllMusic.com.
The track times are on the right using mm:ss format as in 7:55 but I don't see a way to column select with chromium.
The only time calculator that comes close is the old AddTime. But it only accepts either '.' or ',' as the separator. So I have to block select in Chromium, paste into an editor that does right justify paragraph, line up the numbers by padding with zeros manually, column select and copy to clipboard, then AddTime will allow pasting.
Ideally something would read the clipboard, get the times from the end of each line, do the math, and pop up a total. The display of the total can be a simple MsgBox. I don't care about being able to copy and paste the result. One total time is no hassle to type. But if a nicer display is more pleasing to the author that's fine with me.
Perhaps an .ini file with an option for minutes/seconds separator would make it more generally useful. But I think most music sites give the times as MM:SS.
AddTime lets you enter using the number keypad but if there's more than 4 or 5 tracks it can be tedious.
|
|
|
|
« Last Edit: December 07, 2010, 07:45:01 PM by MilesAhead »
|
Logged
|
"I can't speak to anyone anywhere because I flunked Esperanto." -- MilesAhead
|
|
|
|
Renegade
|
 |
« Reply #1 on: December 07, 2010, 09:37:33 PM » |
|
Can you remind me about this on December 18th? (I'm out of the country for a while and can't get to doing anything like this right now.) This is some of the kind of stuff that I love doing. Yes... I have a sick addiction to date and time calculations and manipulation... I've posted some code here: http://kewlaid.net/2010/1...-a-mac-and-no-time-count/The post is NSFW though, but the code works -- a quick hack to add times for songs. Not sure if it will be useful for you at the moment, but do remind me later and I'll get something done.
|
|
|
|
|
Logged
|
|
|
|
|
skwire
|
 |
« Reply #2 on: December 07, 2010, 09:50:00 PM » |
|
Renegade, you mind if I whip this up quickly for MilesAhead?
|
|
|
|
|
Logged
|
|
|
|
|
|
skwire
|
 |
« Reply #3 on: December 07, 2010, 11:41:53 PM » |
|
I have this finished. I made it so it will RegEx match the timestamp out of the line automatically. In other words, you can simply paste in the AllMusic block of text and it will spit out the total without you having to format the data at all. My RegEx strings will match the following timestamp formats: One caveat is that the I only match the first timestamp occurrence in a line. So, if a line contains two timestamps, only the first one is matched. Here's a screenshot showing a direct paste from an AllMusic page: http://skwire.dcmembers.c...ps/snacks/HarvestTime.zip
|
|
|
|
« Last Edit: December 19, 2010, 10:33:45 AM by skwire »
|
Logged
|
|
|
|
|
SleepingWolf
|
 |
« Reply #4 on: December 08, 2010, 12:32:26 PM » |
|
As per tradition, what would you like to name this?
A collection (of people at least) can be called a party. So I suggest you call it (ahem) PartyTime!!!
|
|
|
|
|
Logged
|
-------------------------------------------
Choose life -or at least respect it.
|
|
|
|
mouser
|
 |
« Reply #5 on: December 08, 2010, 12:50:41 PM » |
|
MilesOfTime?
|
|
|
|
|
Logged
|
|
|
|
|
|
|
cranioscopical
|
 |
« Reply #7 on: December 08, 2010, 01:37:16 PM » |
|
|
|
|
|
|
Logged
|
Chris
|
|
|
|
skwire
|
 |
« Reply #8 on: December 08, 2010, 02:45:51 PM » |
|
Oooh, I like. 
|
|
|
|
|
Logged
|
|
|
|
|
MilesAhead
|
 |
« Reply #9 on: December 08, 2010, 03:25:12 PM » |
|
Thanks skwire. I'll try it out right away. Harvest Time sounds cool to me too. @Renegade feel free to post your take when you have time(no pun intended.) I like to have more than one tool for a job. edit: skwire this is perfect!! About as easy as it could be!! Thanks. 
|
|
|
|
« Last Edit: December 08, 2010, 03:30:52 PM by MilesAhead »
|
Logged
|
"I can't speak to anyone anywhere because I flunked Esperanto." -- MilesAhead
|
|
|
|
Target
|
 |
« Reply #10 on: December 08, 2010, 04:45:17 PM » |
|
do you use any other sites besides allmusic?
|
|
|
|
|
Logged
|
"Look wise, say nothing, and grunt. Speech was given to conceal thought" - Sir William Osler
|
|
|
|
MilesAhead
|
 |
« Reply #11 on: December 08, 2010, 09:18:24 PM » |
|
do you use any other sites besides allmusic?
No other site in particular. If I can't find the info at AllMusic then I'll just search. Usually something pops up like Borders or Amazon that has the track times.
|
|
|
|
|
Logged
|
"I can't speak to anyone anywhere because I flunked Esperanto." -- MilesAhead
|
|
|
|
Target
|
 |
« Reply #12 on: December 08, 2010, 11:51:30 PM » |
|
no guarantee's, but try this AHK script [ copy or print] #singleinstance #persistent loop { if clipboard contains http://www.allmusic.com gosub, parse } Return Parse: mins:= Secs:= tmp:= tracks:= TCnt:=0 urldownloadtofile, %clipboard%, c:\temp\temp.html if errorlevel { msgbox, there was an error and the file was not downloaded clipboard:= return } loop, read, c:\temp\temp.html { if a_index > 200 { if a_loopreadline contains listen now { filereadline, tmp, c:\temp\temp.html, a_index+5 stringtrimleft, tmp, tmp, 49 stringtrimright, tmp, tmp, 5 stringsplit, tmp_, tmp, : if tmp_2 { mins+= tmp_1 secs+= tmp_2 } else secs+= tmp_1 tmp_1:= tmp_2:= if Tracks tracks.= "`n" TCnt+=1 tracks.= "Track " . tcnt . " - " . tmp } } if a_loopreadline contains <!-- End Tracks Table --> { mins+= floor(secs/60) secs:= mod(secs,60) clipboard:= mins . ":" . secs msgbox, %tracks%`n`nTotal - %mins%:%secs% Break } } return First up I'm behind a corporate firewall so I can't test it properly at the moment but it is working fine with local copies run the script, then when you're on the relevant page, copy the URL. The script should retrieve the url from the clipboard, download and parse the file, do the math, then copy the result to the clipboard and popup a messagebox with the results (note that the script stays resident and only kicks in when there's a URL in the clipboard) At the moment it's only set up for AllMusic.com, but I assume it could be extended to cover other sites EDIT: amended the URL filter to limit the response to allmusic.com only
|
|
|
|
« Last Edit: December 09, 2010, 10:20:01 PM by Target »
|
Logged
|
"Look wise, say nothing, and grunt. Speech was given to conceal thought" - Sir William Osler
|
|
|
|
MilesAhead
|
 |
« Reply #13 on: December 09, 2010, 12:37:13 AM » |
|
All I get is "there was an error and the file was not downloaded". I appreciate the effort. In this instance it feels like the block copy from the page is a better approach. At least for me, since I have AutoCopy. Just drag the mouse and let go, then paste in skwire's app. To get the url in the clipboard I have to highlight then control-c. Plus I do too much url copy/paste to leave it resident. My Selector program launches stuff with selected text so I tend to use that a lot. Don't know why it didn't download. I tried copying the url to the clipboard 3 or 4 times. edit: This is the url I used for test: http://www.allmusic.com/album/kind-of-blue-r104440I'm not that much of a web programmer so I'm not sure exactly what's considered a "file" and what's some dynamically generated mumbo jumbo. It's not my area.
|
|
|
|
« Last Edit: December 09, 2010, 12:49:44 AM by MilesAhead »
|
Logged
|
"I can't speak to anyone anywhere because I flunked Esperanto." -- MilesAhead
|
|
|
|
Target
|
 |
« Reply #14 on: December 09, 2010, 01:03:23 AM » |
|
All I get is "there was an error and the file was not downloaded".
I appreciate the effort. In this instance it feels like the block copy from the page is a better approach. At least for me, since I have AutoCopy. Just drag the mouse and let go, then paste in skwire's app. To get the url in the clipboard I have to highlight then control-c. Plus I do too much url copy/paste to leave it resident. My Selector program launches stuff with selected text so I tend to use that a lot.
Don't know why it didn't download. I tried copying the url to the clipboard 3 or 4 times. not a problem, thanks for trying (I'll have a bit more of a game with it anyway and see if I can work out what the issue is)
|
|
|
|
|
Logged
|
"Look wise, say nothing, and grunt. Speech was given to conceal thought" - Sir William Osler
|
|
|
|
cranioscopical
|
 |
« Reply #15 on: December 09, 2010, 09:49:59 AM » |
|
Using your page link above, Miles, I get the can't download file error immediately because that URL is already on my clipboard. But then, if I select and copy the url from the address bar, I get this  almost immediately! Of course, it would be better if the numbers were right justified but I suppose Target is doing his best
|
|
|
|
|
Logged
|
Chris
|
|
|
|
MilesAhead
|
 |
« Reply #16 on: December 09, 2010, 11:54:13 AM » |
|
@cranioscopical
I cleared the clipboard, then copied. No matter what I get the error.
edit: I don't know if it matters, but I'm running Chromium. I think it has issues with the cache. I tried downloading a file from my site and kept getting the old version until I cleared the cache. Weird.
But even so, I often highlight the address bar and then launch Selector to open the page with another browser. Selector messes with the clipboard, saving current, then copying selected, then putting contents back, so it would just be havoc.
Target's utility looks cool though. Good for someone with a different usage habits.
|
|
|
|
« Last Edit: December 09, 2010, 11:59:29 AM by MilesAhead »
|
Logged
|
"I can't speak to anyone anywhere because I flunked Esperanto." -- MilesAhead
|
|
|
|
cranioscopical
|
 |
« Reply #17 on: December 09, 2010, 12:06:45 PM » |
|
I don't know if it matters, but I'm running Chromium. I think it has issues with the cache. I tried downloading a file from my site and kept getting the old version until I cleared the cache. Weird.
Gotcha… I was posting more to say what happens when I try it here. Also, I should have specified that I was using Firefox.
|
|
|
|
|
Logged
|
Chris
|
|
|
|
Target
|
 |
« Reply #18 on: December 09, 2010, 04:47:00 PM » |
|
Of course, it would be better if the numbers were right justified but I suppose Target is doing his best such as it is... Good for someone with a different usage habits seemed like an easier approach than copying and pasting the records individually (which is what i thought you were doing) it was a first cut - I originally considered monitoring the browser window, but there were too many variables for the amount of time I had spare (FYI I modified the monitored URL string to include allmusic.com which should exclude urls for other sites) glad to hear that it does work for someone though...
|
|
|
|
|
Logged
|
"Look wise, say nothing, and grunt. Speech was given to conceal thought" - Sir William Osler
|
|
|
|
MilesAhead
|
 |
« Reply #19 on: December 09, 2010, 06:20:48 PM » |
|
it was a first cut - I originally considered monitoring the browser window, but there were too many variables for the amount of time I had spare (FYI I modified the monitored URL string to include allmusic.com which should exclude urls for other sites)
glad to hear that it does work for someone though...
It's interesting to see different takes on the same problem. Because I know that AddTime will accept a column of times pasted I didn't even consider regex as an approach. I started looking for a column selection chromium extension. 
|
|
|
|
|
Logged
|
"I can't speak to anyone anywhere because I flunked Esperanto." -- MilesAhead
|
|
|
|
Target
|
 |
« Reply #20 on: December 15, 2010, 09:22:53 PM » |
|
@cranioscopical
I cleared the clipboard, then copied. No matter what I get the error.
edit: I don't know if it matters, but I'm running Chromium. I think it has issues with the cache. I tried downloading a file from my site and kept getting the old version until I cleared the cache. Weird.
But even so, I often highlight the address bar and then launch Selector to open the page with another browser. Selector messes with the clipboard, saving current, then copying selected, then putting contents back, so it would just be havoc.
Target's utility looks cool though. Good for someone with a different usage habits. I meant to ask this the other day, but forgot... is there a particular reason why you need to copy and sum the track times? reason I ask is that AllMusic lists the total run time in the summary section (although to be fair there was a 10 second discrepancy in my test page)
|
|
|
|
|
Logged
|
"Look wise, say nothing, and grunt. Speech was given to conceal thought" - Sir William Osler
|
|
|
|
MilesAhead
|
 |
« Reply #21 on: December 16, 2010, 11:42:16 AM » |
|
Never really noticed it.  I guess it would be cheating them making it that easy.  Still, it's a good thing to have for other lists that don't display a sum.
|
|
|
|
|
Logged
|
"I can't speak to anyone anywhere because I flunked Esperanto." -- MilesAhead
|
|
|
|
skwire
|
 |
« Reply #22 on: December 19, 2010, 10:38:50 AM » |
|
|
|
|
|
|
Logged
|
|
|
|
|
MilesAhead
|
 |
« Reply #23 on: December 20, 2010, 01:41:23 PM » |
|
Thanks for the program skwire, and to all who contributed code and suggestions.
|
|
|
|
|
Logged
|
"I can't speak to anyone anywhere because I flunked Esperanto." -- MilesAhead
|
|
|
|
skwire
|
 |
« Reply #24 on: December 20, 2010, 01:49:51 PM » |
|
You're welcome. Happy holidays. 
|
|
|
|
|
Logged
|
|
|
|
|