Package net.sf.jmp3renamer.datamanager

Examples of net.sf.jmp3renamer.datamanager.DataSet


            ListSelectionModel lsm = (ListSelectionModel) e.getSource();

            if (lsm.isSelectionEmpty()) {
                return;
            } else if(dbtable.getRowCount() > 0) {
                DataSet dataset = (DataSet) dbtable.getValueAt(dbtable.getSelectedRow(), 0);
                mainGUI.showDataset(dataset);
            }
        }
    }
View Full Code Here


        JSONArray tracks = json.getJSONArray("tracklist");
        for (int i = 0; i < tracks.length(); i++) {
            JSONObject track = tracks.getJSONObject(i);

            DataSet ds = new DataSet();

            // set the album title
            ds.setAlbum(a.getTitle());

            // set the artist
            ds.setArtist(a.getArtist());

            // set the track number
            String position = track.getString("position");
            for (char delim : POSITION_DELIMS) {
                int n = position.indexOf(delim);
                if (n >= 0) {
                    String partOfSet = position.substring(0, n);
                    ds.setPartOfSet(partOfSet);
                    position = position.substring(n + 1);
                    break;
                }
            }
            ds.setTrack(position);

            // set the title
            ds.setTitle(track.getString("title"));

            // is there an artist object?
            if (track.has("artists")) {
                JSONArray artists = track.getJSONArray("artists");
                ds.setArtist(artists.getJSONObject(0).getString("name"));
            }

            // release date
            if (!a.getYear().isEmpty()) {
                ds.setYear(a.getYear());
            } else {
                if (json.has("year")) {
                    ds.setYear(((Integer) json.getInt("year")).toString());
                }
            }

            // set compilation flag
            ds.setPartOfCompilation(discogsAlbum.isCompilation());

            datasets.add(ds);
        }

        /*
 
View Full Code Here

        moveAdditionalFiles();

        File oldDir = null;
        // move, rename and tag the audio files
        for (int i = 0; i < count; i++) {
            DataSet dataset = datasets.get(i);
            MyFile oldFile = files.get(i);
            File newFile = getNewFile(dataset, oldFile);

            // store the old directory, so that we can delete
            // it after renaming the files
View Full Code Here

    }

    private void moveAdditionalFiles() {
        // determine destination directory
        List<DataSet> datasets = DataManager.getInstance().getDatasets();
        DataSet dataset = datasets.get(0);
        MyFile oldFile = files.get(0);
        File file = getNewFile(dataset, oldFile);
        File destinationDirectory = file.getParentFile();

        // move additional files (cover etc.)
View Full Code Here

    }

    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == storeData) {
            if (DataManager.getInstance().getDatasets().size() > 0) {
                DataSet dataset = DataManager.getInstance().getDatasets().get(0);
                String artist = dataset.getArtist();
                String album = dataset.getAlbum();
                String lastPath = DataBunker.getProperty("last");
                String path = "";
                if (lastPath != null && !lastPath.equals("")) {
                    path += lastPath;
                } else {
View Full Code Here

        JSONArray tracks = album.getJSONArray("tracks");
        for (int i = 0; i < tracks.length(); i++) {
            JSONObject track = tracks.getJSONObject(i);

            DataSet ds = new DataSet();

            // set the album title
            ds.setAlbum(a.getTitle());

            // set the artist
            ds.setArtist(a.getArtist());

            // set the track number
            ds.setTrack(track.getString("track-number"));

            // set the title
            ds.setTitle(track.getString("name"));

            // release date
            ds.setYear(album.getString("released"));

            // is there an artist object?
            if (track.has("artists")) {
                JSONArray artists = track.getJSONArray("artists");
                ds.setArtist(artists.getJSONObject(0).getString("name"));
            }

            // set number of set (CD1, CD2 or the like)
            if (track.has("disc-number")) {
                ds.setPartOfSet(track.getString("disc-number"));
            }

            // set compilation flag
            ds.setPartOfCompilation(compilation);

            datasets.add(ds);
        }
    }
View Full Code Here

            logger.error(I18N.translate("error.save_settings"), e);
        }
    }

    public DataSet getMetaData(File file) {
        DataSet dataset = new DataSet();
        try {
            AudioFile af = AudioFileIO.read(file);
            Tag tag = af.getTag();
            dataset.setAlbum(tag.getFirstAlbum());
            dataset.setArtist(tag.getFirstArtist());
            dataset.setTitle(tag.getFirstTitle());
            dataset.setComment(tag.getFirstComment());
            dataset.setTrack(tag.getFirstTrack());
            dataset.setYear(tag.getFirstYear());
            dataset.setGenre(tag.getFirstGenre());
        } catch (CannotReadException e) {
            logger.error(I18N.translate("error.load_metadata"), e);
        }
        return dataset;
    }
View Full Code Here

        checkStatus(doc);

        NodeList tracks = doc.getElementsByTagName("track");
        for (int i = 0; i < tracks.getLength(); i++) {
            Node track = tracks.item(i);
            DataSet dataset = new DataSet();
            dataset.setYear(album.getYear());
            dataset.setTrack(Integer.toString(i+1));
            NodeList childs = track.getChildNodes();
            for (int j = 0; j < childs.getLength(); j++) {
                Node child = childs.item(j);
                if ("album".equals(child.getNodeName())) {
                    dataset.setAlbum(child.getTextContent());
                } else if ("title".equals(child.getNodeName())) {
                    dataset.setTitle(child.getTextContent());
                } else if ("creator".equals(child.getNodeName())) {
                    dataset.setArtist(child.getTextContent());
                }
            }
            album.getTracks().add(dataset);
        }
    }
View Full Code Here

        List<Medium> mediums = ml.getMedium();
        for (Medium medium : mediums) {
            TrackList tracks = medium.getTrackList();
            for (Track track : tracks.getDefTrack()) {
                logger.debug("Found track: {}", track.getTitle());
                DataSet ds = new DataSet();
                // set the title
                ds.setTitle(track.getRecording().getTitle());

                // set the artist name
                if (track.getRecording() != null && track.getRecording().getArtistCredit() != null) {
                    ArtistCredit ac = track.getRecording().getArtistCredit();
                    ds.setArtist(ac.getNameCredit().get(0).getArtist().getName());
                } else {
                    ds.setArtist(mbAlbum.getArtist());
                }

                // set the track number
                ds.setTrack(track.getPosition().toString());

                // set the album name
                ds.setAlbum(mbAlbum.getTitle());

                // set the year
                ds.setYear(mbAlbum.getYear());

                // set the compilation flag
                ds.setPartOfCompilation(mbAlbum.isCompilation());

                // set the medium number
                ds.setPartOfSet(medium.getPosition().toString());

                // add this track to the result list
                datasets.add(ds);
            }
        }
View Full Code Here

    }

    private void preview() {
        String regex = (String) tUserRegex.getEditor().getItem();
        String oldname = lOldnameView.getText();
        DataSet dataset = MagicCookieBaker.evaluateCookie(regex, oldname);
        if (dataset != null) {
            lNewnameView.setText(MagicCookieBaker.evaluateDataSet(dataset));
        }
    }
View Full Code Here

TOP

Related Classes of net.sf.jmp3renamer.datamanager.DataSet

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.