diff --git a/client/pages/audiobook/_id/chapters.vue b/client/pages/audiobook/_id/chapters.vue
index 519d0f14..d5351dd5 100644
--- a/client/pages/audiobook/_id/chapters.vue
+++ b/client/pages/audiobook/_id/chapters.vue
@@ -22,16 +22,6 @@
-
-
-
Overdrive Media Markers Found! Would you like to generate chapter data from them?
-
-
Yes
-
-
-
-
-
Start
@@ -95,7 +85,6 @@
check
-
@@ -179,7 +168,6 @@ export default {
asinInput: null,
findingChapters: false,
showFindChaptersModal: false,
- showImportOverdriveMediaMarkersModal: false,
chapterData: null
}
},
@@ -202,19 +190,13 @@ export default {
mediaDuration() {
return this.media.duration
},
- overdriveMediaMarkersExist() {
- return (this.overdriveMediaMarkers?.length > 0 ? true : false ) || false
- },
- overdriveMediaMarkers() {
- return this.audioFiles.map((af) => af.metaTags.tagOverdriveMediaMarker).filter(notUndefined => notUndefined !== undefined) || []
- },
chapters() {
return this.media.chapters || []
},
tracks() {
return this.media.tracks || []
},
- audioFiles() {
+ audioFiles() {
return this.media.audioFiles || []
},
audioTracks() {
@@ -225,13 +207,6 @@ export default {
}
},
methods: {
- checkForOverdriveMediaMarkers() {
- if (this.overdriveMediaMarkersExist) {
- this.$toast.success('Your book has overdrive media markers!')
- } else {
- this.$toast.error('Your book DOES NOT have overdrive media markers!')
- }
- },
editItem() {
this.$store.commit('showEditModal', this.libraryItem)
},
@@ -417,7 +392,7 @@ export default {
this.$toast.error(data.error)
this.showFindChaptersModal = false
} else {
- console.log('Chapter data', JSON.stringify(data))
+ console.log('Chapter data', data)
this.chapterData = data
}
})
@@ -427,100 +402,9 @@ export default {
this.$toast.error('Failed to find chapters')
this.showFindChaptersModal = false
})
- },
- // overdrive
- generateChaptersFromOverdriveMediaMarkers() {
- var parseString = require('xml2js').parseString; // function to convert xml to JSON
- var overdriveMediaMarkers = this.overdriveMediaMarkers // an array of XML. 1 Part.mp3 to 1 array index. Each index holds 1 XML that holds multiple chapters
-
- var parsedOverdriveMediaMarkers = [] // an array of objects. each object being a chapter with a name and time key. the values are arrays of strings
-
- overdriveMediaMarkers.forEach(function (item, index) {
- var parsed_result
- parseString(item, function (err, result) {
- // result.Markers.Marker is the result of parsing the XML for the MediaMarker tags for the MP3 file (Part##.mp3)
- // it is shaped like this:
- // [
- // {
- // "Name": [
- // "Chapter 1: "
- // ],
- // "Time": [
- // "0:00.000"
- // ]
- // },
- // {
- // "Name": [
- // "Chapter 2: "
- // ],
- // "Time": [
- // "15:51.000"
- // ]
- // }
- // ]
-
- parsed_result = result.Markers.Marker
-
- // The values for Name and Time in parsed_results are returned as Arrays from parseString
- // update them to be strings
- parsed_result.forEach((item, index) => {
- Object.keys(item).forEach(key => {
- item[key] = item[key].toString()
- })
- })
- })
-
- parsedOverdriveMediaMarkers.push(parsed_result)
- })
-
- // go from an array of arrays of objects to an array of objects
- // end result looks like:
- // [
- // {
- // "Name": "Chapter 1: The Worst Birthday",
- // "Time": "0:00.000"
- // },
- // {
- // "Name": "Chapter 2: Dobby's Warning",
- // "Time": "15:51.000"
- // },
- // { redacted }
- // ]
- parsedOverdriveMediaMarkers = parsedOverdriveMediaMarkers
-
- var index = 0
-
- var time = 0.0
-
-
- // actually generate the chapter object
- // logic ported over from benonymity's OverdriveChapterizer:
- // https://github.com/benonymity/OverdriveChapterizer/blob/main/chapters.py
- var length = 0.0
- var newOChapters = []
- this.audioTracks.forEach((track, track_index) => {
- parsedOverdriveMediaMarkers[track_index].forEach((chapter) => {
- time = chapter.Time.split(":")
- time = length + parseFloat(time[0]) * 60 + parseFloat(time[1])
- newOChapters.push(
- {
- id: index++,
- start: time,
- end: length,
- title: chapter.Name
- }
- )
- })
- length += track.duration
- })
-
- this.newChapters = newOChapters
}
},
-
mounted() {
- this.checkForOverdriveMediaMarkers()
- var dismissed = false
this.asinInput = this.mediaMetadata.asin || null
this.newChapters = this.chapters.map((c) => ({ ...c }))
if (!this.newChapters.length) {