Skip to content

Instantly share code, notes, and snippets.

@suhlig
Created December 18, 2021 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suhlig/aba67dcb687992a7883e73b8c57df3e0 to your computer and use it in GitHub Desktop.
Save suhlig/aba67dcb687992a7883e73b8c57df3e0 to your computer and use it in GitHub Desktop.
Create my list of #TopTenPodcasts2021
SELECT
CAST(SUM(ZMEDIADURATION) / 60 / 60 AS INT) AS listened_hours,
ZPODCAST.ZTITLE as podcast,
ZURL as url
FROM
ZPODCAST,
ZPODCASTEPISODE
WHERE
ZPODCASTEPISODE.ZPODCASTFOREPISODE == ZPODCAST.Z_PK
AND
datetime(ZPLAYBACKLATEST + strftime('%s', '2001-01-01 00:00:00'), 'unixepoch')
>
datetime(strftime('%s', '2021-01-01 00:00:00'), 'unixepoch')
GROUP BY
ZPODCAST.ZTITLE
ORDER BY
SUM(ZMEDIADURATION) DESC
LIMIT
10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment