Search in sources :

Example 1 with Track

use of main.music.entity.Track in project Eidolons by IDemiurge.

the class M3uGenerator method repairM3uLists.

public static void repairM3uLists() {
    List<MusicList> lists = new ListObjChooser<MusicList>().selectMulti(MusicCore.getMusicLists());
    for (MusicList list : lists) {
        List<Track> tracks = list.getTracks();
        List<Track> cleanTracks = new ListMaster<Track>().getRemovedDuplicates(tracks);
        List<Track> differingElements = new ListMaster<Track>().getDifferingElements(tracks, cleanTracks);
        LogMaster.log(1, list + " has differingElements " + differingElements);
        LogMaster.log(1, list + " Clean Tracks: " + cleanTracks);
        list.setTracks(cleanTracks);
        MusicCore.saveList(list);
    }
}
Also used : MusicList(main.music.entity.MusicList) Track(main.music.entity.Track)

Example 2 with Track

use of main.music.entity.Track in project Eidolons by IDemiurge.

the class MusicCore method convertTracksToM3U.

public static String convertTracksToM3U(String contents) {
    String newContents = M3U_PREFIX;
    for (String substring : StringMaster.open(contents)) {
        // ObjType type = DataManager.getType(substring, AT_OBJ_TYPE.TRACK);
        Track track = getTrack(substring);
        newContents += M3U_TRACK_PREFIX + track.getDuration() + "," + track.getArtist() + " - " + track.getName() + StringMaster.NEW_LINE;
        newContents += track.getPath() + StringMaster.NEW_LINE;
    // #EXTM3U
    // #EXTINF:116,Two Steps From Hell - Magika
    // X:\Music\Two Steps From Hell\2007 - Dynasty\CD 2\16 Magika.mp3
    }
    return newContents;
}
Also used : Track(main.music.entity.Track)

Example 3 with Track

use of main.music.entity.Track in project Eidolons by IDemiurge.

the class MusicMouseListener method playM3uList.

public static void playM3uList(String listPath, PLAY_MODE playMode) {
    File file = new File(listPath);
    if (playMode != null) {
        if (playMode != PLAY_MODE.NORMAL) {
            // getList()
            List<Track> tracks = MusicCore.getTracks(listPath);
            String newPath = AHK_Master.SYSTEM_LISTS_FOLDER + "Play Mode Gen\\ " + playMode.toString() + " " + StringMaster.getLastPathSegment(StringMaster.cropFormat(listPath)) + // getList().getName()
            ".m3u";
            tracks = getTracksForPlayMode(playMode, tracks);
            String content = M3uGenerator.getM3uForTracks(tracks);
            FileManager.write(content, newPath);
            file = new File(newPath);
        }
    }
    try {
        Desktop.getDesktop().open(file);
        MusicList playList = MusicCore.findList(StringMaster.cropFormat(file.getName()));
        if (!MusicCore.getLastPlayed().contains(playList)) {
            MusicCore.getLastPlayed().add(playList);
        }
        AHK_Master.getPanel().getControlPanel().refresh();
    // Runtime.getRuntime().exec(function.replaceFirst("Run ", ""));
    } catch (IOException e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
}
Also used : IOException(java.io.IOException) MusicList(main.music.entity.MusicList) File(java.io.File) Track(main.music.entity.Track)

Example 4 with Track

use of main.music.entity.Track in project Eidolons by IDemiurge.

the class M3uGenerator method getM3uForTracks.

public static String getM3uForTracks(List<Track> filePaths) {
    String content = M3U_PREFIX + StringMaster.NEW_LINE;
    ListMaster.removeNullElements(filePaths);
    for (Track sub : filePaths) {
        String param = sub.getParam(G_PARAMS.DURATION);
        String path = sub.getProperty(AT_PROPS.PATH);
        String property = sub.getProperty(AT_PROPS.ARTIST);
        if (property.isEmpty()) {
            property = StringMaster.getPathSegments(path).get(StringMaster.getPathSegments(path).size() - 2);
        }
        content += M3U_TRACK_PREFIX + param + "," + property + " - " + sub.getName() + StringMaster.NEW_LINE;
        content += path + StringMaster.NEW_LINE;
    }
    return content;
}
Also used : Track(main.music.entity.Track)

Example 5 with Track

use of main.music.entity.Track in project Eidolons by IDemiurge.

the class MusicCore method getTrack.

public static Track getTrack(ObjType type) {
    if (type == null) {
        return null;
    }
    Track track = trackTypeMap.get(type.getName());
    if (track == null) {
        track = new Track(type);
        trackTypeMap.put(type.getName(), track);
    }
    return track;
}
Also used : Track(main.music.entity.Track)

Aggregations

Track (main.music.entity.Track)7 MusicList (main.music.entity.MusicList)2 File (java.io.File)1 IOException (java.io.IOException)1