forked from PaulWoitaschek/Voice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose a single chapter reader file and make all other components of the
chapter-reader module internal.
- Loading branch information
1 parent
a07ddba
commit c4ba714
Showing
29 changed files
with
85 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
chapterreader/src/main/java/de/ph1b/audiobook/chapterreader/ChapterReader.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package de.ph1b.audiobook.chapterreader | ||
|
||
import dagger.Reusable | ||
import de.ph1b.audiobook.chapterreader.id3.ID3ChapterReader | ||
import de.ph1b.audiobook.chapterreader.matroska.MatroskaChapterReader | ||
import de.ph1b.audiobook.chapterreader.mp4.Mp4ChapterReader | ||
import de.ph1b.audiobook.chapterreader.ogg.OggChapterReader | ||
import java.io.File | ||
import javax.inject.Inject | ||
|
||
|
||
@Reusable class ChapterReader @Inject internal constructor( | ||
private val oggReader: OggChapterReader, | ||
private val mp4Reader: Mp4ChapterReader, | ||
private val matroskaReader: MatroskaChapterReader, | ||
private val id3Reader: ID3ChapterReader | ||
) { | ||
|
||
fun read(file: File): Map<Int, String> = when (file.extension) { | ||
"mp3" -> id3Reader.read(file) | ||
"mp4", "m4a", "m4b", "aac" -> mp4Reader.readChapters(file) | ||
"opus", "ogg", "oga" -> oggReader.read(file) | ||
"mka", "mkv", "webm" -> matroskaReader.read(file) | ||
else -> emptyMap() | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
chapterreader/src/main/java/de/ph1b/audiobook/chapterreader/id3/ChapterMetaData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package de.ph1b.audiobook.chapterreader.id3 | ||
|
||
internal data class ChapterMetaData( | ||
var id3ID: String, | ||
var start: Int, | ||
var title: String? = null | ||
) |
2 changes: 1 addition & 1 deletion
2
chapterreader/src/main/java/de/ph1b/audiobook/chapterreader/id3/Header.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
chapterreader/src/main/java/de/ph1b/audiobook/chapterreader/id3/ID3ReaderException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package de.ph1b.audiobook.chapterreader.id3 | ||
|
||
class ID3ReaderException(message: String) : Exception(message) | ||
internal class ID3ReaderException(message: String) : Exception(message) | ||
|
2 changes: 1 addition & 1 deletion
2
chapterreader/src/main/java/de/ph1b/audiobook/chapterreader/matroska/MatroskaChapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...reader/src/main/java/de/ph1b/audiobook/chapterreader/matroska/MatroskaChapterFlattener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
chapterreader/src/main/java/de/ph1b/audiobook/chapterreader/matroska/MatroskaChapterName.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package de.ph1b.audiobook.chapterreader.matroska | ||
|
||
data class MatroskaChapterName(val name: String, val languages: Set<String>) | ||
internal data class MatroskaChapterName(val name: String, val languages: Set<String>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
chapterreader/src/main/java/de/ph1b/audiobook/chapterreader/ogg/oggReading/OggPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...der/src/main/java/de/ph1b/audiobook/chapterreader/ogg/oggReading/OggPageParseException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package de.ph1b.audiobook.chapterreader.ogg.oggReading | ||
|
||
class OggPageParseException(message: String) : Exception(message) | ||
internal class OggPageParseException(message: String) : Exception(message) |
5 changes: 1 addition & 4 deletions
5
chapterreader/src/main/java/de/ph1b/audiobook/chapterreader/ogg/oggReading/OggStream.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...c/main/java/de/ph1b/audiobook/chapterreader/ogg/vorbisComment/OpusStreamParseException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package de.ph1b.audiobook.chapterreader.ogg.vorbisComment | ||
|
||
class OpusStreamParseException(message: String) : Exception(message) | ||
internal class OpusStreamParseException(message: String) : Exception(message) |
2 changes: 1 addition & 1 deletion
2
...erreader/src/main/java/de/ph1b/audiobook/chapterreader/ogg/vorbisComment/VorbisComment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ain/java/de/ph1b/audiobook/chapterreader/ogg/vorbisComment/VorbisCommentParseException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package de.ph1b.audiobook.chapterreader.ogg.vorbisComment | ||
|
||
class VorbisCommentParseException(message: String) : Exception(message) | ||
internal class VorbisCommentParseException(message: String) : Exception(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...main/java/de/ph1b/audiobook/chapterreader/ogg/vorbisComment/VorbisStreamParseException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package de.ph1b.audiobook.chapterreader.ogg.vorbisComment | ||
|
||
class VorbisStreamParseException(message: String) : Exception(message) | ||
internal class VorbisStreamParseException(message: String) : Exception(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters