Jump to content

Mazin07

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Mazin07

  1. System.currentTimeMillis()/1000L has been confirmed to give the correct unix time. I tried this: import java.lang.System; public class nixtime { public static void main (String[] args) { while(true) { System.out.println(System.currentTimeMillis()/ 1000L); try { Thread.sleep(1000); } catch(Exception e) { } } } } and it matches output from $ date +%s I haven't put it in Pandora's Jar yet, but I'll try that soon.
  2. OK, now I just sound dumb. How do I compile pandora's jar?
  3. I haven't tried it, but I looked on the Java site and... 1. It's UTC, right? From what I infer from the Java site, it is (minus leap seconds). 2. Isn't Unix time measured in seconds from the epoch, and not milliseconds? If that's what AudioScrobbler wants, then it would need to be divided by 1 000. 3. No need to convert to string first, right? (I'm no Java pro.)
  4. Back story: When I started to use Pandora, I had it submit my tracks to last.fm so it would show up on my profile. But, it didn't. Last.fm would give me a message saying that spam protection was triggered because the timestamp on the submission was before my last submission (from amaroK). So, a little test shows that it does submit it, only 5 hours in the past. Not coincidentally, I'm in UTC-5 timezone. So, PJ submits tracks with improper timestamps. Audioscrobbler needs Unix timestamps to accompany each submission. Unix timestamps are always in UTC, BTW. I poked around in LastFmLookup.java, and found this: Date date = new Date(); DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); req = new GetMethodWebRequest(lastFMUrl); req.setParameter("u", userName); String s = md5(md5(password) + key); LOG.debug("hex = " + s); req.setParameter("s", s); req.setParameter("a[0]", songInfo.getArtist()); req.setParameter("t[0]", songInfo.getTitle()); req.setParameter("b[0]", songInfo.getAlbum()!=null?songInfo.getAlbum():""); req.setParameter("m[0]", ""); req.setParameter("l[0]", "255"); req.setParameter("i[0]", simpleDateFormat.format(date)); res = wc.getResponse(req); text = res.getText(); if (text.indexOf("OK") == -1) { String msg = "a problem was encountered whille attempting to add track to last.fm: " + text; LOG.warn(msg); throw new RuntimeException(msg); } LOG.info("successfully added track to last.fm"); Where i[0] is the timestamp. It's submitting with the format "yyyy-MM-dd HH:mm:ss", and if I'm not mistaken, Unix timestamps look like "1162252620". So: #1: It isn't UTC time #2: It's not a unix timestamp
×
×
  • Create New...