Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Oasis256 committed Jun 14, 2024
2 parents 9863025 + ac8a2ca commit 6b6d93c
Show file tree
Hide file tree
Showing 29 changed files with 330 additions and 260 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/i18n-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20'

# The only argument is the `directory`, which is where the i18n files are
# stored.
- name: Run Update JSON Files action
uses: audiobookshelf/audiobookshelf-i18n-updater@v1.2.0
uses: audiobookshelf/audiobookshelf-i18n-updater@v1.3.0
with:
directory: 'strings/' # Adjust the directory path as needed
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Podcast(
@JsonIgnore
fun addEpisode(audioTrack:AudioTrack, episode:PodcastEpisode):PodcastEpisode {
val localEpisodeId = "local_ep_" + episode.id
val newEpisode = PodcastEpisode(localEpisodeId,(episodes?.size ?: 0) + 1,episode.episode,episode.episodeType,episode.title,episode.subtitle,episode.description,null,null,null,audioTrack,episode.chapters,audioTrack.duration,0, episode.id, localEpisodeId)
val newEpisode = PodcastEpisode(localEpisodeId,(episodes?.size ?: 0) + 1,episode.episode,episode.episodeType,episode.title,episode.subtitle,episode.description,null,null,null,audioTrack,episode.chapters,audioTrack.duration,episode.size, episode.id, localEpisodeId)
episodes?.add(newEpisode)

var index = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class FolderScanner(var ctx: Context) {
)
localLibraryItem.localFiles.add(localFile)

val trackFileMetadata = FileMetadata(file.name, file.extension, file.absolutePath, file.getBasePath(ctx), file.length())
// Create new audio track
val track = AudioTrack(
audioTrackFromServer.index,
Expand All @@ -78,7 +79,7 @@ class FolderScanner(var ctx: Context) {
localFile.filename ?: "",
localFile.contentUrl,
localFile.mimeType ?: "",
null,
trackFileMetadata,
true,
localFileId,
null,
Expand Down Expand Up @@ -274,7 +275,8 @@ class FolderScanner(var ctx: Context) {
localLibraryItem.localFiles.add(localFile)

// Create new audio track
val track = AudioTrack(audioTrackFromServer.index, audioTrackFromServer.startOffset, audioTrackFromServer.duration, localFile.filename ?: "", localFile.contentUrl, localFile.mimeType ?: "", null, true, localFileId, null, audioTrackFromServer.index)
val trackFileMetadata = FileMetadata(docFile.name ?: "", docFile.extension ?: "", docFile.getAbsolutePath(ctx), docFile.getBasePath(ctx), docFile.length())
val track = AudioTrack(audioTrackFromServer.index, audioTrackFromServer.startOffset, audioTrackFromServer.duration, localFile.filename ?: "", localFile.contentUrl, localFile.mimeType ?: "", trackFileMetadata, true, localFileId, null, audioTrackFromServer.index)
audioTracks.add(track)

Log.d(tag, "scanDownloadItem: Created Audio Track with index ${track.index} from local file ${localFile.absolutePath}")
Expand Down
6 changes: 4 additions & 2 deletions components/readers/EpubReader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export default {
ereaderSettings: {
theme: 'dark',
fontScale: 100,
lineSpacing: 115
lineSpacing: 115,
textStroke: 0
}
}
},
Expand Down Expand Up @@ -113,7 +114,8 @@ export default {
'*': {
color: `${fontColor}!important`,
'background-color': `${backgroundColor}!important`,
'line-height': this.ereaderSettings.lineSpacing + '%!important'
'line-height': this.ereaderSettings.lineSpacing + '%!important',
'-webkit-text-stroke': this.ereaderSettings.textStroke/100 + 'px ' + fontColor + '!important'
},
a: {
color: `${fontColor}!important`
Expand Down
21 changes: 14 additions & 7 deletions components/readers/Reader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@
</div>
<ui-range-input v-model="ereaderSettings.lineSpacing" :min="100" :max="300" :step="5" input-width="180px" @input="settingsUpdated" />
</div>
<div class="flex items-center mb-6">
<div class="w-32">
<p class="text-base">{{ $strings.LabelFontBoldness }}:</p>
</div>
<ui-range-input v-model="ereaderSettings.textStroke" :min="0" :max="300" :step="5" input-width="180px" @input="settingsUpdated" />
</div>
<div class="flex items-center">
<div class="w-32">
<p class="text-base">{{ $strings.LabelLayout }}:</p>
Expand Down Expand Up @@ -116,7 +122,8 @@ export default {
theme: 'dark',
fontScale: 100,
lineSpacing: 115,
spread: 'auto'
spread: 'auto',
textStroke: 0
}
}
},
Expand Down Expand Up @@ -369,12 +376,12 @@ export default {
try {
const settings = localStorage.getItem('ereaderSettings')
if (settings) {
const ereaderSettings = JSON.parse(settings)
if (!ereaderSettings.spread) {
// Added in 0.9.71
ereaderSettings.spread = 'auto'
const _ereaderSettings = JSON.parse(settings)
for (const key in this.ereaderSettings) {
if (_ereaderSettings[key] !== undefined) {
this.ereaderSettings[key] = _ereaderSettings[key]
}
}
this.ereaderSettings = ereaderSettings
this.settingsUpdated()
}
} catch (error) {
Expand All @@ -396,4 +403,4 @@ export default {
this.unregisterListeners()
}
}
</script>
</script>
3 changes: 3 additions & 0 deletions pages/downloads.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
</div>
</template>
</div>
<div v-if="localLibraryItems.length" class="mt-4 text-sm text-fg-muted">
{{ $strings.LabelTotalSize }}: {{ $bytesPretty(localLibraryItems.reduce((acc, item) => acc + item.size, 0)) }}
</div>
</div>
</template>

Expand Down
94 changes: 73 additions & 21 deletions pages/localMedia/item/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

<div class="w-full max-w-full media-item-container overflow-y-auto overflow-x-hidden relative pb-4" :class="{ 'media-order-changed': orderChanged }">
<div v-if="!isPodcast && audioTracksCopy.length" class="w-full py-2">
<p class="text-base mb-2">Audio Tracks ({{ audioTracks.length }})</p>
<div class="flex justify-between items-center mb-2">
<p class="text-base">Audio Tracks ({{ audioTracks.length }})</p>
<p class="text-xs text-fg-muted px-2">{{ $strings.LabelTotalSize }}: {{ $bytesPretty(totalAudioSize) }}</p>
</div>

<draggable v-model="audioTracksCopy" v-bind="dragOptions" handle=".drag-handle" draggable=".item" tag="div" @start="drag = true" @end="drag = false" @update="draggableUpdate" :disabled="isIos">
<transition-group type="transition" :name="!drag ? 'dragtrack' : null">
Expand Down Expand Up @@ -46,7 +49,10 @@
</div>

<div v-if="isPodcast" class="w-full py-2">
<p class="text-base mb-2">Episodes ({{ episodes.length }})</p>
<div class="flex justify-between items-center mb-2">
<p class="text-base">Episodes ({{ episodes.length }})</p>
<p class="text-xs text-fg-muted px-2">{{ $strings.LabelTotalSize }}: {{ $bytesPretty(totalEpisodesSize) }}</p>
</div>
<template v-for="episode in episodes">
<div :key="episode.id" class="flex items-center my-1">
<div class="w-10 h-12 flex items-center justify-center" style="min-width: 48px">
Expand Down Expand Up @@ -83,22 +89,31 @@
</div>
</div>

<p v-if="otherFiles.length" class="text-lg py-2">Other Files</p>
<template v-for="file in otherFiles">
<div :key="file.id" class="flex items-center my-1">
<div class="w-12 h-12 flex items-center justify-center">
<img v-if="(file.mimeType || '').startsWith('image')" :src="getCapImageSrc(file.contentUrl)" class="w-full h-full object-contain" />
<span v-else class="material-icons">music_note</span>
</div>
<div class="flex-grow px-2">
<p class="text-sm">{{ file.filename }}</p>
</div>
<div class="w-24 text-center text-fg-muted" style="min-width: 96px">
<p class="text-xs">{{ file.mimeType }}</p>
<p class="text-sm">{{ $bytesPretty(file.size) }}</p>
</div>
<div v-if="otherFiles.length">
<div class="flex justify-between items-center py-2">
<p class="text-lg">Other Files</p>
<p class="text-xs text-fg-muted px-2">{{ $strings.LabelTotalSize }}: {{ $bytesPretty(totalOtherFilesSize) }}</p>
</div>
</template>
<template v-for="file in otherFiles">
<div :key="file.id" class="flex items-center my-1">
<div class="w-12 h-12 flex items-center justify-center">
<img v-if="(file.mimeType || '').startsWith('image')" :src="getCapImageSrc(file.contentUrl)" class="w-full h-full object-contain" />
<span v-else class="material-icons">music_note</span>
</div>
<div class="flex-grow px-2">
<p class="text-sm">{{ file.filename }}</p>
</div>
<div class="w-24 text-center text-fg-muted" style="min-width: 96px">
<p class="text-xs">{{ file.mimeType }}</p>
<p class="text-sm">{{ $bytesPretty(file.size) }}</p>
</div>
</div>
</template>
</div>

<div class="mt-4 text-sm text-fg-muted">
{{ $strings.LabelTotalSize }}: {{ $bytesPretty(totalLibraryItemSize) }}
</div>
</div>
</div>
<div v-else class="px-2 w-full h-full">
Expand Down Expand Up @@ -218,24 +233,46 @@ export default {
},
dialogItems() {
if (this.selectedAudioTrack || this.selectedEpisode) {
return [
const items = [
{
text: this.$strings.ButtonDeleteLocalFile,
value: 'track-delete'
value: 'track-delete',
icon: 'delete'
}
]
if (this.isPodcast && this.selectedEpisode) {
items.unshift({
text: this.$strings.ButtonPlayEpisode,
value: 'play-episode',
icon: 'play_arrow'
})
}
return items
} else {
return [
{
text: this.$strings.ButtonDeleteLocalItem,
value: 'delete'
value: 'delete',
icon: 'delete'
}
]
}
},
playerIsStartingPlayback() {
// Play has been pressed and waiting for native play response
return this.$store.state.playerIsStartingPlayback
},
totalAudioSize() {
return this.audioTracks.reduce((acc, item) => item.metadata ? acc + item.metadata.size : acc, 0)
},
totalEpisodesSize() {
return this.episodes.reduce((acc, item) => acc + item.size, 0)
},
totalOtherFilesSize() {
return this.otherFiles.reduce((acc, item) => acc + item.size, 0)
},
totalLibraryItemSize() {
return this.localFiles.reduce((acc, item) => acc + item.size, 0)
}
},
methods: {
Expand Down Expand Up @@ -291,6 +328,19 @@ export default {
getCapImageSrc(contentUrl) {
return Capacitor.convertFileSrc(contentUrl)
},
async playEpisode() {
if (!this.selectedEpisode) return
if (this.playerIsStartingPlayback) return
await this.$hapticsImpact()
this.$store.commit('setPlayerIsStartingPlayback', this.selectedEpisode.serverEpisodeId)
this.$eventBus.$emit('play-item', {
libraryItemId: this.localLibraryItemId,
episodeId: this.selectedEpisode.id,
serverLibraryItemId: this.libraryItemId,
serverEpisodeId: this.selectedEpisode.serverEpisodeId
})
},
async dialogAction(action) {
console.log('Dialog action', action)
await this.$hapticsImpact()
Expand All @@ -300,8 +350,10 @@ export default {
} else if (action == 'track-delete') {
if (this.isPodcast) this.deleteEpisode()
else this.deleteTrack()
} else if (action == 'play-episode') {
this.playEpisode()
}
this.showDialog = false
this.showDialog = false;
},
getLocalFileForTrack(localFileId) {
return this.localFiles.find((lf) => lf.id == localFileId)
Expand Down
1 change: 1 addition & 0 deletions strings/bn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
20 changes: 10 additions & 10 deletions strings/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@
"HeaderTableOfContents": "Obsah",
"HeaderUserInterfaceSettings": "Nastavení uživatelského rozhraní",
"HeaderYourStats": "Vaše statistiky",
"LabelAddToPlaylist": "Přidat do seznamu skladeb",
"LabelAdded": "Přidáno",
"LabelAddedAt": "Přidáno v",
"LabelAddToPlaylist": "Přidat do seznamu skladeb",
"LabelAll": "Vše",
"LabelAllowSeekingOnMediaControls": "Allow position seeking on media notification controls",
"LabelAlways": "Always",
Expand All @@ -101,8 +101,8 @@
"LabelAutoSleepTimerAutoRewindHelp": "Když dojde k uspání automatickým časovačem spánku, pozice přehrávání je posunuta zpět o vybraný čas.",
"LabelAutoSleepTimerHelp": "Během přehrávání média v časovém rozmezí \"Od\" a \"Do\" se automaticky spustí časovač spánku.",
"LabelBooks": "Knihy",
"LabelChapters": "Kapitoly",
"LabelChapterTrack": "Stopa kapitoly",
"LabelChapters": "Kapitoly",
"LabelClosePlayer": "Zavřít přehrávač",
"LabelCollapseSeries": "Sbalit sérii",
"LabelComplete": "Dokončeno",
Expand All @@ -122,8 +122,8 @@
"LabelDisableVibrateOnResetHelp": "Když je časovač spánku resetován, zařízení zavibruje. Tuto možnost povolte, pokud nechcete, aby zařízení vibrace provádělo při resetování časovače spánku.",
"LabelDiscover": "Objevit",
"LabelDownload": "Stáhnout",
"LabelDownloaded": "Staženo",
"LabelDownloadUsingCellular": "Download using Cellular",
"LabelDownloaded": "Staženo",
"LabelDuration": "Trvání",
"LabelEbook": "E-kniha",
"LabelEbooks": "E-knihy",
Expand All @@ -150,8 +150,8 @@
"LabelHeavy": "Těžké",
"LabelHigh": "Vysoké",
"LabelHost": "Hostitel",
"LabelIncomplete": "Neúplné",
"LabelInProgress": "Probíhá",
"LabelIncomplete": "Neúplné",
"LabelInternalAppStorage": "Interní úložiště aplikace",
"LabelJumpBackwardsTime": "Délka skoku zpět v čase",
"LabelJumpForwardsTime": "Délka skoku vpřed v čase",
Expand Down Expand Up @@ -193,15 +193,15 @@
"LabelProgress": "Průběh",
"LabelPubDate": "Datum vydání",
"LabelPublishYear": "Rok vydání",
"LabelRead": "Číst",
"LabelReadAgain": "Číst znovu",
"LabelRecentlyAdded": "Nedávno přidáno",
"LabelRecentSeries": "Nedávné série",
"LabelRemoveFromPlaylist": "Remove from Playlist",
"LabelRSSFeedCustomOwnerEmail": "Vlastní e-mail vlastníka",
"LabelRSSFeedCustomOwnerName": "Vlastní jméno vlastníka",
"LabelRSSFeedPreventIndexing": "Zabránit indexování",
"LabelRSSFeedSlug": "Klíčové slovo kanálu RSS",
"LabelRead": "Číst",
"LabelReadAgain": "Číst znovu",
"LabelRecentSeries": "Nedávné série",
"LabelRecentlyAdded": "Nedávno přidáno",
"LabelRemoveFromPlaylist": "Remove from Playlist",
"LabelScaleElapsedTimeBySpeed": "Škálovat uplynulý čas podle rychlosti",
"LabelSeason": "Sezóna",
"LabelSelectADevice": "Vyberte zařízení",
Expand Down Expand Up @@ -303,4 +303,4 @@
"ToastRSSFeedCloseFailed": "Nepodařilo se zavřít RSS kanál",
"ToastRSSFeedCloseSuccess": "RSS kanál uzavřen",
"ToastStreamingNotAllowedOnCellular": "Streaming is not allowed on cellular data"
}
}
Loading

0 comments on commit 6b6d93c

Please sign in to comment.