Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

Commit

Permalink
Remove old audio track info for images
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 committed Nov 26, 2023
1 parent 5117ccb commit f14589b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 49 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Skybot source managers

> [!IMPORTANT]
> This is compiled with `dev.arbjerg:lavalink` version 2.0.x in order to send artwork urls
A bunch of extra source managers for LavaPlayer:

- Mixcloud
Expand Down
6 changes: 2 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ repositories {
}

dependencies {
// build override for age-restricted videos
// implementation(group = "com.github.duncte123", name = "lavaplayer", version = "be6e364")
compileOnly(group = "com.github.walkyst", name = "lavaplayer-fork", version = "1.4.2")
compileOnly(group = "dev.arbjerg", name = "lavaplayer", version = "2.0.3")

implementation("commons-io:commons-io:2.7")
implementation(group = "org.jsoup", name = "jsoup", version = "1.15.3")
implementation(group = "com.google.code.findbugs", name = "jsr305", version = "3.0.2")

testImplementation(group = "com.github.walkyst", name = "lavaplayer-fork", version = "1.4.2")
testImplementation(group = "dev.arbjerg", name = "lavaplayer", version = " 2.0.3")
}

configure<JavaPluginExtension> {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.dunctebot.sourcemanagers.pornhub;

import com.dunctebot.sourcemanagers.AbstractDuncteBotHttpSource;
import com.dunctebot.sourcemanagers.AudioTrackInfoWithImage;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
import com.sedmelluq.discord.lavaplayer.tools.ExceptionTools;
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
Expand Down Expand Up @@ -114,15 +113,16 @@ private AudioItem loadItemOnce(AudioReference reference) throws IOException {
);
}

private AudioTrackInfoWithImage buildInfo(String title, String author, long duration, String identifier, String uri, String imageUrl) {
return new AudioTrackInfoWithImage(
private AudioTrackInfo buildInfo(String title, String author, long duration, String identifier, String uri, String imageUrl) {
return new AudioTrackInfo(
title,
author,
duration,
identifier,
false,
uri,
imageUrl
imageUrl,
null
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.dunctebot.sourcemanagers.reddit;

import com.dunctebot.sourcemanagers.AbstractDuncteBotHttpSource;
import com.dunctebot.sourcemanagers.AudioTrackInfoWithImage;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
import com.sedmelluq.discord.lavaplayer.tools.ExceptionTools;
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
Expand All @@ -41,9 +40,9 @@

import static com.dunctebot.sourcemanagers.Utils.USER_AGENT;
import static com.dunctebot.sourcemanagers.Utils.isURL;
import static com.dunctebot.sourcemanagers.reddit.RedditAudioTrack.getPlaybackUrl;
import static com.sedmelluq.discord.lavaplayer.tools.FriendlyException.Severity.COMMON;
import static com.sedmelluq.discord.lavaplayer.tools.JsonBrowser.NULL_BROWSER;
import static com.dunctebot.sourcemanagers.reddit.RedditAudioTrack.getPlaybackUrl;

public class RedditAudioSourceManager extends AbstractDuncteBotHttpSource {
private static final Pattern FULL_LINK_REGEX = Pattern.compile("https:\\/\\/(?:www|old)\\.reddit\\.com\\/r\\/(?:[^\\/]+)\\/(?:[^\\/]+)\\/([^\\/]+)(?:\\/?(?:[^\\/]+)?\\/?)?");
Expand Down Expand Up @@ -204,14 +203,15 @@ private AudioItem buildTrack(@Nullable JsonBrowser data, String pageURl) {
}

return new RedditAudioTrack(
new AudioTrackInfoWithImage(
new AudioTrackInfo(
data.get("title").safeText(),
"u/" + data.get("author").safeText(),
media.get("duration").asLong(1) * 1000,
videoId,
false,
pageURl,
thumbnail
thumbnail,
null
),
this
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.dunctebot.sourcemanagers.tiktok;

import com.dunctebot.sourcemanagers.AbstractDuncteBotHttpSource;
import com.dunctebot.sourcemanagers.AudioTrackInfoWithImage;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
import com.sedmelluq.discord.lavaplayer.tools.ExceptionTools;
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
Expand Down Expand Up @@ -185,15 +184,16 @@ protected static class MetaData {
// author
String uniqueId;

AudioTrackInfoWithImage toTrackInfo() {
return new AudioTrackInfoWithImage(
AudioTrackInfo toTrackInfo() {
return new AudioTrackInfo(
this.title,
this.uniqueId,
this.duration * 1000L,
this.videoId,
false,
this.pageUrl,
this.cover
this.cover,
null
);
}

Expand Down

0 comments on commit f14589b

Please sign in to comment.