Jump to content




Get Length Of Song In Disk Drive


14 replies to this topic

#1 Shaun

  • Members
  • 14 posts

Posted 09 November 2013 - 10:57 AM

Could we get something like disc.getAudioLength(string side) to get the length of a song in seconds?
Would really help for jukebox scripts when using mods that add more records

#2 Wojbie

  • Members
  • 631 posts
  • LocationKinda lost

Posted 09 November 2013 - 11:25 AM

I Don't know if there is one but i can give you this:
Timinigs= {
["C418 - 13"]=178,
["C418 - cat"]=185,
["C418 - blocks"]=345,
["C418 - chirp"]=185,
["C418 - far"]=174,
["C418 - mall"]=197,
["C418 - mellohi"]=96,
["C418 - stal"]=150,
["C418 - strad"]=183,
["C418 - ward"]=251,
["C418 - 11"]=71,
["C418 - wait"]=238,
}
That table contains time each song plays. So you can use disk.getAudioTitle(string side) to get name of disc and take time from my list. Made it some time ago for Dj turtle on a server. Times are based on Minecraft-Wiki and should be close to correct (I think i rounded them up to seconds from the look of it)

EDIT: O wait this is suggestions sub-forum not Ask a Pro.... Wopse.

Edited by wojbie, 09 November 2013 - 11:29 AM.


#3 Left4Cake

  • Members
  • 272 posts
  • LocationEarth

Posted 10 November 2013 - 09:02 AM

Eh, When ever there is an already implementable solution people do post them here.

You did make the suggestion seem some what less useful. I guess if its possible to make it work with moded music disc it would be more useful.

#4 awsmazinggenius

  • Members
  • 930 posts
  • LocationCanada

Posted 11 November 2013 - 11:37 PM

Also resource packs and their added music ...

Say if your vanilla "cat" was 2:20 (140 sec) and your resource pack one was 1:49 (109 sec). On servers would use the server resource pack

#5 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 12 November 2013 - 09:43 AM

Actually, I don't think this sounds like a bad idea. It would be nice to have this simple function. I don't think it would even be too difficult to implement, but I'm not a dev, so I don't know.

#6 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 13 November 2013 - 02:09 AM

The server doesn't have sounds. Lua code runs on the server. No way to get the length!

#7 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 13 November 2013 - 09:11 AM

Well that's unfortunate.

#8 awsmazinggenius

  • Members
  • 930 posts
  • LocationCanada

Posted 13 November 2013 - 09:49 PM

Aren't servers able to have resource packs, and if no pack is present we can go by default? Is that even possible?

Thanks,
awsmazinggenius

#9 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 13 November 2013 - 09:55 PM

View Postawsmazinggenius, on 13 November 2013 - 09:49 PM, said:

Aren't servers able to have resource packs, and if no pack is present we can go by default? Is that even possible?
Ok to expand on what Cloudy said... Servers HAVE the music files... Servers do not have ACCESS to the music files...

#10 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 13 November 2013 - 10:13 PM

View Posttheoriginalbit, on 13 November 2013 - 09:55 PM, said:

View Postawsmazinggenius, on 13 November 2013 - 09:49 PM, said:

Aren't servers able to have resource packs, and if no pack is present we can go by default? Is that even possible?
Ok to expand on what Cloudy said... Servers HAVE the music files... Servers do not have ACCESS to the music files...

They don't have by default. Even if a server sends a resource pack with music to the client - the client doesn't have to use it.

#11 awsmazinggenius

  • Members
  • 930 posts
  • LocationCanada

Posted 16 November 2013 - 09:28 AM

Well that does cause discrepancies, the server should choose the song length because
a) It's the same for everyone
B) Technical reasons
c) They are the ones putting effort into server hosting, anyways.

edit: my browser screwed up this post. Sorry!

Edited by awsmazinggenius, 16 November 2013 - 09:30 AM.


#12 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 16 November 2013 - 02:28 PM

There could be hardcoded lengths of the songs. But then you are limited to vanilla disks, which don't make sense in the end.

I am not necessarily against hardcoded disk lengths, but it is very limited. I don't think the devs would add this just because of that.

Note that I haven't spoken to a developer, this all comes from me so don't quote me on this.

#13 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 16 November 2013 - 10:17 PM

In addition, if it's hardcover lengths just do it in your program.

#14 awsmazinggenius

  • Members
  • 930 posts
  • LocationCanada

Posted 16 November 2013 - 11:29 PM

View Posttheoriginalbit, on 16 November 2013 - 10:17 PM, said:

In addition, if it's hardcover lengths just do it in your program.
Exactly. Just use a table in your program if it will be hard-coded. The whole point of this suggestion is to support resource packs and disks from mods.

#15 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 17 November 2013 - 12:20 AM

View Postawsmazinggenius, on 16 November 2013 - 11:29 PM, said:

The whole point of this suggestion is to support resource packs and disks from mods.
Yeh but it's just not possible with the game engine structure that Mojang has chosen.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users