Adds full support for YouTube playback.

While a few optimizations could be made, YouTube playback is almost as seamless as local playback.
This commit is contained in:
Markil3
2021-08-17 01:23:23 -06:00
parent ede9132279
commit 9c2cea1662
23 changed files with 388 additions and 261 deletions

View File

@@ -0,0 +1,32 @@
/*
* Copyright (c) 2021 William Hubbard. All Rights Reserved.
*/
package edu.regis.universeplayer.data;
import javax.swing.ImageIcon;
public class Album implements Comparable<Album>
{
public int id;
public String name;
public String[] artists;
public transient ImageIcon art;
public int year;
public String[] genres;
public int totalTracks;
public int totalDiscs;
@Override
public int compareTo(Album o)
{
if (o != null)
{
return this.name.compareTo(o.name);
}
else
{
return -1;
}
}
}

View File

@@ -0,0 +1,12 @@
/*
* Copyright (c) 2021 William Hubbard. All Rights Reserved.
*/
package edu.regis.universeplayer.data;
import java.net.URL;
public class InternetSong extends Song
{
public URL location;
}

View File

@@ -0,0 +1,17 @@
/*
* Copyright (c) 2021 William Hubbard. All Rights Reserved.
*/
package edu.regis.universeplayer.data;
import java.io.File;
/**
* This song represents a song found on the local file system.
*/
public class LocalSong extends Song
{
public File file;
public String type;
public String codec;
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2021 William Hubbard. All Rights Reserved.
*/
package edu.regis.universeplayer.data;
import java.io.Serializable;
/**
* Contains data for a song.
*/
public class Song implements Comparable<Song>, Serializable
{
public String title;
public String[] artists;
public int trackNum;
public int disc;
public long duration;
/**
* A reference to the album this song is part of.
*/
public Album album;
@Override
public int compareTo(Song o)
{
if (o != null)
{
int comp = this.album != null ? this.album.compareTo(o.album) : o.album != null ? 1 : 0;
if (comp == 0)
{
comp = Integer.compare(this.disc, o.disc);
if (comp == 0)
{
comp = Integer.compare(this.trackNum, o.trackNum);
if (comp == 0)
{
comp = this.title != null ? this.title.compareTo(o.title) : o.title != null ? 1 : 0;
}
}
}
return comp;
}
else
{
return -1;
}
}
}