Merge pull request #1071 from TeamNewPipe/feat/ServiceList

Init services at the correct place
This commit is contained in:
Tobi 2023-06-17 20:50:24 +02:00 committed by GitHub
commit d294ccb433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,8 +6,6 @@ import org.schabi.newpipe.extractor.services.peertube.PeertubeService;
import org.schabi.newpipe.extractor.services.soundcloud.SoundcloudService; import org.schabi.newpipe.extractor.services.soundcloud.SoundcloudService;
import org.schabi.newpipe.extractor.services.youtube.YoutubeService; import org.schabi.newpipe.extractor.services.youtube.YoutubeService;
import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
/* /*
@ -34,27 +32,21 @@ import java.util.List;
@SuppressWarnings({"ConstantName", "InnerAssignment"}) // keep unusual names and inner assignments @SuppressWarnings({"ConstantName", "InnerAssignment"}) // keep unusual names and inner assignments
public final class ServiceList { public final class ServiceList {
private ServiceList() { private ServiceList() {
//no instance // no instance
} }
public static final YoutubeService YouTube; public static final YoutubeService YouTube = new YoutubeService(0);
public static final SoundcloudService SoundCloud; public static final SoundcloudService SoundCloud = new SoundcloudService(1);
public static final MediaCCCService MediaCCC; public static final MediaCCCService MediaCCC = new MediaCCCService(2);
public static final PeertubeService PeerTube; public static final PeertubeService PeerTube = new PeertubeService(3);
public static final BandcampService Bandcamp; public static final BandcampService Bandcamp = new BandcampService(4);
/** /**
* When creating a new service, put this service in the end of this list, * When creating a new service, put this service in the end of this list,
* and give it the next free id. * and give it the next free id.
*/ */
private static final List<StreamingService> SERVICES = Collections.unmodifiableList( private static final List<StreamingService> SERVICES = List.of(
Arrays.asList( YouTube, SoundCloud, MediaCCC, PeerTube, Bandcamp);
YouTube = new YoutubeService(0),
SoundCloud = new SoundcloudService(1),
MediaCCC = new MediaCCCService(2),
PeerTube = new PeertubeService(3),
Bandcamp = new BandcampService(4)
));
/** /**
* Get all the supported services. * Get all the supported services.