Skip to content

Commit

Permalink
update for beta test
Browse files Browse the repository at this point in the history
  • Loading branch information
appujet committed May 1, 2024
1 parent c98dea2 commit ef8799d
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 37 deletions.
Binary file added logs/spring.log.2024-04-29.0.gz
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void process(LocalAudioTrackExecutor executor) throws Exception {

protected void loadStream(LocalAudioTrackExecutor localExecutor, HttpInterface httpInterface) throws Exception {
final String trackUrl = getPlaybackUrl();
try (PersistentHttpStream stream = new PersistentHttpStream(httpInterface, new URI(trackUrl), this.getTrackDuration())) {
try (PersistentHttpStream stream = new PersistentHttpStream(httpInterface, new URI(trackUrl), Long.MAX_VALUE)) {
processDelegate(createAudioTrack(this.trackInfo, stream), localExecutor);
}
}
Expand Down
33 changes: 0 additions & 33 deletions main/src/main/java/com/github/appujet/jiosaavn/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,4 @@ public static JsonBrowser fetchJson(String pageURl, ExtendedAudioSourceManager s
throw new RuntimeException(e);
}
}
private static Iterable<Character> cycle(String i) {
return () -> new Iterator<>() {
private int index = -1;

@Override
public boolean hasNext() {
return true;
}

@Override
public Character next() {
index = (index + 1) % i.length();
return i.charAt(index);
}
};
}

private static String decryptXor(String key, String cipher) {
StringBuilder decrypted = new StringBuilder();
Iterator<Character> keyIterator = cycle(key).iterator();
for (char ch : cipher.toCharArray()) {
if (!keyIterator.hasNext())
keyIterator = cycle(key).iterator(); // restart key iterator if it reaches the end
char k = keyIterator.next();
decrypted.append((char) (ch ^ k));
}
return decrypted.toString();
}

public static String decryptUrl(String key, String url) {
String xorUrl = new String(Base64.getDecoder().decode(url));
return decryptXor(key, xorUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ public boolean isTrackEncodable(AudioTrack audioTrack) {

@Override
public void encodeTrack(AudioTrack audioTrack, DataOutput dataOutput) throws IOException {
JioSaavnAudioTrack jioSaavnAudioTrack = (JioSaavnAudioTrack) audioTrack;
DataFormatTools.writeNullableText(dataOutput, jioSaavnAudioTrack.getInfo().identifier);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public JioSaavnAudioTrack(AudioTrackInfo trackInfo, ExtendedAudioSourceManager m

@Override
public String getPlaybackUrl() {
return getDownloadURL(getIdentifier());
return getDownloadURL(this.trackInfo.identifier);
}

private String getDownloadURL(String identifier) {
Expand Down

0 comments on commit ef8799d

Please sign in to comment.