Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/advplyr/audiobookshelf-app
Browse files Browse the repository at this point in the history
…into AudbleApp
  • Loading branch information
Oasis256 committed Jan 5, 2025
2 parents 2e0803a + d8accce commit 98072ca
Show file tree
Hide file tree
Showing 20 changed files with 161 additions and 15 deletions.
5 changes: 2 additions & 3 deletions components/connection/ServerConnectForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,8 @@ export default {
validateServerUrl(url, protocolOverride = null) {
try {
var urlObject = new URL(url)
var address = `${protocolOverride ? protocolOverride : urlObject.protocol}//${urlObject.hostname}`
if (urlObject.port) address += ':' + urlObject.port
return address
if (protocolOverride) urlObject.protocol = protocolOverride
return urlObject.href
} catch (error) {
console.error('Invalid URL', error)
return null
Expand Down
16 changes: 11 additions & 5 deletions plugins/capacitor/AbsAudioPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ class AbsAudioPlayerWeb extends WebPlugin {

// Use startTime to find current track index
get currentTrackIndex() {
return Math.max(0, this.audioTracks.findIndex(t => Math.floor(t.startOffset) <= this.startTime && Math.floor(t.startOffset + t.duration) > this.startTime))
return Math.max(
0,
this.audioTracks.findIndex((t) => Math.floor(t.startOffset) <= this.startTime && Math.floor(t.startOffset + t.duration) > this.startTime)
)
}
get currentTrack() {
return this.audioTracks[this.currentTrackIndex]
Expand All @@ -37,7 +40,7 @@ class AbsAudioPlayerWeb extends WebPlugin {
}
get totalDuration() {
var total = 0
this.audioTracks.forEach(at => total += at.duration)
this.audioTracks.forEach((at) => (total += at.duration))
return total
}
get playerPlaying() {
Expand Down Expand Up @@ -194,7 +197,8 @@ class AbsAudioPlayerWeb extends WebPlugin {
// var lastBufferTime = this.getLastBufferedTime()
}
evtEnded() {
if (this.currentTrackIndex < this.audioTracks.length - 1) { // Has next track
if (this.currentTrackIndex < this.audioTracks.length - 1) {
// Has next track
console.log(`[AbsAudioPlayer] Track ended - loading next track ${this.currentTrackIndex + 1}`)
var nextTrack = this.audioTracks[this.currentTrackIndex + 1]
this.playWhenReady = true
Expand All @@ -221,7 +225,7 @@ class AbsAudioPlayerWeb extends WebPlugin {
this.player.play()
}
}
evtTimeupdate() { }
evtTimeupdate() {}

sendPlaybackMetadata(playerState) {
this.notifyListeners('onMetadata', {
Expand All @@ -235,7 +239,9 @@ class AbsAudioPlayerWeb extends WebPlugin {
if (!this.currentTrack) return
// When direct play track is loaded current time needs to be set
this.trackStartTime = Math.max(0, this.startTime - (this.currentTrack.startOffset || 0))
this.player.src = `${vuexStore.getters['user/getServerAddress']}${this.currentTrack.contentUrl}?token=${vuexStore.getters['user/getToken']}`
const serverAddressUrl = new URL(vuexStore.getters['user/getServerAddress'])
const serverHost = `${serverAddressUrl.protocol}//${serverAddressUrl.host}`
this.player.src = `${serverHost}${this.currentTrack.contentUrl}?token=${vuexStore.getters['user/getToken']}`
console.log(`[AbsAudioPlayer] Loading track src ${this.player.src}`)
this.player.load()
this.player.playbackRate = this.playbackRate
Expand Down
9 changes: 7 additions & 2 deletions plugins/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,19 @@ class ServerSocket extends EventEmitter {
this.serverAddress = serverAddress
this.token = token

console.log('[SOCKET] Connect Socket', this.serverAddress)
const serverUrl = new URL(serverAddress)
const serverHost = `${serverUrl.protocol}//${serverUrl.host}`
const serverPath = serverUrl.pathname === '/' ? '' : serverUrl.pathname

console.log(`[SOCKET] Connecting to ${serverHost} with path ${serverPath}/socket.io`)

const socketOptions = {
transports: ['websocket'],
upgrade: false,
path: `${serverPath}/socket.io`
// reconnectionAttempts: 3
}
this.socket = io(this.serverAddress, socketOptions)
this.socket = io(serverHost, socketOptions)
this.setSocketListeners()
}

Expand Down
4 changes: 2 additions & 2 deletions store/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const getters = {
// return `http://localhost:3333/api/items/${libraryItem.id}/cover?token=${userToken}&ts=${lastUpdate}`
}

const url = new URL(`/api/items/${libraryItem.id}/cover`, serverAddress)
const url = new URL(`${serverAddress}/api/items/${libraryItem.id}/cover`)
return `${url}?token=${userToken}&ts=${lastUpdate}${raw ? '&raw=1' : ''}`
},
getLibraryItemCoverSrcById: (state, getters, rootState, rootGetters) => (libraryItemId, placeholder = null) => {
Expand All @@ -79,7 +79,7 @@ export const getters = {
const serverAddress = rootGetters['user/getServerAddress']
if (!userToken || !serverAddress) return placeholder

const url = new URL(`/api/items/${libraryItemId}/cover`, serverAddress)
const url = new URL(`${serverAddress}/api/items/${libraryItemId}/cover`)
return `${url}?token=${userToken}`
},
getLocalMediaProgressById: (state) => (localLibraryItemId, episodeId = null) => {
Expand Down
1 change: 1 addition & 0 deletions strings/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"ButtonAuthors": "المؤلفون",
"ButtonBack": "الرجوع",
"ButtonCancel": "إلغاء",
"ButtonCancelTimer": "إلغاء المؤقت",
"ButtonClearFilter": "تصفية الفرز",
"ButtonCloseFeed": "إغلاق",
"ButtonCollections": "المجموعات",
Expand Down
46 changes: 46 additions & 0 deletions strings/be.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"ButtonAdd": "Дадаць",
"ButtonAddNewServer": "Дадаць новы сервер",
"ButtonAuthors": "Аўтары",
"ButtonBack": "Назад",
"ButtonCancel": "Адмяніць",
"ButtonClearFilter": "Ачысціць фільтр",
"ButtonCloseFeed": "Закрыць стужку",
"ButtonCollections": "Калекцыі",
"ButtonConnect": "Падлучыцца",
"ButtonConnectToServer": "Падлучыцца да сервера",
"ButtonCreate": "Ствараць",
"ButtonCreateBookmark": "Стварыць закладку",
"ButtonDelete": "Выдаліць",
"ButtonDeleteLocalEpisode": "Выдаліць лакальны эпізод",
"ButtonDeleteLocalFile": "Выдаліць лакальны файл",
"ButtonDeleteLocalItem": "Выдаліць лакальны элемент",
"ButtonDisableAutoTimer": "Адключыць аўтаматычны таймер",
"ButtonGoToWebClient": "Перайсці ў вэб-кліент",
"ButtonHistory": "Гісторыя",
"ButtonLibrary": "Бібліятэка",
"ButtonLocalMedia": "Лакальныя медыя",
"ButtonManageLocalFiles": "Кіраванне лакальнымі файламі",
"ButtonNewFolder": "Новая тэчка",
"ButtonNextEpisode": "Наступны эпізод",
"ButtonOpenFeed": "Адкрыць стужку",
"ButtonPause": "Паўза",
"ButtonPlaying": "Прайграваецца",
"ButtonPlaylists": "Плэйлісты",
"ButtonRemoveFromServer": "Выдаліць з сервера",
"ButtonSave": "Захаваць",
"ButtonSaveOrder": "Захаваць парадак",
"ButtonSearch": "Пошук",
"ButtonSwitchServerUser": "Змяніць Сервер/Карыстальніка",
"ButtonUserStats": "Статыстыка карыстальніка",
"ButtonYes": "Так",
"HeaderAccount": "Уліковы запіс",
"HeaderCollection": "Калекцыя",
"HeaderCollectionItems": "Элементы калекцыі",
"HeaderConnectionStatus": "Стан злучэння",
"ToastPodcastCreateFailed": "Не ўдалося стварыць падкаст",
"ToastPodcastCreateSuccess": "Падкаст паспяхова створаны",
"ToastRSSFeedCloseFailed": "Не ўдалося закрыць RSS-стужку",
"ToastRSSFeedCloseSuccess": "RSS-стужка закрыта",
"ToastStreamingNotAllowedOnCellular": "Патокавая перадача праз мабільную сувязь забаронена"
}
21 changes: 20 additions & 1 deletion strings/bg.json
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
{}
{
"ButtonAddNewServer": "",
"ButtonAuthors": "",
"ButtonBack": "",
"ButtonCancel": "",
"ButtonCancelTimer": "",
"ButtonClearFilter": "",
"ButtonCloseFeed": "",
"ButtonCollections": "",
"ButtonConnect": "",
"ButtonConnectToServer": "",
"ButtonCreate": "",
"ButtonCreateBookmark": "",
"ButtonCreateNewPlaylist": "",
"ButtonDelete": "",
"ButtonDeleteLocalEpisode": "",
"ButtonDeleteLocalFile": "",
"ButtonDeleteLocalItem": "",
"ButtonDisableAutoTimer": ""
}
1 change: 0 additions & 1 deletion strings/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
"HeaderUserInterfaceSettings": "Configuració de la interfície d'usuari",
"HeaderYourStats": "Les teves estadístiques",
"LabelAddToPlaylist": "Afegit a la llista de reproducció",
"LabelAdded": "Afegit",
"LabelAddedAt": "Afegit a",
"LabelAll": "Tots",
"LabelAllowSeekingOnMediaControls": "Permetre la cerca en controls de mitjans",
Expand Down
15 changes: 15 additions & 0 deletions strings/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"ButtonPlaying": "Přehrává se",
"ButtonPlaylists": "Seznamy skladeb",
"ButtonRead": "Číst",
"ButtonReadLess": "Číst méně",
"ButtonReadMore": "Číst další",
"ButtonRemove": "Odstranit",
"ButtonRemoveFromServer": "Odstranit ze serveru",
"ButtonSave": "Uložit",
Expand Down Expand Up @@ -85,6 +87,7 @@
"HeaderYourStats": "Vaše statistiky",
"LabelAddToPlaylist": "Přidat do seznamu skladeb",
"LabelAddedAt": "Přidáno v",
"LabelAddedDate": "Přidáno {0}",
"LabelAll": "Vše",
"LabelAllowSeekingOnMediaControls": "Povolit vyhledávání polohy v ovládacích prvcích oznámení médií",
"LabelAlways": "Vždy",
Expand Down Expand Up @@ -175,12 +178,16 @@
"LabelNarrators": "Vypravěči",
"LabelNavigateWithVolume": "Navigace pomocí tlačítek hlasitosti",
"LabelNavigateWithVolumeMirrored": "Zrcadleno",
"LabelNavigateWithVolumeWhilePlaying": "Umožnit navigaci pomocí tlačítek hlasitosti během přehrávání",
"LabelNavigateWithVolumeWhilePlayingDisabled": "Vypnuto",
"LabelNavigateWithVolumeWhilePlayingEnabled": "Zapnuto",
"LabelNever": "Nikdy",
"LabelNewestAuthors": "Nejnovější autoři",
"LabelNewestEpisodes": "Nejnovější epizody",
"LabelNo": "Ne",
"LabelNotFinished": "Nedokončeno",
"LabelNotStarted": "Nezahájeno",
"LabelNumEpisodes": "{0} epizod",
"LabelOff": "Vypnout",
"LabelOn": "Zapnuto",
"LabelPassword": "Heslo",
Expand All @@ -195,6 +202,7 @@
"LabelProgress": "Průběh",
"LabelPubDate": "Datum vydání",
"LabelPublishYear": "Rok vydání",
"LabelPublishedDate": "Vydáno {0}",
"LabelRSSFeedCustomOwnerEmail": "Vlastní e-mail vlastníka",
"LabelRSSFeedCustomOwnerName": "Vlastní jméno vlastníka",
"LabelRSSFeedPreventIndexing": "Zabránit indexování",
Expand Down Expand Up @@ -238,12 +246,15 @@
"LabelTotalTrack": "Celková stopa",
"LabelTracks": "Stopy",
"LabelType": "Typ",
"LabelUnknown": "Neznámý",
"LabelUnlockPlayer": "Odemknout přehrávač",
"LabelUseBookshelfView": "Použít vzhled knihovny",
"LabelUser": "Uživatel",
"LabelUsername": "Uživatelské jméno",
"LabelVeryHigh": "Velmi vysoké",
"LabelVeryLow": "Velmi nízké",
"LabelYearReviewHide": "Skrýt rok v přehledu",
"LabelYearReviewShow": "Zobrazit rok v přehledu",
"LabelYourBookmarks": "Vaše záložky",
"LabelYourProgress": "Váš pokrok",
"MessageAndroid10Downloads": "Android 10 a starší budou používat interní úložiště aplikace pro stahování.",
Expand Down Expand Up @@ -277,6 +288,7 @@
"MessageMediaNotLinkedToServer": "Média nejsou propojena se serverem Audiobookshelf. Pokrok nebude synchronizován.",
"MessageNoBookmarks": "Žádné záložky",
"MessageNoChapters": "Žádné kapitoly",
"MessageNoCollections": "Žádné kolekce",
"MessageNoItems": "Žádné položky",
"MessageNoItemsFound": "Nebyly nalezeny žádné položky",
"MessageNoListeningSessions": "Žádné poslechové relace",
Expand All @@ -286,8 +298,11 @@
"MessageNoSeries": "Žádné série",
"MessageNoUpdatesWereNecessary": "Nebyly nutné žádné aktualizace",
"MessageNoUserPlaylists": "Nemáte žádné seznamy skladeb",
"MessagePodcastSearchField": "Zadejte hledaný výraz nebo adresu URL kanálu RSS",
"MessageReportBugsAndContribute": "Nahlašte chyby, vyžádejte si funkce a přispěte na",
"MessageSeriesAlreadyDownloaded": "Všechny knihy v této sérii jste již stáhli.",
"MessageSeriesDownloadConfirm": "Stáhnout chybějící {0} knihu(y) s {1} souborem(y), celkem {2} do složky {3}?",
"MessageSeriesDownloadConfirmIos": "Stáhnout chybějící {0} knihu(y) s {1} souborem(y), celkem {2}?",
"MessageSocketConnectedOverMeteredCellular": "Socket připojen přes měřenou mobilní síť",
"MessageSocketConnectedOverMeteredWifi": "Socket připojen přes měřenou Wi-Fi",
"MessageSocketConnectedOverUnmeteredCellular": "Socket připojen přes neměřenou mobilní síť",
Expand Down
2 changes: 2 additions & 0 deletions strings/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@
"LabelNavigateWithVolume": "Mit Lautstärke blättern",
"LabelNavigateWithVolumeMirrored": "Umgekehrt",
"LabelNavigateWithVolumeWhilePlaying": "Auch bei Wiedergabe mit Lautstärketasten blättern",
"LabelNavigateWithVolumeWhilePlayingDisabled": "Aus",
"LabelNavigateWithVolumeWhilePlayingEnabled": "An",
"LabelNever": "Nie",
"LabelNewestAuthors": "Neueste Autoren",
"LabelNewestEpisodes": "Neueste Episoden",
Expand Down
3 changes: 3 additions & 0 deletions strings/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@
"LabelNarrators": "Narradores",
"LabelNavigateWithVolume": "Navegar con las teclas de volumen",
"LabelNavigateWithVolumeMirrored": "Espejo",
"LabelNavigateWithVolumeWhilePlaying": "También puede utilizar los botones de volumen para desplazarse durante la reproducción",
"LabelNavigateWithVolumeWhilePlayingDisabled": "Apagado",
"LabelNavigateWithVolumeWhilePlayingEnabled": "Encender",
"LabelNever": "Nunca",
"LabelNewestAuthors": "Autores más recientes",
"LabelNewestEpisodes": "Episodios más recientes",
Expand Down
3 changes: 3 additions & 0 deletions strings/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@
"LabelNarrators": "Narrateurs",
"LabelNavigateWithVolume": "Naviguer avec les touches de volume",
"LabelNavigateWithVolumeMirrored": "En miroir",
"LabelNavigateWithVolumeWhilePlaying": "Autoriser les touches de volume à naviguer durant la lecture",
"LabelNavigateWithVolumeWhilePlayingDisabled": "Désactivé",
"LabelNavigateWithVolumeWhilePlayingEnabled": "Activé",
"LabelNever": "Jamais",
"LabelNewestAuthors": "Auteurs récents",
"LabelNewestEpisodes": "Épisodes récents",
Expand Down
8 changes: 8 additions & 0 deletions strings/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
"ButtonDisconnect": "התנתק",
"ButtonGoToWebClient": "עבור לדפדפן",
"ButtonHistory": "היסטוריה",
"ButtonHome": "בית",
"ButtonIssues": "בעיות",
"ButtonLatest": "אחרון",
"ButtonLibrary": "ספרייה",
"ButtonPlay": "נגן",
"ButtonPlayEpisode": "נגן פרק",
"ButtonPlaying": "מנגן",
"ButtonPlaylists": "רשימת השמעה",
"HeaderOpenRSSFeed": "פתח ערוץ RSS",
"LabelAddedDate": "נוסף ב-{0}"
}
3 changes: 3 additions & 0 deletions strings/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@
"LabelNarrators": "Pripovjedači",
"LabelNavigateWithVolume": "Navigacija tipkama za glasnoću",
"LabelNavigateWithVolumeMirrored": "Zrcali",
"LabelNavigateWithVolumeWhilePlaying": "Dozvoli navigaciju tipkama za glasnoću tijekom reprodukcije",
"LabelNavigateWithVolumeWhilePlayingDisabled": "Isključeno",
"LabelNavigateWithVolumeWhilePlayingEnabled": "Uključeno",
"LabelNever": "Nikada",
"LabelNewestAuthors": "Najnoviji autori",
"LabelNewestEpisodes": "Najnovije epizode",
Expand Down
8 changes: 7 additions & 1 deletion strings/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"ButtonAddNewServer": "Új szerver hozzáadása",
"ButtonAuthors": "Szerzők",
"ButtonBack": "Vissza",
"ButtonCancel": "Mégse",
"ButtonCancel": "Mégsem",
"ButtonCancelTimer": "Időzítő megszakítása",
"ButtonClearFilter": "Szűrő törlése",
"ButtonCloseFeed": "Hírcsatorna bezárása",
Expand Down Expand Up @@ -180,6 +180,9 @@
"LabelNarrators": "Előadók",
"LabelNavigateWithVolume": "Navigálás a hangerőgombokkal",
"LabelNavigateWithVolumeMirrored": "Tükrözve",
"LabelNavigateWithVolumeWhilePlaying": "Lehetővé teszi a hangerőszabályzó gombokkal történő navigálást lejátszás közben",
"LabelNavigateWithVolumeWhilePlayingDisabled": "Ki",
"LabelNavigateWithVolumeWhilePlayingEnabled": "Be",
"LabelNever": "Soha",
"LabelNewestAuthors": "Legújabb szerzők",
"LabelNewestEpisodes": "Legújabb epizódok",
Expand Down Expand Up @@ -253,6 +256,8 @@
"LabelUsername": "Felhasználónév",
"LabelVeryHigh": "Nagyon magas",
"LabelVeryLow": "Nagyon alacsony",
"LabelYearReviewHide": "A visszatekintés az évre elrejtése",
"LabelYearReviewShow": "Visszatekintés az évre megtekintése",
"LabelYourBookmarks": "Könyvjelzőid",
"LabelYourProgress": "Haladásod",
"MessageAndroid10Downloads": "Az Android 10 és az alatti verziók belső alkalmazástárolót használnak a letöltésekhez.",
Expand Down Expand Up @@ -296,6 +301,7 @@
"MessageNoSeries": "Nincsenek sorozatok",
"MessageNoUpdatesWereNecessary": "Nem volt szükséges frissítés",
"MessageNoUserPlaylists": "Nincsenek lejátszási listái",
"MessagePodcastSearchField": "Adja meg a keresési kifejezést vagy az RSS hírcsatorna URL-címét",
"MessageReportBugsAndContribute": "Hibák jelentése, funkciók kérése és hozzájárulás itt",
"MessageSeriesAlreadyDownloaded": "Ön már letöltötte az összes könyvet a sorozatból.",
"MessageSeriesDownloadConfirm": "Hiányzó {0} könyv(ek) letöltése {1} fájl(ok)kal, összesen {2} mappába {3}?",
Expand Down
Loading

0 comments on commit 98072ca

Please sign in to comment.