Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • September 02, 2015, 09:29:22 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: Time Calculator that accepts a column paste of mm:ss  (Read 10733 times)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 6,195
    • View Profile
    • Miles Ahead Software
    • Donate to Member
DONE: Time Calculator that accepts a column paste of mm:ss
« 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 »

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 12,787
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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/2...c-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.
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,393
    • View Profile
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« Reply #2 on: December 07, 2010, 09:50:00 PM »
Renegade, you mind if I whip this up quickly for MilesAhead?

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,393
    • View Profile
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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:

  • x:xx:xx
  • xx:xx:xx
  • x:xx
  • xx:xx

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:

2010-12-07_233919.pngDONE: Time Calculator that accepts a column paste of mm:ss

http://skwire.dcmemb...acks/HarvestTime.zip
« Last Edit: December 19, 2010, 10:33:45 AM by skwire »

SleepingWolf

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 107
    • View Profile
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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!!!  :)
-------------------------------------------

Choose life -or at least respect it.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 34,995
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« Reply #5 on: December 08, 2010, 12:50:41 PM »
MilesOfTime?

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,393
    • View Profile
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« Reply #6 on: December 08, 2010, 01:14:57 PM »
For the time being, I just left it as TimestampCalc.  Renamed to Harvest Time.  Here's the download:

http://skwire.dcmemb...acks/HarvestTime.zip
« Last Edit: December 19, 2010, 10:34:22 AM by skwire »

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,302
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« Reply #7 on: December 08, 2010, 01:37:16 PM »
For the time being, I just left it as TimestampCalc.  Here's the download:

http://skwire.dcmemb...ks/TimestampCalc.zip

Harvest Time?

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,393
    • View Profile
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« Reply #8 on: December 08, 2010, 02:45:51 PM »
Oooh, I like.   :D

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 6,195
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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 »

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,500
    • View Profile
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« Reply #10 on: December 08, 2010, 04:45:17 PM »
do you use any other sites besides allmusic?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 6,195
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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.

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,500
    • View Profile
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« Reply #12 on: December 08, 2010, 11:51:30 PM »
no guarantee's, but try this AHK script

Code: [Select]
#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 »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 6,195
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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....kind-of-blue-r104440

I'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 »

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,500
    • View Profile
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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)


cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,302
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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

Target.png

almost immediately!

Of course, it would be better if the numbers were right justified but I suppose Target is doing his best

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 6,195
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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 »

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,302
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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.

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,500
    • View Profile
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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...


MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 6,195
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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. :)


Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,500
    • View Profile
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 6,195
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« 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.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,393
    • View Profile
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« Reply #22 on: December 19, 2010, 10:38:50 AM »
I updated the name and links:  http://skwire.dcmemb...acks/HarvestTime.zip

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 6,195
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« Reply #23 on: December 20, 2010, 01:41:23 PM »
Thanks for the program skwire, and to all who contributed code and suggestions.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,393
    • View Profile
    • Donate to Member
Re: Idea : Time Calculator that accepts a column paste of mm:ss
« Reply #24 on: December 20, 2010, 01:49:51 PM »
You're welcome.  Happy holidays.   :D