mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
Update User-Agent strings
This commit is contained in:
parent
2843a3b6d7
commit
2673742d8d
@ -7,7 +7,7 @@ const { filePathToPOSIX } = require('./fileUtils')
|
|||||||
|
|
||||||
function escapeSingleQuotes(path) {
|
function escapeSingleQuotes(path) {
|
||||||
// return path.replace(/'/g, '\'\\\'\'')
|
// return path.replace(/'/g, '\'\\\'\'')
|
||||||
return filePathToPOSIX(path).replace(/ /g, '\\ ').replace(/'/g, '\\\'')
|
return filePathToPOSIX(path).replace(/ /g, '\\ ').replace(/'/g, "\\'")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns first track start time
|
// Returns first track start time
|
||||||
@ -19,7 +19,7 @@ async function writeConcatFile(tracks, outputPath, startTime = 0) {
|
|||||||
// Find first track greater than startTime
|
// Find first track greater than startTime
|
||||||
if (startTime > 0) {
|
if (startTime > 0) {
|
||||||
var currTrackEnd = 0
|
var currTrackEnd = 0
|
||||||
var startingTrack = tracks.find(t => {
|
var startingTrack = tracks.find((t) => {
|
||||||
currTrackEnd += t.duration
|
currTrackEnd += t.duration
|
||||||
return startTime < currTrackEnd
|
return startTime < currTrackEnd
|
||||||
})
|
})
|
||||||
@ -29,8 +29,8 @@ async function writeConcatFile(tracks, outputPath, startTime = 0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var tracksToInclude = tracks.filter(t => t.index >= trackToStartWithIndex)
|
var tracksToInclude = tracks.filter((t) => t.index >= trackToStartWithIndex)
|
||||||
var trackPaths = tracksToInclude.map(t => {
|
var trackPaths = tracksToInclude.map((t) => {
|
||||||
var line = 'file ' + escapeSingleQuotes(t.metadata.path) + '\n' + `duration ${t.duration}`
|
var line = 'file ' + escapeSingleQuotes(t.metadata.path) + '\n' + `duration ${t.duration}`
|
||||||
return line
|
return line
|
||||||
})
|
})
|
||||||
@ -99,6 +99,9 @@ module.exports.downloadPodcastEpisode = (podcastEpisodeDownload) => {
|
|||||||
url: podcastEpisodeDownload.url,
|
url: podcastEpisodeDownload.url,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
responseType: 'stream',
|
responseType: 'stream',
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'audiobookshelf (+https://audiobookshelf.org; like iTMS)'
|
||||||
|
},
|
||||||
timeout: 30000
|
timeout: 30000
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
Logger.error(`[ffmpegHelpers] Failed to download podcast episode with url "${podcastEpisodeDownload.url}"`, error)
|
Logger.error(`[ffmpegHelpers] Failed to download podcast episode with url "${podcastEpisodeDownload.url}"`, error)
|
||||||
@ -108,35 +111,31 @@ module.exports.downloadPodcastEpisode = (podcastEpisodeDownload) => {
|
|||||||
|
|
||||||
const ffmpeg = Ffmpeg(response.data)
|
const ffmpeg = Ffmpeg(response.data)
|
||||||
ffmpeg.addOption('-loglevel debug') // Debug logs printed on error
|
ffmpeg.addOption('-loglevel debug') // Debug logs printed on error
|
||||||
ffmpeg.outputOptions(
|
ffmpeg.outputOptions('-c:a', 'copy', '-map', '0:a', '-metadata', 'podcast=1')
|
||||||
'-c:a', 'copy',
|
|
||||||
'-map', '0:a',
|
|
||||||
'-metadata', 'podcast=1'
|
|
||||||
)
|
|
||||||
|
|
||||||
const podcastMetadata = podcastEpisodeDownload.libraryItem.media.metadata
|
const podcastMetadata = podcastEpisodeDownload.libraryItem.media.metadata
|
||||||
const podcastEpisode = podcastEpisodeDownload.podcastEpisode
|
const podcastEpisode = podcastEpisodeDownload.podcastEpisode
|
||||||
const finalSizeInBytes = Number(podcastEpisode.enclosure?.length || 0)
|
const finalSizeInBytes = Number(podcastEpisode.enclosure?.length || 0)
|
||||||
|
|
||||||
const taggings = {
|
const taggings = {
|
||||||
'album': podcastMetadata.title,
|
album: podcastMetadata.title,
|
||||||
'album-sort': podcastMetadata.title,
|
'album-sort': podcastMetadata.title,
|
||||||
'artist': podcastMetadata.author,
|
artist: podcastMetadata.author,
|
||||||
'artist-sort': podcastMetadata.author,
|
'artist-sort': podcastMetadata.author,
|
||||||
'comment': podcastEpisode.description,
|
comment: podcastEpisode.description,
|
||||||
'subtitle': podcastEpisode.subtitle,
|
subtitle: podcastEpisode.subtitle,
|
||||||
'disc': podcastEpisode.season,
|
disc: podcastEpisode.season,
|
||||||
'genre': podcastMetadata.genres.length ? podcastMetadata.genres.join(';') : null,
|
genre: podcastMetadata.genres.length ? podcastMetadata.genres.join(';') : null,
|
||||||
'language': podcastMetadata.language,
|
language: podcastMetadata.language,
|
||||||
'MVNM': podcastMetadata.title,
|
MVNM: podcastMetadata.title,
|
||||||
'MVIN': podcastEpisode.episode,
|
MVIN: podcastEpisode.episode,
|
||||||
'track': podcastEpisode.episode,
|
track: podcastEpisode.episode,
|
||||||
'series-part': podcastEpisode.episode,
|
'series-part': podcastEpisode.episode,
|
||||||
'title': podcastEpisode.title,
|
title: podcastEpisode.title,
|
||||||
'title-sort': podcastEpisode.title,
|
'title-sort': podcastEpisode.title,
|
||||||
'year': podcastEpisode.pubYear,
|
year: podcastEpisode.pubYear,
|
||||||
'date': podcastEpisode.pubDate,
|
date: podcastEpisode.pubDate,
|
||||||
'releasedate': podcastEpisode.pubDate,
|
releasedate: podcastEpisode.pubDate,
|
||||||
'itunes-id': podcastMetadata.itunesId,
|
'itunes-id': podcastMetadata.itunesId,
|
||||||
'podcast-type': podcastMetadata.type,
|
'podcast-type': podcastMetadata.type,
|
||||||
'episode-type': podcastMetadata.episodeType
|
'episode-type': podcastMetadata.episodeType
|
||||||
|
@ -255,6 +255,9 @@ module.exports.downloadFile = (url, filepath, contentTypeFilter = null) => {
|
|||||||
url,
|
url,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
responseType: 'stream',
|
responseType: 'stream',
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'audiobookshelf (+https://audiobookshelf.org)'
|
||||||
|
},
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
httpAgent: global.DisableSsrfRequestFilter ? null : ssrfFilter(url),
|
httpAgent: global.DisableSsrfRequestFilter ? null : ssrfFilter(url),
|
||||||
httpsAgent: global.DisableSsrfRequestFilter ? null : ssrfFilter(url)
|
httpsAgent: global.DisableSsrfRequestFilter ? null : ssrfFilter(url)
|
||||||
|
@ -235,7 +235,7 @@ module.exports.getPodcastFeed = (feedUrl, excludeEpisodeMetadata = false) => {
|
|||||||
responseType: 'arraybuffer',
|
responseType: 'arraybuffer',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/rss+xml, application/xhtml+xml, application/xml, */*;q=0.8',
|
Accept: 'application/rss+xml, application/xhtml+xml, application/xml, */*;q=0.8',
|
||||||
'User-Agent': 'audiobookshelf (+https://github.com/advplyr/audiobookshelf; like iTMS)'
|
'User-Agent': 'audiobookshelf (+https://audiobookshelf.org; like iTMS)'
|
||||||
},
|
},
|
||||||
httpAgent: global.DisableSsrfRequestFilter ? null : ssrfFilter(feedUrl),
|
httpAgent: global.DisableSsrfRequestFilter ? null : ssrfFilter(feedUrl),
|
||||||
httpsAgent: global.DisableSsrfRequestFilter ? null : ssrfFilter(feedUrl)
|
httpsAgent: global.DisableSsrfRequestFilter ? null : ssrfFilter(feedUrl)
|
||||||
|
Loading…
Reference in New Issue
Block a user