Skip to content

Commit

Permalink
Merge pull request #700 from podverse/develop
Browse files Browse the repository at this point in the history
Release v4.15.4
  • Loading branch information
mitchdowney committed Nov 17, 2023
2 parents 34b40fa + 85ae98b commit b15af5e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "podverse-api",
"version": "4.15.3",
"version": "4.15.5",
"description": "Data API, database migration scripts, and backend services for all Podverse models.",
"contributors": [
"Mitch Downey"
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/episode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ const generateEpisodeSelects = (
}

if (podcastsOnly) {
qb.andWhere(`podcast.medium = 'podcast'`)
qb.andWhere(`podcast.medium = 'podcast' OR podcast."hasVideo" IS true`)
}

if (liveItemStatus) {
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/mediaRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ const getMediaRefs = async (query, isFromManticoreSearch?, totalOverride?) => {
}

if (podcastsOnly) {
qb.andWhere(`podcast.medium = 'podcast'`)
qb.andWhere(`podcast.medium = 'podcast' OR podcast."hasVideo" IS true`)
}

const allowRandom = podcastIds.length > 0 || episodeIds.length > 0
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/podcast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const getPodcastsFromSearchEngine = async (query) => {
} else if (isMusic) {
extraQuery = `AND medium = 'music'`
} else if (podcastsOnly) {
extraQuery = `AND medium = 'podcast'`
extraQuery = `AND medium = 'podcast' OR hasvideo = 1`
}

const safeSqlString = SqlString.format(
Expand Down Expand Up @@ -271,7 +271,7 @@ const getPodcasts = async (query, countOverride?, isFromManticoreSearch?) => {
}

if (podcastsOnly) {
qb.andWhere(`podcast.medium = 'podcast'`)
qb.andWhere(`podcast.medium = 'podcast' OR podcast."hasVideo" IS true`)
}

const allowRandom = !!podcastIds
Expand Down
2 changes: 2 additions & 0 deletions src/middleware/queryValidation/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const validateEpisodeSearch = async (ctx, next) => {
isMusic: Joi.boolean(),
maxResults: Joi.boolean(),
podcastId: Joi.string(),
podcastsOnly: Joi.boolean(),
searchTitle: Joi.string().min(2),
sincePubDate: Joi.date().iso(),
categories: Joi.string(),
Expand Down Expand Up @@ -97,6 +98,7 @@ const validateMediaRefSearch = async (ctx, next) => {
includePodcast: Joi.boolean(),
isMusic: Joi.boolean(),
podcastId: Joi.string(),
podcastsOnly: Joi.boolean(),
searchTitle: Joi.string().min(2),
page: Joi.number().integer().min(0),
skip: Joi.number().integer().min(0),
Expand Down
10 changes: 8 additions & 2 deletions src/services/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -962,9 +962,15 @@ const assignParsedEpisodeData = async (
episode.imageUrl = parsedEpisode.imageURL
episode.isExplicit = parsedEpisode.explicit

episode.itunesEpisode = parsedEpisode && Math.floor(parsedEpisode.itunesEpisode)
if (typeof parsedEpisode?.itunesEpisode === 'number') {
episode.itunesEpisode = Math.floor(parsedEpisode.itunesEpisode)
}

episode.itunesEpisodeType = parsedEpisode.itunesEpisodeType
episode.itunesSeason = parsedEpisode.itunesSeason

if (typeof parsedEpisode?.itunesSeason === 'number') {
episode.itunesSeason = Math.floor(parsedEpisode.itunesSeason)
}

episode.linkUrl = parsedEpisode.link

Expand Down

0 comments on commit b15af5e

Please sign in to comment.