Skip to content

Commit

Permalink
Share Lizzy playlist implementation
Browse files Browse the repository at this point in the history
Remove all internal marshalling and unmarshalling of playlists, use Lizzy module instead.
Update to dependency `io.github.borewit:lizzy` to version 2.0.0
  • Loading branch information
Borewit committed Mar 20, 2023
1 parent 4508962 commit 2f0bfde
Show file tree
Hide file tree
Showing 68 changed files with 592 additions and 116,667 deletions.
4 changes: 4 additions & 0 deletions .lift.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build = "gradle"
jdkVersion = "15"

ignoreRules = ["PATH_TRAVERSAL_IN", "YodaCondition"]
20 changes: 6 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ plugins {
// https://github.com/openjfx/javafx-gradle-plugin
id 'org.openjfx.javafxplugin' version '0.0.13'

// Generate Java code from XSD
id 'org.unbroken-dome.xjc' version '2.0.0'

id 'checkstyle'

// https://github.com/qoomon/gradle-git-versioning-plugin
Expand Down Expand Up @@ -90,16 +87,16 @@ repositories {
maven {
url "https://repo1.maven.org/maven2/"
}
mavenLocal()
// mavenLocal()
// Staging repository
maven { url 'https://s01.oss.sonatype.org/content/groups/staging/' }
// maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
}

dependencies {

// Provides christophedelory.playlist.*
implementation 'io.github.borewit:lizzy:1.2.0'
implementation 'io.github.borewit:lizzy:2.0.0-SNAPSHOT'

// https://mvnrepository.com/artifact/com.jgoodies/jgoodies-common
implementation 'com.jgoodies:jgoodies-common:1.8.1'
Expand All @@ -110,16 +107,15 @@ dependencies {
// This dependency is used by the application.
implementation 'com.google.guava:guava:31.1-jre'

// https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api
implementation 'javax.xml.bind:jaxb-api:2.3.1'

// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'

// Apache SLF4J to Log4j2 Adapter (bridge)
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j2-impl
runtimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0'

implementation 'jakarta.activation:jakarta.activation-api:2.1.1';

// Required for log4j yaml configuration files
// https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.14.2'
Expand Down Expand Up @@ -163,7 +159,7 @@ def generatedImages = "$generatedResources/images"
sourceSets {
main {
java {
srcDirs = ['src/main/java', "$generatedSources/xjc/java/main"]
srcDirs = ['src/main/java']
}
resources {
srcDirs = ['src/main/resources', generatedResources]
Expand Down Expand Up @@ -218,10 +214,6 @@ task makeIcon (type: Svg2IcoTask) {
destination = file('website/favicon.ico')
}

tasks.withType(JavaCompile).configureEach {
compileTask -> compileTask.dependsOn xjcGenerate
}

tasks.withType(Checkstyle).configureEach {
exclude 'listfix/model/playlists/winamp/generated/**.java'
}
Expand Down
2 changes: 1 addition & 1 deletion simplelog.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Uncomment this line if you want to log the reports of the content metadata providers when connecting to the individual media files/URLs.
#org.apache.commons.logging.simplelog.log.christophedelory.content.ContentMetadataCenter=debug

#org.apache.commons.logging.simplelog.log.christophedelory.lizzy.FetchContentMetadata=debug
#org.apache.commons.logging.simplelog.log.io.github.borewit.lizzy.FetchContentMetadata=debug

#org.apache.commons.logging.simplelog.log.christophedelory.playlist.Playlist=debug

Expand Down
124 changes: 0 additions & 124 deletions src/main/java/listfix/io/WinampHelper.java

This file was deleted.

23 changes: 13 additions & 10 deletions src/main/java/listfix/io/datatransfer/PlaylistTransferObject.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package listfix.io.datatransfer;

import christophedelory.playlist.SpecificPlaylist;
import listfix.io.playlists.LizzyPlaylistConversion;
import io.github.borewit.lizzy.playlist.Playlist;
import io.github.borewit.lizzy.playlist.PlaylistFormat;
import io.github.borewit.lizzy.playlist.SpecificPlaylist;
import listfix.io.playlists.LizzyPlaylistUtil;

import java.awt.datatransfer.DataFlavor;
import java.io.*;
import java.util.List;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
* Used to serialize / deserialize playlist to memory from drag and drop
Expand All @@ -14,11 +17,11 @@ public class PlaylistTransferObject
{
public static DataFlavor M3uPlaylistDataFlavor = new DataFlavor("audio/mpegurl", "M3U Playlist");

private static final String playlistType = ".m3u"; // ToDo: use MIME
private static final PlaylistFormat playlistFormat = PlaylistFormat.m3u;

public static void serialize(List<String> entryList, OutputStream outputStream) throws IOException
public static void serialize(Playlist playlist, OutputStream outputStream) throws IOException
{
SpecificPlaylist specificPlaylist = LizzyPlaylistConversion.toPlaylist(playlistType, entryList);
SpecificPlaylist specificPlaylist = LizzyPlaylistUtil.toPlaylist(playlistFormat, playlist);
try
{
specificPlaylist.writeTo(outputStream, null);
Expand All @@ -29,9 +32,9 @@ public static void serialize(List<String> entryList, OutputStream outputStream)
}
}

public static List<String> deserialize(InputStream input)
public static Playlist deserialize(InputStream input)
{
SpecificPlaylist playlist = LizzyPlaylistConversion.readPlaylistFromInputStream(".m3u", input); // ToDo: use MIME
return LizzyPlaylistConversion.toListOfFiles(playlist.toPlaylist());
SpecificPlaylist playlist = LizzyPlaylistUtil.readPlaylistFromInputStream(playlistFormat, input);
return playlist.toPlaylist();
}
}
24 changes: 0 additions & 24 deletions src/main/java/listfix/io/playlists/IPlaylistReader.java

This file was deleted.

19 changes: 0 additions & 19 deletions src/main/java/listfix/io/playlists/IPlaylistWriter.java

This file was deleted.

Loading

0 comments on commit 2f0bfde

Please sign in to comment.