diff options
author | ByteHamster <info@bytehamster.com> | 2020-02-12 17:35:09 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2020-02-12 17:35:09 +0100 |
commit | d4948f91a1e38e64614d226a024c219acbceff22 (patch) | |
tree | 5be443061dc9a676261d6d62d3097be6d608ca43 /core/src | |
parent | 419077043effff901729dcb875bc753b77ad680a (diff) | |
download | AntennaPod-d4948f91a1e38e64614d226a024c219acbceff22.zip |
Removed mime type
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/EmbeddedChapterImage.java | 24 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ChapterReader.java | 3 |
2 files changed, 10 insertions, 17 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/EmbeddedChapterImage.java b/core/src/main/java/de/danoeh/antennapod/core/util/EmbeddedChapterImage.java index ac55d0cfd..deeba9238 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/EmbeddedChapterImage.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/EmbeddedChapterImage.java @@ -2,37 +2,31 @@ package de.danoeh.antennapod.core.util; import android.text.TextUtils; import de.danoeh.antennapod.core.util.playback.Playable; -import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; public class EmbeddedChapterImage { - private static final Pattern EMBEDDED_IMAGE_MATCHER = Pattern.compile("embedded-image://(.*)@(\\d+):(\\d+)"); - final String mime; - final int position; - final int length; + private static final Pattern EMBEDDED_IMAGE_MATCHER = Pattern.compile("embedded-image://(\\d+)/(\\d+)"); + + private final int position; + private final int length; private final String imageUrl; - final Playable media; + private final Playable media; public EmbeddedChapterImage(Playable media, String imageUrl) { this.media = media; this.imageUrl = imageUrl; Matcher m = EMBEDDED_IMAGE_MATCHER.matcher(imageUrl); if (m.find()) { - this.mime = m.group(1); - this.position = Integer.parseInt(m.group(2)); - this.length = Integer.parseInt(m.group(3)); + this.position = Integer.parseInt(m.group(1)); + this.length = Integer.parseInt(m.group(2)); } else { throw new IllegalArgumentException("Not an embedded chapter"); } } - public static String makeUrl(String mime, int position, int length) { - return "embedded-image://" + mime + "@" + position + ":" + length; - } - - public String getMime() { - return mime; + public static String makeUrl(int position, int length) { + return "embedded-image://" + position + "/" + length; } public int getPosition() { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ChapterReader.java b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ChapterReader.java index 934e0b00c..ce3577a9e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ChapterReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ChapterReader.java @@ -105,8 +105,7 @@ public class ChapterReader extends ID3Reader { // Data contains the picture int length = header.getSize() - read; if (TextUtils.isEmpty(currentChapter.getImageUrl()) || type == IMAGE_TYPE_COVER) { - currentChapter.setImageUrl( - EmbeddedChapterImage.makeUrl(mime.toString(), input.getCount(), length)); + currentChapter.setImageUrl(EmbeddedChapterImage.makeUrl(input.getCount(), length)); } skipBytes(input, length); } |