Package co.arcs.groove.basking.event.Events

Examples of co.arcs.groove.basking.event.Events.BuildSyncPlanProgressChangedEvent


                return !arg1.startsWith(".") && arg1.endsWith(SyncService.FINISHED_FILE_EXTENSION);
            }
        }));

        int progress = 0;
        bus.post(new BuildSyncPlanProgressChangedEvent(this, progress++, files.size()));

        Map<Integer, File> existingSongs = Maps.newHashMap();
        for (File f : files) {
            // This operation takes far longer than everything else, so is used as the measure of progress
            Integer id = Utils.decodeId(f);
            if (id != Utils.ID_NONE) {
                existingSongs.put(id, f);
            }
            bus.post(new BuildSyncPlanProgressChangedEvent(this, progress++, files.size()));
        }

        Map<Integer, Song> wantedSongs = Maps.newHashMap();
        for (Song s : songs) {
            wantedSongs.put(s.getId(), s);
View Full Code Here


            Map<Integer, String> cacheMap = CharStreams.readLines(new InputStreamReader(is),
                    WriteCacheFileTask.newCacheFileLineProcessor());
            is.close();

            int progress = 0;
            bus.post(new BuildSyncPlanProgressChangedEvent(this, 0, songs.size()));

            for (Song song : songs) {
                if (cacheMap.containsKey(song.getId())) {
                    // Wanted song is in cache, so leave as is
                    items.add(new Item(new File(syncDir, cacheMap.get(song.getId())),
                            Action.LEAVE,
                            song));
                    cacheMap.remove(song.getId());
                } else {
                    // Wanted song is absent, so download
                    items.add(new Item(new File(syncDir, Utils.getDiskName(song)),
                            Action.DOWNLOAD,
                            song));
                }
                bus.post(new BuildSyncPlanProgressChangedEvent(this, ++progress, songs.size()));
            }

            // Unwanted stuff that's in the cache should be removed
            for (String fileName : cacheMap.values()) {
                items.add(new Item(new File(syncDir, fileName), Action.DELETE, null));
View Full Code Here

TOP

Related Classes of co.arcs.groove.basking.event.Events.BuildSyncPlanProgressChangedEvent

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.