Package model

Examples of model.Track


      e.printStackTrace();
    }
  }

  public void run() {
    Track t;
    int trackCount=0;
    try {
      // timer, da erst gepollt wird und producer nicht
                // so schnell eins insertet.
      progressBar.setIndeterminate(true);
      progressDialog.setVisible(true);
      Thread.sleep(3000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    progressBar.setIndeterminate(false);
    abrot = false;
    while (!abrot && (queue.hasFinnished() ? (queue.size()>0 ? true : false):true)) { // solange die queue abarbeiten
      progressBar.setMaximum(trackCount+queue.size());
      progressLabel.setText(trackCount+" von "+(trackCount+queue.size())+" Tracks geschrieben");
      progressBar.setValue(trackCount);
      t = queue.poll();
      if (t == null){ // bis ein null ankommt
          try {
            Thread.sleep(2000); //dem folderImporter zeit lassen, falls er mit dem nachbefuellen der queue nicht hinterherkommt

          } catch (InterruptedException e) {
            e.printStackTrace();
          }
          continue;
      }
     
      // ######-Abarbeitung-#######
      int artistID = insertArtist(t.getArtistName());
      int albumID = insertAlbum(t.getAlbumName(), artistID);
      try {
        insertTrack(artistID, albumID, t);
        trackCount++;
      } catch (SQLException e) {
        e.printStackTrace();
View Full Code Here


    addTracksToDB();
  }
  private void addTracksToDB() {
    try {
      addTracksToPlaylistStmt.setInt(1, id);
      Track track;
      for (int i = 0; i<tracks.length; i++) {
        track = tracks[i];
        addTracksToPlaylistStmt.setInt(2, track.getID());
        addTracksToPlaylistStmt.setInt(3, start+i);
        try {
          addTracksToPlaylistStmt.execute();
        } catch (SQLException e) {
          e.printStackTrace();
View Full Code Here

    stateChanged(JukeboxStateListener.PLAYING);
  }

  public void next() {
    if (playMode == Jukebox.NO_REPEAT_MODE) { // normalmodus, also
      Track t = core.getQueueLib().pullTrack(0);//ist was in der warteschlange?
      if (null!=t){//wenn ja,
        playTrack(t, core.getVolume(), true);//abspielen
        isPlaying=true;
        hasFinished=false;
        core.updateQueue();
        return;
      }//sonst
      playCursor++;
      if (playCursor >= tracks.size()) { // gibt es ein nächstes lied?
        playCursor = 0;
        hasFinished = true; // liste ist durch, stop
        isPlaying = false;
        player.stop();
        stateChanged(JukeboxStateListener.PAUSED);
      } else {
        if (!tracks.getTrackAt(playCursor).isChecked()) {
          next();
          return;
        }
        playTrack(tracks.getTrackAt(playCursor), core.getVolume(), true);
        isPlaying = true; // liste ist nicht durch, nächstes lied
        hasFinished = false;
      }
    } else if (playMode == Jukebox.SHUFFLE_MODE) {
      Library l = core.getQueueLib();//ist was in der warteschlange?
      if (l.getTrackCount()>0){//wenn ja,
        playTrack(l.pullTrack(r.nextInt(l.getTrackCount()-1)), core.getVolume(), true);//abspielen
        isPlaying=true;
        hasFinished=false;
        core.updateQueue();
        return;
      }//sonst
      int rand = r.nextInt(tracks.size());
      if (!tracks.getTrackAt(rand).isChecked()) {
        next();
        return;
      }
      playCursor= rand;
      playTrack(tracks.getTrackAt(rand), core.getVolume(), true);
      hasFinished = false; // random lied abspielen
      isPlaying = true;
    } else if (playMode == Jukebox.REPEAT_ALL_MODE) {
      Track t = core.getQueueLib().pullTrack(0);//ist was in der warteschlange?
      if (null!=t){//wenn ja,
        playTrack(t, core.getVolume(), true);//abspielen
        isPlaying=true;
        hasFinished=false;
        core.updateQueue();
View Full Code Here

    }
  }

  private static int partition(Library x, int links, int rechts, char columnConstant) {
    int i, j;
    Track temp;
    Track pivot= x.getTrackAt(rechts);
    i = links;
    j = rechts - 1;
    while (i <= j) {
      if (x.getTrackAt(i).compareTo(pivot, columnConstant)) {
        // tausche x[i] und x[j]
View Full Code Here

   * @throws TagException
   * @throws ReadOnlyFileException
   * @throws InvalidAudioFrameException
   */
  public static Track readTags(Track t) throws CannotReadException, IOException, TagException, ReadOnlyFileException, InvalidAudioFrameException{
    Track track = null;
    File f = new File(t.getPath().toString());
    AudioFile af = AudioFileIO.read(f);
   
    Tag tag = af.getTag();
    String artist = tag.getFirst(FieldKey.ARTIST);
View Full Code Here

   * füllt das Formular mit den aktuellen Daten.
   */
  private void fillForm() {
    //nur eine Datei?
    if (selectedTracks.size()==1) {//dann einfach alles anzeigen
      Track t = selectedTracks.get(0);
      fileNameField.setText(t.getPath().getFileName().toString());
      titleField.setText(t.getTitle());
      albumField.setText(t.getAlbumName());
      artistField.setText(t.getArtistName());
      trackField.setText(t.getTrack());
      genreField.setText(t.getGenre());
      fileNameField.setEditable(true);
      fileNameField.setEnabled(true);
      pathField.setText(t.getPath().toString());
    }else if(selectedTracks.size()>0){//ansonsten sinds mehrere Tracks
      //es wird überprüft, welche merkmale dieser Lieder gleich sind.
      fileNameField.setEditable(false);
      fileNameField.setEnabled(false);
      String title = " ";
      String album = " ";
      String artist = " ";
      String track = " ";
      String genre = " ";
      String fileName = "";
      Track selTrack;
      Track temp = selectedTracks.get(0);
      for (int i = 1; i < selectedTracks.size(); i++) {
        //tracks miteinander vergleichen
        selTrack = selectedTracks.get(i);
        // noch keine unterschiede bisher und auch aktuell nicht? dann übernehmen, sonst mit != markieren
        title = !title.equals("!=")&&selTrack.getTitle().equals(temp.getTitle())?selTrack.getTitle():"!=";
        album = !album.equals("!=")&&selTrack.getAlbumName().equals(temp.getAlbumName())?selTrack.getAlbumName():"!=";
        artist = !artist.equals("!=")&&selTrack.getArtistName().equals(temp.getArtistName())?selTrack.getArtistName():"!=";
        track = !track.equals("!=")&&selTrack.getTrack().equals(temp.getTrack())?selTrack.getTrack():"!=";
        genre = !genre.equals("!=")&&selTrack.getGenre().equals(temp.getGenre())?selTrack.getGenre():"!=";
        fileName = !fileName.equals("!=")&&selTrack.getPath().getFileName().toString().equals(temp.getPath().getFileName()
            .toString())?selTrack.getPath().getFileName().toString():"!=";
      }

      fileNameField.setText(fileName);
      titleField.setText(title);
View Full Code Here

//              rsTemp.getString("artistName"), rsTemp.getString("albumName"), rsTemp
//              .getString("genre"), rsTemp.getString("track"), rsTemp
//              .getInt("length"), rsTemp.getInt("artistID"), rsTemp
//              .getInt("albumID"), rsTemp.getInt("checked") == 1 ? true
//              : false, rsTemp.getString("path")));
          tracks.add(new Track(rsTemp.getInt("id")));
        }
        rsTemp.close();
      } catch (SQLException e) {
        e.printStackTrace();
        return;
      }
      ((TrackTable)trackTable).setTracksInLib(tracks);
    }else {//ein "echter" interpret wurde selektiert.
      rsTemp = PhoenixCore.DBCON.executeOnLib("SELECT al.id, al.name from albums as al " +//alben vom interpreten holen
          "inner join artists as a on a.id = al.artist where al.artist = "
          +selectedArtist.getId()+" order by lower(al.name) asc");
      try {
       
        while(rsTemp.next()) {
          alben.add(new Album(rsTemp.getInt("id"), rsTemp.getString("name")));
          length++;
        }
        rsTemp.close();
      } catch (SQLException e) {
        e.printStackTrace();
        return;
      }
     
      alb =  new Album[length+1][1];
      alb[0][0]=(new Album(0, "Alle("+length+")", selectedArtist.getId(), selectedArtist.getName()));
      length++;
      for (int i=1; i<length; i++) {
        alb[i][0] = alben.get(i-1);
      }
      //alben-tabelle aktualisieren
      String[] cols = {"Alben"};
      DefaultTableModel model = new DefaultTableModel(alb, cols);
      albums.setModel(model);
      albums.setFillsViewportHeight(true);
      //albums.repaint();
      ((JViewport)albums.getParent()).setViewPosition(new Point(0, 0));
      //track-table aktualisieren.
      List<Track> tracks = new ArrayList<Track>();
      rsTemp = PhoenixCore.DBCON.executeOnLib("select t.id, t.name, ar.id as artistID, t.album as albumID, " +//titel vom interpreten holen
          "t.genre, t.track, t.length, t.checked, t.path, ar.name as artistName, al.name as albumName " +
          "from tracks t inner join albums al on t.album=al.id inner join artists ar on al.artist=ar.id " +
          "where ar.name='"+selectedArtist.getName().replace("'", "''")+"' order by lower(albumName), t.track asc");
      try {
        while(rsTemp.next()) {
//          tracks.add(new Track(rsTemp.getInt("id"), rsTemp.getString("name"),
//              rsTemp.getString("artistName"), rsTemp.getString("albumName"), rsTemp
//              .getString("genre"), rsTemp.getString("track"), rsTemp
//              .getInt("length"), rsTemp.getInt("artistID"), rsTemp
//              .getInt("albumID"), rsTemp.getInt("checked") == 1 ? true
//              : false, rsTemp.getString("path")));
          tracks.add(new Track(rsTemp.getInt("id")));
        }
        rsTemp.close();
      } catch (SQLException e) {
        e.printStackTrace();
        return;
View Full Code Here

          "where al.name='"+selectedAlbum.getName().replace("'", "''")+"' order by lower(al.name), t.track asc");
    }
   
    try {
      while(rsTemp.next()) {
        tracks.add(new Track(rsTemp.getInt("id")));
      }
      rsTemp.close();
    } catch (SQLException e) {
      e.printStackTrace();
      return;
View Full Code Here

TOP

Related Classes of model.Track

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.