Package de.umass.lastfm.scrobble

Examples of de.umass.lastfm.scrobble.SubmissionData


        @Override
        public void run() {
            while (true) {
                try {
                    SubmissionData data;
                    synchronized (submitQueue) {
                        while (!config.getBoolean("lastfm.enabled", false) ||
                               submitQueue.isEmpty()) {
                            submitQueue.wait();
                        }
                        data = submitQueue.peek();
                    }

                    if (!authorized) {
                        auth();
                        if (!authorized) {
                            Thread.sleep(waitTime);
                            waitTime = Math.min(waitTime * 2, MAX_WAIT_TIME);
                            continue;
                        }
                    }
                    logger.fine("Submitting data: " + data.toString());
                    ResponseStatus status = scrobbler.submit(data);
                    if (status.ok()) {
                        waitTime = MIN_WAIT_TIME;
                        synchronized (submitQueue) {
                            submitQueue.poll();
View Full Code Here


        player = app.getPlayer();
        player.addListener(new PlayerListener() {
            @Override
            public void onEvent(PlayerEvent e) {
                if (config.getBoolean("lastfm.enabled", false)) {
                    SubmissionData data = nowPlaying;
                    switch (e.getEventCode()) {
                        case FILE_OPENED:
                            initNowPlaying(player.getTrack());
                            // no need to break here!
                        case STOPPED:
View Full Code Here

        if (Util.isEmpty(artist) || Util.isEmpty(title) || nowPlayingLength < 30) {
            // do not submit this
            nowPlaying = null;
        } else {
            nowPlaying = new SubmissionData(artist, title, album, nowPlayingLength,
                    trackNumber, Source.USER, start);
        }
    }
View Full Code Here

    if (file.exists()) {
      BufferedReader r = new BufferedReader(new FileReader(file));
      List<SubmissionData> list = new ArrayList<SubmissionData>(50);
      String line;
      while ((line = r.readLine()) != null) {
        SubmissionData d = new SubmissionData(line);
        list.add(d);
        if (list.size() == 50) {
          scrobbler.submit(list);
          list.clear();
        }
View Full Code Here

TOP

Related Classes of de.umass.lastfm.scrobble.SubmissionData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.